Improve scaling
This commit is contained in:
+5
-2
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user