diff --git a/Sources/arm/App.hx b/Sources/arm/App.hx index 51acdbca..eb7546e8 100644 --- a/Sources/arm/App.hx +++ b/Sources/arm/App.hx @@ -22,6 +22,8 @@ class App extends iron.Trait { public static var uienabled = true; public static var isDragging = false; public static var dragAsset:TAsset = null; + public static var dragOffX = 0.0; + public static var dragOffY = 0.0; public static var showFiles = false; public static var showBox = false; public static var foldersOnly = false; @@ -310,9 +312,10 @@ class App extends iron.Trait { var mouse = iron.system.Input.getMouse(); if (arm.App.dragAsset != null) { var img = UITrait.inst.getImage(arm.App.dragAsset); - var ratio = 128 / img.width; + @:privateAccess var size = 50 * UITrait.inst.ui.SCALE; + var ratio = size / img.width; var h = img.height * ratio; - g.drawScaledImage(img, mouse.x + iron.App.x(), mouse.y + iron.App.y(), 128, h); + g.drawScaledImage(img, mouse.x + iron.App.x() + arm.App.dragOffX, mouse.y + iron.App.y() + arm.App.dragOffY, size, h); } var usingMenu = false; diff --git a/Sources/arm/ui/UINodes.hx b/Sources/arm/ui/UINodes.hx index c362cd92..597a33e4 100644 --- a/Sources/arm/ui/UINodes.hx +++ b/Sources/arm/ui/UINodes.hx @@ -312,7 +312,8 @@ class UINodes extends iron.Trait { var id = nodes.nodesSelected[0].buttons[0].default_value; if (id < UITrait.inst.assets.length) { var img = UITrait.inst.getImage(UITrait.inst.assets[id]); - ui.g.drawScaledImage(img, ww - 64 - 20, wh - 64 - 40, 64, 64); + var size = 64 * ui.SCALE; + ui.g.drawScaledImage(img, ww - size - 20 * ui.SCALE, wh - size - 40 * ui.SCALE, size, size); } } diff --git a/Sources/arm/ui/UITrait.hx b/Sources/arm/ui/UITrait.hx index b31aa0d9..2456bd23 100644 --- a/Sources/arm/ui/UITrait.hx +++ b/Sources/arm/ui/UITrait.hx @@ -2092,7 +2092,7 @@ class UITrait extends iron.Trait { @:privateAccess ui.endElement(); continue; } - var img = materials[i].imageIcon; + var img = ui.SCALE >= 2.0 ? materials[i].image : materials[i].imageIcon; var imgFull = materials[i].image; if (selectedMaterial == materials[i]) { @@ -2219,7 +2219,12 @@ class UITrait extends iron.Trait { } var img = UITrait.inst.getImage(asset); + var uix = ui._x; + var uiy = ui._y; if (ui.image(img) == State.Started) { + var mouse = iron.system.Input.getMouse(); + arm.App.dragOffX = -(mouse.x - uix - ui._windowX + iron.App.x() - 3); + arm.App.dragOffY = -(mouse.y - uiy - ui._windowY + iron.App.y() + 1); arm.App.dragAsset = asset; selectedTexture = asset; diff --git a/armorpaint.blend b/armorpaint.blend index 7a16bf71..9f733366 100644 Binary files a/armorpaint.blend and b/armorpaint.blend differ