refactoring

This commit is contained in:
sharlottes
2022-04-20 00:18:19 +09:00
parent 8cc932a647
commit e0c5cdc7d1
46 changed files with 393 additions and 488 deletions

View File

@@ -0,0 +1,37 @@
package unitinfo.ui;
import arc.math.geom.Vec2;
import arc.scene.Element;
import arc.scene.ui.ScrollPane;
import static arc.Core.input;
import static arc.Core.scene;
public class OverScrollPane extends ScrollPane {
Vec2 scrollPos;
public OverScrollPane(Element widget, ScrollPaneStyle style, Vec2 scrollPos){
super(widget, style);
this.scrollPos = scrollPos;
update(() -> {
if (hasScroll()) {
Element result = scene.hit(input.mouseX(), input.mouseY(), true);
if (result == null || !result.isDescendantOf(this)) {
scene.setScrollFocus(null);
}
}
scrollPos.x = getScrollX();
scrollPos.y = getScrollY();
});
setOverscroll(false, false);
setScrollYForce(scrollPos.x);
setScrollYForce(scrollPos.y);
}
public OverScrollPane disableScroll(boolean x, boolean y) {
setScrollingDisabled(x, y);
return this;
}
}