File tree Expand file tree Collapse file tree
src/main/java/com/cleanroommc/modularui Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77import org .jetbrains .annotations .ApiStatus ;
88import org .jetbrains .annotations .Nullable ;
99
10+ /**
11+ * This marks an {@link IDrawable} as hoverable in a {@link com.cleanroommc.modularui.drawable.text.RichText RichText}. This should not be
12+ * extended in most cases instead obtain an instance by calling {@link IIcon#asHoverable()}.
13+ */
14+ @ ApiStatus .NonExtendable
1015public interface IHoverable extends IIcon {
1116
1217 /**
13- * Called every frame this hoverable is hovered inside a {@link com.cleanroommc.modularui.drawable.text.RichText}.
18+ * Called every frame this hoverable is hovered inside a {@link com.cleanroommc.modularui.drawable.text.RichText RichText }.
1419 */
1520 default void onHover () {}
1621
@@ -19,7 +24,13 @@ default RichTooltip getTooltip() {
1924 return null ;
2025 }
2126
27+ /**
28+ * An internal function to set the current rendered position. This is used to detect if this element is under the mouse.
29+ */
2230 void setRenderedAt (int x , int y );
2331
32+ /**
33+ * @return the last area this drawable was drawn at.
34+ */
2435 Area getRenderedArea ();
2536}
Original file line number Diff line number Diff line change @@ -182,9 +182,10 @@ private void newLine() {
182182
183183 private void addLineElement (Object o ) {
184184 if (o instanceof String s2 ) {
185- if (this .currentLine .size () == 1 && this .currentLine .get (0 ) instanceof String s1 ) {
186- // if there is already one string in the line, merge them
187- this .currentLine .set (0 , s1 + s2 );
185+ int s = this .currentLine .size ();
186+ if (s > 0 && this .currentLine .get (s - 1 ) instanceof String s1 ) {
187+ // if the last element in the line is a string, merge them
188+ this .currentLine .set (s - 1 , s1 + s2 );
188189 return ;
189190 }
190191 if (this .currentLine .isEmpty ()) {
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ public class TestGuis extends CustomModularScreen {
4949
5050 @ Override
5151 public @ NotNull ModularPanel buildUI (ModularGuiContext context ) {
52- return buildListUi (context );
52+ return buildRichTextUI (context );
5353 }
5454
5555 public @ NotNull ModularPanel buildAnimationUI (ModularGuiContext context ) {
You can’t perform that action at this time.
0 commit comments