Commit 00bdddb2 authored by Christian Winter's avatar Christian Winter

reset position, rotation and scale for instances with alt and the corresponding key

parent be7136e7
Pipeline #4766208 passed with stage
in 59 seconds
......@@ -101,4 +101,17 @@ class LineManipulator {
static selectLinked() {
File.selectLinked();
}
static resetPosition() {
for (let instance of Selection.data.prefabInstances)
instance.transform.position = Vector2.zero;
}
static resetRotation() {
for (let instance of Selection.data.prefabInstances)
instance.transform.rotation = 0;
}
static resetScale() {
for (let instance of Selection.data.prefabInstances)
instance.transform.scale = new Vector2(1, 1);
}
}
\ No newline at end of file
......@@ -320,7 +320,7 @@ class Utilities {
static measure() {
let points = Selection.getAllSelectedPoints();
let x;
let y;
......
......@@ -13,24 +13,36 @@
break;
case Key.G:
if (!Selection.noSelection()) {
Logic.setState(new MoveLinesState());
if (Input.isKeyDown(Key.Alt))
LineManipulator.resetPosition();
else
Logic.setState(new MoveLinesState());
Renderer.redraw();
}
break;
case Key.R:
if (Input.isKeyDown(Key.Shift))
LineManipulator.rotateSelectionBy(90);
else if (Input.isKeyDown(Key.Control))
LineManipulator.rotateSelectionBy(-90);
else if (!Input.isKeyDown(Key.Shift) && !Input.isKeyDown(Key.Control))
if (!Selection.noSelection())
if (!Selection.noSelection()) {
if (Input.isKeyDown(Key.Shift))
LineManipulator.rotateSelectionBy(90);
else if (Input.isKeyDown(Key.Control))
LineManipulator.rotateSelectionBy(-90);
else if (Input.isKeyDown(Key.Alt))
LineManipulator.resetRotation();
else
Logic.setState(new RotateState());
Renderer.redraw();
}
break;
case Key.S:
if (!Input.isKeyDown(Key.Control) && !Input.isKeyDown(Key.Shift))
if (!Selection.noSelection())
Logic.setState(new ScaleState());
if (!Selection.noSelection()) {
if (Input.isKeyDown(Key.Alt))
LineManipulator.resetScale();
else
Logic.setState(new ScaleState());
Renderer.redraw();
}
break;
case Key.D:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment