diff --git a/Sources/arm/Operator.hx b/Sources/arm/Operator.hx index 377ce143..57c555a1 100644 --- a/Sources/arm/Operator.hx +++ b/Sources/arm/Operator.hx @@ -28,9 +28,11 @@ class Operator { s = s.substr(s.lastIndexOf("+") + 1); } else if (shift || ctrl || alt) return flag; - var key = (s == "left" || s == "right" || s == "middle") ? mouse.down(s) : - type == ShortcutRepeat ? kb.repeat(s) : - type == ShortcutDown ? kb.down(s) : kb.started(s); + var key = (s == "left" || s == "right" || s == "middle") ? + // Mouse + (type == ShortcutDown ? mouse.down(s) : mouse.started(s)) : + // Keyboard + (type == ShortcutRepeat ? kb.repeat(s) : type == ShortcutDown ? kb.down(s) : kb.started(s)); return flag && key; } } diff --git a/Sources/arm/node/brush/InputNode.hx b/Sources/arm/node/brush/InputNode.hx index a26c11ad..f5815226 100644 --- a/Sources/arm/node/brush/InputNode.hx +++ b/Sources/arm/node/brush/InputNode.hx @@ -35,8 +35,8 @@ class InputNode extends LogicNode { } var lazyPaint = Context.brushLazyRadius > 0 && - (Operator.shortcut(Config.keymap.action_paint) || - Operator.shortcut(Config.keymap.brush_ruler + "+" + Config.keymap.action_paint)); + (Operator.shortcut(Config.keymap.action_paint, ShortcutDown) || + Operator.shortcut(Config.keymap.brush_ruler + "+" + Config.keymap.action_paint, ShortcutDown)); var mouse = iron.system.Input.getMouse(); var paintX = mouse.viewX / iron.App.w(); @@ -56,7 +56,7 @@ class InputNode extends LogicNode { startY = pen.viewY / iron.App.h(); } - if (Operator.shortcut(Config.keymap.brush_ruler + "+" + Config.keymap.action_paint)) { + if (Operator.shortcut(Config.keymap.brush_ruler + "+" + Config.keymap.action_paint, ShortcutDown)) { if (lockX) paintX = startX; if (lockY) paintY = startY; } diff --git a/Sources/arm/plugin/Camera.hx b/Sources/arm/plugin/Camera.hx index d6d1a495..4343424d 100644 --- a/Sources/arm/plugin/Camera.hx +++ b/Sources/arm/plugin/Camera.hx @@ -47,7 +47,7 @@ class Camera { var modif = kb.down("alt") || kb.down("shift") || kb.down("control") || Config.keymap.action_rotate == "middle"; var controls = Context.cameraControls; if (controls == ControlsOrbit) { - if (Operator.shortcut(Config.keymap.action_rotate) || (mouse.down("right") && !modif)) { + if (Operator.shortcut(Config.keymap.action_rotate, ShortcutDown) || (mouse.down("right") && !modif)) { redraws = 2; camera.transform.move(camera.lookWorld(), dist); camera.transform.rotate(new iron.math.Vec4(0, 0, 1), -mouse.movementX / 100); @@ -60,7 +60,7 @@ class Camera { panAction(modif); - if (Operator.shortcut(Config.keymap.action_zoom)) { + if (Operator.shortcut(Config.keymap.action_zoom, ShortcutDown)) { redraws = 2; var f = -mouse.movementY / 150; camera.transform.move(camera.look(), f); @@ -74,7 +74,7 @@ class Camera { dist -= f; } - if (Operator.shortcut(Config.keymap.rotate_light)) { + if (Operator.shortcut(Config.keymap.rotate_light, ShortcutDown)) { redraws = 2; var light = iron.Scene.active.lights[0]; var m = iron.math.Mat4.identity(); @@ -82,9 +82,14 @@ class Camera { light.transform.local.multmat(m); light.transform.decompose(); } + + if (Operator.shortcut(Config.keymap.rotate_envmap, ShortcutDown)) { + redraws = 2; + Context.envmapAngle -= mouse.movementX / 100; + } } else if (controls == ControlsRotate) { - if (Operator.shortcut(Config.keymap.action_rotate) || (mouse.down("right") && !modif)) { + if (Operator.shortcut(Config.keymap.action_rotate, ShortcutDown) || (mouse.down("right") && !modif)) { redraws = 2; var t = Context.object.transform; var up = t.up().normalize(); @@ -99,7 +104,7 @@ class Camera { panAction(modif); - if (Operator.shortcut(Config.keymap.action_zoom)) { + if (Operator.shortcut(Config.keymap.action_zoom, ShortcutDown)) { redraws = 2; camera.transform.move(camera.look(), -mouse.movementY / 150); } @@ -170,7 +175,7 @@ class Camera { function panAction(modif: Bool) { var camera = iron.Scene.active.camera; var mouse = Input.getMouse(); - if (Operator.shortcut(Config.keymap.action_pan) || (mouse.down("middle") && !modif)) { + if (Operator.shortcut(Config.keymap.action_pan, ShortcutDown) || (mouse.down("middle") && !modif)) { redraws = 2; var look = camera.transform.look().normalize().mult(mouse.movementY / 150); var right = camera.transform.right().normalize().mult(-mouse.movementX / 150); diff --git a/Sources/arm/ui/UISidebar.hx b/Sources/arm/ui/UISidebar.hx index 38e59218..cdce5bcf 100644 --- a/Sources/arm/ui/UISidebar.hx +++ b/Sources/arm/ui/UISidebar.hx @@ -483,9 +483,9 @@ class UISidebar { var mouse = Input.getMouse(); var kb = Input.getKeyboard(); - var setCloneSource = Context.tool == ToolClone && Operator.shortcut(Config.keymap.set_clone_source + "+" + Config.keymap.action_paint); + var setCloneSource = Context.tool == ToolClone && Operator.shortcut(Config.keymap.set_clone_source + "+" + Config.keymap.action_paint, ShortcutDown); - if (Context.brushStencilImage != null && Operator.shortcut(Config.keymap.stencil_transform)) { + if (Context.brushStencilImage != null && Operator.shortcut(Config.keymap.stencil_transform, ShortcutDown)) { var r = getBrushStencilRect(); if (mouse.started("left")) { Context.brushStencilScaling = @@ -534,9 +534,9 @@ class UISidebar { Context.brushStencilY += (oldH - newH) / App.h() / 2; } - var down = Operator.shortcut(Config.keymap.action_paint) || + var down = Operator.shortcut(Config.keymap.action_paint, ShortcutDown) || setCloneSource || - Operator.shortcut(Config.keymap.brush_ruler + "+" + Config.keymap.action_paint) || + Operator.shortcut(Config.keymap.brush_ruler + "+" + Config.keymap.action_paint, ShortcutDown) || (Input.getPen().down() && !kb.down("alt")); if (down) { var mx = mouse.viewX; @@ -557,7 +557,7 @@ class UISidebar { @:privateAccess ui.comboSelectedHandle == null) { // Paint started // Draw line - if (Operator.shortcut(Config.keymap.brush_ruler + "+" + Config.keymap.action_paint)) { + if (Operator.shortcut(Config.keymap.brush_ruler + "+" + Config.keymap.action_paint, ShortcutDown)) { Context.lastPaintVecX = Context.lastPaintX; Context.lastPaintVecY = Context.lastPaintY; } @@ -739,7 +739,7 @@ class UISidebar { g.popTransformation(); g.color = 0xffffffff; } - var transform = Operator.shortcut(Config.keymap.stencil_transform); + var transform = Operator.shortcut(Config.keymap.stencil_transform, ShortcutDown); if (transform) { // Outline g.drawRect(r.x, r.y, r.w, r.h); diff --git a/Sources/arm/ui/UIView2D.hx b/Sources/arm/ui/UIView2D.hx index 877e3c90..20582206 100644 --- a/Sources/arm/ui/UIView2D.hx +++ b/Sources/arm/ui/UIView2D.hx @@ -277,11 +277,11 @@ class UIView2D { if (panScale > 3.0) panScale = 3.0; } - var setCloneSource = Context.tool == ToolClone && Operator.shortcut("alt+" + Config.keymap.action_paint); + var setCloneSource = Context.tool == ToolClone && Operator.shortcut(Config.keymap.set_clone_source + "+" + Config.keymap.action_paint, ShortcutDown); if (type == View2DLayer && - (Operator.shortcut(Config.keymap.action_paint) || - Operator.shortcut(Config.keymap.brush_ruler + "+" + Config.keymap.action_paint) || + (Operator.shortcut(Config.keymap.action_paint, ShortcutDown) || + Operator.shortcut(Config.keymap.brush_ruler + "+" + Config.keymap.action_paint, ShortcutDown) || setCloneSource || Config.raw.brush_live)) { Context.paint2d = true;