From ea596f33e6a7b372790f7b6e56c703b20124f084 Mon Sep 17 00:00:00 2001 From: miozune Date: Thu, 24 Aug 2023 19:27:53 +0900 Subject: [PATCH] Rename markDirty -> markTooltipDirty (#24) (cherry picked from commit eadf5f0e13a95bc00d86545e120172b171abb0bc) --- .../java/com/cleanroommc/modularui/api/widget/IWidget.java | 5 ++--- .../java/com/cleanroommc/modularui/widget/EmptyWidget.java | 2 +- src/main/java/com/cleanroommc/modularui/widget/Widget.java | 4 ++-- .../com/cleanroommc/modularui/widgets/CycleButtonWidget.java | 4 ++-- .../java/com/cleanroommc/modularui/widgets/FluidSlot.java | 4 ++-- .../cleanroommc/modularui/widgets/ScrollingTextWidget.java | 2 +- .../modularui/widgets/textfield/TextFieldHandler.java | 2 +- .../modularui/widgets/textfield/TextFieldWidget.java | 4 ++-- 8 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/cleanroommc/modularui/api/widget/IWidget.java b/src/main/java/com/cleanroommc/modularui/api/widget/IWidget.java index a8508580..88e78500 100644 --- a/src/main/java/com/cleanroommc/modularui/api/widget/IWidget.java +++ b/src/main/java/com/cleanroommc/modularui/api/widget/IWidget.java @@ -139,10 +139,9 @@ default boolean canHover() { } /** - * Marks this widget as dirty. - * Mainly used for the tooltip. + * Marks tooltip for this widget as dirty. */ - void markDirty(); + void markTooltipDirty(); /** * @return the parent of this widget diff --git a/src/main/java/com/cleanroommc/modularui/widget/EmptyWidget.java b/src/main/java/com/cleanroommc/modularui/widget/EmptyWidget.java index 2b7e6d42..8acd4d61 100644 --- a/src/main/java/com/cleanroommc/modularui/widget/EmptyWidget.java +++ b/src/main/java/com/cleanroommc/modularui/widget/EmptyWidget.java @@ -78,7 +78,7 @@ public boolean canBeSeen(IViewportStack stack) { } @Override - public void markDirty() { + public void markTooltipDirty() { } @Override diff --git a/src/main/java/com/cleanroommc/modularui/widget/Widget.java b/src/main/java/com/cleanroommc/modularui/widget/Widget.java index 9e7ece4c..8fa353ec 100644 --- a/src/main/java/com/cleanroommc/modularui/widget/Widget.java +++ b/src/main/java/com/cleanroommc/modularui/widget/Widget.java @@ -118,7 +118,7 @@ public void initialiseSyncHandler(GuiSyncManager syncHandler) { throw new IllegalStateException("SyncHandler of type " + type + " is not valid for " + getClass().getName() + ", with key " + this.syncKey); } if (this.syncHandler instanceof ValueSyncHandler && ((ValueSyncHandler) this.syncHandler).getChangeListener() == null) { - ((ValueSyncHandler) this.syncHandler).setChangeListener(this::markDirty); + ((ValueSyncHandler) this.syncHandler).setChangeListener(this::markTooltipDirty); } } } @@ -217,7 +217,7 @@ public boolean isValid() { } @Override - public void markDirty() { + public void markTooltipDirty() { if (this.tooltip != null) { this.tooltip.markDirty(); } diff --git a/src/main/java/com/cleanroommc/modularui/widgets/CycleButtonWidget.java b/src/main/java/com/cleanroommc/modularui/widgets/CycleButtonWidget.java index cabbab89..2d0e79f0 100644 --- a/src/main/java/com/cleanroommc/modularui/widgets/CycleButtonWidget.java +++ b/src/main/java/com/cleanroommc/modularui/widgets/CycleButtonWidget.java @@ -128,8 +128,8 @@ public boolean hasTooltip() { } @Override - public void markDirty() { - super.markDirty(); + public void markTooltipDirty() { + super.markTooltipDirty(); for (Tooltip tooltip : this.stateTooltip) { tooltip.markDirty(); } diff --git a/src/main/java/com/cleanroommc/modularui/widgets/FluidSlot.java b/src/main/java/com/cleanroommc/modularui/widgets/FluidSlot.java index aef292dd..bd970d92 100644 --- a/src/main/java/com/cleanroommc/modularui/widgets/FluidSlot.java +++ b/src/main/java/com/cleanroommc/modularui/widgets/FluidSlot.java @@ -175,7 +175,7 @@ public boolean onMouseScroll(ModularScreen.UpOrDown scrollDirection, int amount) @Override public @NotNull Result onKeyPressed(char typedChar, int keyCode) { if (keyCode == Keyboard.KEY_LSHIFT || keyCode == Keyboard.KEY_RSHIFT) { - markDirty(); + markTooltipDirty(); } return Interactable.super.onKeyPressed(typedChar, keyCode); } @@ -183,7 +183,7 @@ public boolean onMouseScroll(ModularScreen.UpOrDown scrollDirection, int amount) @Override public boolean onKeyRelease(char typedChar, int keyCode) { if (keyCode == Keyboard.KEY_LSHIFT || keyCode == Keyboard.KEY_RSHIFT) { - markDirty(); + markTooltipDirty(); } return Interactable.super.onKeyRelease(typedChar, keyCode); } diff --git a/src/main/java/com/cleanroommc/modularui/widgets/ScrollingTextWidget.java b/src/main/java/com/cleanroommc/modularui/widgets/ScrollingTextWidget.java index 1274b65a..073950d3 100644 --- a/src/main/java/com/cleanroommc/modularui/widgets/ScrollingTextWidget.java +++ b/src/main/java/com/cleanroommc/modularui/widgets/ScrollingTextWidget.java @@ -75,7 +75,7 @@ private void checkString() { TextRenderer.SHARED.setScale(getScale()); this.line = TextRenderer.SHARED.line(s); this.scroll = 0; - markDirty(); + markTooltipDirty(); } } diff --git a/src/main/java/com/cleanroommc/modularui/widgets/textfield/TextFieldHandler.java b/src/main/java/com/cleanroommc/modularui/widgets/textfield/TextFieldHandler.java index c1bd01c8..0b24b900 100644 --- a/src/main/java/com/cleanroommc/modularui/widgets/textfield/TextFieldHandler.java +++ b/src/main/java/com/cleanroommc/modularui/widgets/textfield/TextFieldHandler.java @@ -234,7 +234,7 @@ public List getText() { } public void onChanged() { - this.textFieldWidget.markDirty(); + this.textFieldWidget.markTooltipDirty(); } public String getSelectedText() { diff --git a/src/main/java/com/cleanroommc/modularui/widgets/textfield/TextFieldWidget.java b/src/main/java/com/cleanroommc/modularui/widgets/textfield/TextFieldWidget.java index 5a97c492..ca31f11a 100644 --- a/src/main/java/com/cleanroommc/modularui/widgets/textfield/TextFieldWidget.java +++ b/src/main/java/com/cleanroommc/modularui/widgets/textfield/TextFieldWidget.java @@ -58,7 +58,7 @@ public boolean isValidSyncHandler(SyncHandler syncHandler) { if (syncHandler instanceof IStringValue && syncHandler instanceof ValueSyncHandler) { this.stringValue = (IStringValue) syncHandler; ((ValueSyncHandler) this.stringValue).setChangeListener(() -> { - markDirty(); + markTooltipDirty(); setText(this.stringValue.getValue().toString()); }); return true; @@ -129,7 +129,7 @@ public void onRemoveFocus(GuiContext context) { this.handler.getText().add(this.validator.apply("")); } else if (this.handler.getText().size() == 1) { this.handler.getText().set(0, this.validator.apply(this.handler.getText().get(0))); - markDirty(); + markTooltipDirty(); } else { throw new IllegalStateException("TextFieldWidget can only have one line!"); }