apply upstream fixes

This commit is contained in:
yugecin 2017-01-29 22:55:11 +01:00
parent 1745ae73a1
commit c00b2b877a
4 changed files with 16 additions and 19 deletions

BIN
res/search.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

View File

@ -115,7 +115,8 @@ public class KineticScrolling {
amplitude = 0; amplitude = 0;
target = position = max; target = position = max;
} }
} else if (position < min) { }
if (position < min) {
if (allowOverScroll) { if (allowOverScroll) {
scrollToPosition(min); scrollToPosition(min);
} else { } else {

View File

@ -96,7 +96,16 @@ public class TextField extends Component {
} }
public void render(Graphics g) { public void render(Graphics g) {
performKeyRepeat(); if (lastKey != -1) {
if (displayContainer.input.isKeyDown(lastKey)) {
if (repeatTimer < System.currentTimeMillis()) {
repeatTimer = System.currentTimeMillis() + KEY_REPEAT_INTERVAL;
keyPressed(lastKey, lastChar);
}
} else {
lastKey = -1;
}
}
Rectangle oldClip = g.getClip(); Rectangle oldClip = g.getClip();
g.setWorldClip(x,y,width, height); g.setWorldClip(x,y,width, height);
@ -136,20 +145,6 @@ public class TextField extends Component {
g.setClip(oldClip); g.setClip(oldClip);
} }
public void performKeyRepeat() {
if (lastKey == -1) {
return;
}
if (!displayContainer.input.isKeyDown(lastKey)) {
lastKey = -1;
return;
}
if (repeatTimer < System.currentTimeMillis()) {
repeatTimer = System.currentTimeMillis() + KEY_REPEAT_INTERVAL;
keyPressed(lastKey, lastChar);
}
}
public String getText() { public String getText() {
return value; return value;
} }

View File

@ -151,6 +151,8 @@ public class OptionsOverlay extends OverlayOpsuState {
listHoverIndex = -1; listHoverIndex = -1;
searchField = new TextField(displayContainer, null, 0, 0, 0, 0); searchField = new TextField(displayContainer, null, 0, 0, 0, 0);
searchField.setMaxLength(20);
scrollHandler = new KineticScrolling(); scrollHandler = new KineticScrolling();
scrollHandler.setAllowOverScroll(true); scrollHandler.setAllowOverScroll(true);
} }
@ -263,7 +265,7 @@ public class OptionsOverlay extends OverlayOpsuState {
if (hoverOption.getType() == OptionType.NUMERIC) { if (hoverOption.getType() == OptionType.NUMERIC) {
tip = "(" + hoverOption.getValueString() + ") " + tip; tip = "(" + hoverOption.getValueString() + ") " + tip;
} }
UI.updateTooltip(displayContainer.renderDelta, tip, false); UI.updateTooltip(displayContainer.renderDelta, tip, true);
UI.drawTooltip(g); UI.drawTooltip(g);
} }
} }
@ -509,6 +511,7 @@ public class OptionsOverlay extends OverlayOpsuState {
@Override @Override
public void hide() { public void hide() {
searchField.setFocused(false);
acceptInput = false; acceptInput = false;
SoundController.playSound(SoundEffect.MENUBACK); SoundController.playSound(SoundEffect.MENUBACK);
hideAnimationTime = animationtime; hideAnimationTime = animationtime;
@ -535,8 +538,6 @@ public class OptionsOverlay extends OverlayOpsuState {
scrollHandler.update(delta); scrollHandler.update(delta);
searchField.performKeyRepeat();
updateShowHideAnimation(delta); updateShowHideAnimation(delta);
if (animationtime <= 0) { if (animationtime <= 0) {
active = false; active = false;