Drag layer to reorder

This commit is contained in:
luboslenco
2020-01-26 23:11:13 +01:00
parent 76f1228421
commit 64f1163855
2 changed files with 19 additions and 0 deletions
+7
View File
@@ -16,6 +16,7 @@ import arm.ui.UIView2D;
import arm.ui.UIMenu;
import arm.ui.UIBox;
import arm.ui.UIFiles;
import arm.ui.TabLayers;
import arm.io.ImportAsset;
import arm.sys.Path;
import arm.util.RenderUtil;
@@ -24,6 +25,7 @@ import arm.data.MaterialSlot;
import arm.data.LayerSlot;
import arm.data.ConstData;
import arm.plugin.Camera;
import arm.node.MaterialParser;
import arm.Config;
import arm.Tool;
import arm.Project;
@@ -376,6 +378,11 @@ class App {
}
UINodes.inst.acceptLayerDrag(index);
}
else if (inLayers && isDragging) {
Project.layers.remove(dragLayer);
Project.layers.insert(TabLayers.dragDestination, dragLayer);
MaterialParser.parseMeshMaterial();
}
dragLayer = null;
}
else if (dragFile != null) {
+12
View File
@@ -10,6 +10,8 @@ import arm.util.UVUtil;
class TabLayers {
public static var dragDestination = 1;
@:access(zui.Zui)
public static function draw() {
var ui = UITrait.inst.ui;
@@ -80,6 +82,16 @@ class TabLayers {
}
}
// Highlight drag destination
var mouse = Input.getMouse();
var mx = mouse.x;
var my = mouse.y;
var inLayers = mx > UITrait.inst.tabx && my < UITrait.inst.tabh;
if (App.isDragging && App.dragLayer != null && my > ui._y - step && my < ui._y + step) {
ui.fill(checkw, 0, (ui._windowW / ui.SCALE() - 2) - checkw, 2 * ui.SCALE(), ui.t.HIGHLIGHT_COL);
dragDestination = Project.layers.indexOf(App.dragLayer) < i ? i : i + 1;
}
if (l.texpaint_mask != null) {
ui.row([8 / 100, 16 / 100, 16 / 100, 20 / 100, 30 / 100, 10 / 100]);
}