Commit a27bb3d7 authored by Christian Winter's avatar Christian Winter

merge split and moved parts into selection class

parent cef68d97
Pipeline #5143089 passed with stage
in 40 seconds
...@@ -164,16 +164,11 @@ Utilities = new class { ...@@ -164,16 +164,11 @@ Utilities = new class {
return points; return points;
} }
// TODO make part of selection class? mergePoints(points) {
mergeSelectedPoints() { let center = this.calculateBBCenter(points);
let selection = Application.currentView.selection;
let endings = selection.getAllSelectedPoints();
let center = this.calculateBBCenter(endings);
for (let ending of endings)
ending.position = center.copy();
Application.redrawAllViews(); for (let p of points)
p.position = center.copy();
} }
// TODO make it possible to pass in, position as Vector2 and rotate as angle // TODO make it possible to pass in, position as Vector2 and rotate as angle
......
...@@ -170,6 +170,11 @@ ...@@ -170,6 +170,11 @@
Application.redrawAllViews(); Application.redrawAllViews();
} }
merge() {
Utilities.mergePoints(this.data.getAllPositions())
Application.redrawAllViews();
}
moveBy(delta) { moveBy(delta) {
let points = this.data.getAllPositions(); let points = this.data.getAllPositions();
...@@ -181,4 +186,6 @@ ...@@ -181,4 +186,6 @@
rotate() { rotate() {
} }
} }
\ No newline at end of file
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
this.arrowMovement(0, 1, Input.isKeyDown(Key.Shift), Input.isKeyDown(Key.Control)); this.arrowMovement(0, 1, Input.isKeyDown(Key.Shift), Input.isKeyDown(Key.Control));
break; break;
case Key.M: case Key.M:
Utilities.mergeSelectedPoints(); Application.currentView.selection.merge();
break; break;
case Key.Z: case Key.Z:
......
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