mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix dpi bugs??
This commit is contained in:
parent
323598c4f2
commit
e058f28865
3 changed files with 23 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package gui;
|
||||
|
||||
import hxd.Key;
|
||||
import h3d.Vector;
|
||||
import src.Settings;
|
||||
import gui.GuiControl.MouseState;
|
||||
|
|
@ -189,7 +190,7 @@ class GuiScrollCtrl extends GuiControl {
|
|||
}
|
||||
for (i in 0...this._flow.numChildren) {
|
||||
var ch = this._flow.getChildAt(i);
|
||||
ch.y -= cast(actualDelta * this.maxScrollY * Settings.uiScale * Settings.uiScale / renderRect.extent.y);
|
||||
ch.y -= cast(actualDelta * this.maxScrollY / renderRect.extent.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -240,6 +241,24 @@ class GuiScrollCtrl extends GuiControl {
|
|||
}
|
||||
}
|
||||
|
||||
public override function update(dt:Float, mouseState:MouseState) {
|
||||
if (Key.isPressed(Key.MOUSE_WHEEL_DOWN)) {
|
||||
var renderRect = this.getRenderRectangle();
|
||||
var scrollBarYSize = renderRect.extent.y * renderRect.extent.y / (maxScrollY * Settings.uiScale);
|
||||
this.scrollY += scrollBarYSize / 10;
|
||||
deltaY = scrollBarYSize / 10;
|
||||
this.updateScrollVisual();
|
||||
}
|
||||
if (Key.isPressed(Key.MOUSE_WHEEL_UP)) {
|
||||
var renderRect = this.getRenderRectangle();
|
||||
var scrollBarYSize = renderRect.extent.y * renderRect.extent.y / (maxScrollY * Settings.uiScale);
|
||||
this.scrollY -= scrollBarYSize / 10;
|
||||
deltaY = -scrollBarYSize / 10;
|
||||
this.updateScrollVisual();
|
||||
}
|
||||
super.update(dt, mouseState);
|
||||
}
|
||||
|
||||
// public override function onMouseDown(mouseState:MouseState) {
|
||||
// var renderRect = this.getHitTestRect();
|
||||
// if (mouseState.position.x >= renderRect.position.x + renderRect.extent.x - 10) {
|
||||
|
|
|
|||
|
|
@ -80,7 +80,8 @@ 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) * Settings.uiScale));
|
||||
Math.floor((!scrollable ? renderRect.position.y : 0)
|
||||
+ (i * (text.font.size + 4 * Settings.uiScale) + (5 + textYOffset) * Settings.uiScale - this.scroll)));
|
||||
|
||||
if (_prevSelected == i) {
|
||||
text.textColor = selectedColor;
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class OptionsDlg extends GuiImage {
|
|||
generalPanel = new GuiScrollCtrl(ResourceLoader.getResource("data/ui/common/philscroll.png", ResourceLoader.getImage, this.imageResources).toTile());
|
||||
generalPanel.position = new Vector(30, 88);
|
||||
generalPanel.extent = new Vector(726, 364);
|
||||
generalPanel.maxScrollY = 394;
|
||||
generalPanel.maxScrollY = 394 * Settings.uiScale;
|
||||
window.addChild(generalPanel);
|
||||
|
||||
var currentTab = "general";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue