mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix scroll
This commit is contained in:
parent
d4b865db79
commit
913f3d475d
1 changed files with 2 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ class GuiScrollCtrl extends GuiControl {
|
||||||
public var scrollY:Float = 0;
|
public var scrollY:Float = 0;
|
||||||
|
|
||||||
var maxScrollY:Float;
|
var maxScrollY:Float;
|
||||||
|
var scrollSpeed = 500.0;
|
||||||
|
|
||||||
var scrollBarY:h2d.Object;
|
var scrollBarY:h2d.Object;
|
||||||
|
|
||||||
|
|
@ -204,7 +205,7 @@ class GuiScrollCtrl extends GuiControl {
|
||||||
if (Util.isTouchDevice()) {
|
if (Util.isTouchDevice()) {
|
||||||
super.onMouseMove(mouseState);
|
super.onMouseMove(mouseState);
|
||||||
if (this.pressed) {
|
if (this.pressed) {
|
||||||
var dy = mouseState.position.y - this.prevMousePos.y;
|
var dy = (mouseState.position.y - this.prevMousePos.y) * scrollSpeed / this.maxScrollY;
|
||||||
this.scrollY -= dy;
|
this.scrollY -= dy;
|
||||||
this.prevMousePos = mouseState.position;
|
this.prevMousePos = mouseState.position;
|
||||||
this.updateScrollVisual();
|
this.updateScrollVisual();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue