Skip to content

Commit

Permalink
- Fixed out of bounds error when TextBox is set to value smaller than…
Browse files Browse the repository at this point in the history
… previous value
  • Loading branch information
tomcashman committed Mar 20, 2019
1 parent be1a618 commit 5b80abc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- Fixed UI navigation cursor not updating when switching between controller and mouse
- Fixed DesktopPlayerData not ensuring data directory exists when writing JSON or binary files
- Fixed Sprite not carrying over flip status from TextureRegion
- Fixed out of bounds error when TextBox is set to value smaller than previous value
- (#79) Add isInterpolateRequired() to collision classes

[1.8.2]
Expand Down
2 changes: 2 additions & 0 deletions ui/src/main/java/org/mini2Dx/ui/element/TextBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.mini2Dx.ui.layout.*;
import org.mini2Dx.ui.listener.ActionListener;
import org.mini2Dx.ui.listener.TextInputListener;
import org.mini2Dx.ui.render.NodeState;
import org.mini2Dx.ui.render.ParentRenderNode;
import org.mini2Dx.ui.render.TextBoxRenderNode;
import org.mini2Dx.ui.render.UiContainerRenderTree;
Expand Down Expand Up @@ -293,6 +294,7 @@ public boolean grabInput(UiContainer uiContainer) {
return false;
}
uiContainer.setActiveAction(renderNode);
renderNode.setState(NodeState.ACTION);
return true;
}

Expand Down
4 changes: 4 additions & 0 deletions ui/src/main/java/org/mini2Dx/ui/render/TextBoxRenderNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ public void update(UiContainerRenderTree uiContainer, float delta) {
if (cursorTimer <= 0f) {
cursorTimer += CURSOR_VISIBLE_DURATION * 2f;
}
if (cursor > element.getValue().length()) {
cursor = element.getValue().length();
setCursorRenderX();
}
cursorTimer -= delta;
}

Expand Down

0 comments on commit 5b80abc

Please sign in to comment.