diff --git a/src/gui/GuiScrollCtrl.hx b/src/gui/GuiScrollCtrl.hx index 5e4a3d8f..31b7a759 100644 --- a/src/gui/GuiScrollCtrl.hx +++ b/src/gui/GuiScrollCtrl.hx @@ -40,7 +40,8 @@ class GuiScrollCtrl extends GuiControl { this.scrollBottomPressedTile = scrollBar.sub(11, 13, 10, 6); this.scrollFillPressedTile = scrollBar.sub(11, 11, 10, 1); this.scrollBarY = new Graphics(); - this.clickInteractive = new Interactive(10, 1); + this.scrollBarY.scale(Settings.uiScale); + this.clickInteractive = new Interactive(10 * Settings.uiScale, 1); this.clickInteractive.onPush = (e) -> { if (!this.pressed) { this.pressed = true; @@ -57,7 +58,7 @@ class GuiScrollCtrl extends GuiControl { if (prevEY == null) { prevEY = e2.relY; } else { - this.scrollY += e2.relY - prevEY; + this.scrollY += (e2.relY - prevEY); prevEY = e2.relY; this.updateScrollVisual(); } @@ -111,13 +112,13 @@ class GuiScrollCtrl extends GuiControl { return; } - var scrollBarYSize = renderRect.extent.y * renderRect.extent.y / maxScrollY; + var scrollBarYSize = renderRect.extent.y * renderRect.extent.y / (maxScrollY * Settings.uiScale); - this.scrollY = Util.clamp(scrollY, 0, renderRect.extent.y - scrollBarYSize); + this.scrollY = Util.clamp(scrollY, 0, renderRect.extent.y - scrollBarYSize * Settings.uiScale); - this.scrollBarY.setPosition(renderRect.position.x + renderRect.extent.x - 10, renderRect.position.y + scrollY); + this.scrollBarY.setPosition(renderRect.position.x + renderRect.extent.x - 10 * Settings.uiScale, renderRect.position.y + scrollY); - this.clickInteractive.setPosition(renderRect.position.x + renderRect.extent.x - 10, renderRect.position.y); + this.clickInteractive.setPosition(renderRect.position.x + renderRect.extent.x - 10 * Settings.uiScale, renderRect.position.y); this.clickInteractive.height = renderRect.extent.y; diff --git a/src/gui/GuiTextListCtrl.hx b/src/gui/GuiTextListCtrl.hx index adad28ca..bc030f3f 100644 --- a/src/gui/GuiTextListCtrl.hx +++ b/src/gui/GuiTextListCtrl.hx @@ -12,6 +12,7 @@ import h2d.Scene; import h2d.Text; import h2d.Font; import src.MarbleGame; +import src.Settings; class GuiTextListCtrl extends GuiControl { public var texts:Array; @@ -78,7 +79,7 @@ class GuiTextListCtrl extends GuiControl { for (i in 0...textObjs.length) { var text = textObjs[i]; text.setPosition(Math.floor((!scrollable ? renderRect.position.x : 0) + 5), - Math.floor((!scrollable ? renderRect.position.y : 0) + (i * (text.font.size + 4) + 5 + textYOffset - this.scroll))); + Math.floor((!scrollable ? renderRect.position.y : 0) + (i * (text.font.size + 4) + 5 + textYOffset * Settings.uiScale - this.scroll))); if (_prevSelected == i) { text.textColor = selectedColor; @@ -126,7 +127,7 @@ class GuiTextListCtrl extends GuiControl { } text.setPosition(Math.floor((!scrollable ? renderRect.position.x : 0) + 5), - Math.floor((!scrollable ? renderRect.position.y : 0) + (i * (text.font.size + 4) + 5 + textYOffset - this.scroll))); + Math.floor((!scrollable ? renderRect.position.y : 0) + (i * (text.font.size + 4) + 5 + textYOffset * Settings.uiScale - this.scroll))); if (_prevSelected == i) { text.textColor = selectedColor; @@ -257,7 +258,7 @@ class GuiTextListCtrl extends GuiControl { var hittestrect = this.getHitTestRect(); for (i in 0...textObjs.length) { var text = textObjs[i]; - text.y = Math.floor((i * (text.font.size + 4) + 5 + textYOffset - scrollY)); + text.y = Math.floor((i * (text.font.size + 4) + 5 + textYOffset * Settings.uiScale - scrollY)); g.y = renderRect.position.y - scrollY; } redrawSelectionRect(hittestrect);