Commit 3f9d135c authored by Christian Winter's avatar Christian Winter

pivot now part of globals

parent 620dce20
......@@ -27,7 +27,7 @@ class LineManipulator {
let selAsPoints = selection.getAllSelectedPoints();
if (rotationCenter == undefined) {
if (Preferences.usePivot)
rotationCenter = pivot;
rotationCenter = Globals.pivot;
else
rotationCenter = Utilities.calculateCenterOfMass(selection.data.getAllPositions());
}
......@@ -72,7 +72,7 @@ class LineManipulator {
let center;
if (Preferences.usePivot)
center = pivot;
center = Globals.pivot;
else
center = Utilities.calculateBBCenter(selection.data.getAllPositions());
......
......@@ -126,13 +126,13 @@
else {
if (this.mouseMovedAfterMouseDown == false) {
if (Input.isKeyDown(Key.Alt))
pivot = new Vector2(0, 0);
Globals.pivot = new Vector2(0, 0);
else
pivot = Application.cursor.currentPosition;
Globals.pivot = Application.cursor.currentPosition;
if (Preferences.gridType == 2)
if (GridManager.grid.placePolarGridCenterAt2DCursor == true)
GridManager.grid.positionOffset = pivot.copy();
GridManager.grid.positionOffset = Globals.pivot.copy();
}
this.logic.setState(new IdleState());
......
......@@ -84,7 +84,7 @@
}
resetView() {
pivot = Vector2.zero;
Globals.pivot = Vector2.zero;
this.setZoom(1, false);
this.position = (new Vector2(this.view.canvas.width * 0.5, this.view.canvas.height * 0.5));
......
......@@ -719,7 +719,7 @@
GridManager.grid.placePolarGridCenterAt2DCursor = checked;
if (GridManager.grid.placePolarGridCenterAt2DCursor == true)
GridManager.grid.positionOffset = pivot.copy();
GridManager.grid.positionOffset = Globals.pivot.copy();
else
GridManager.grid.positionOffset = Vector2.zero;
......
var pivot = new Vector2(0, 0);
var offscreenCanvas;
var offscreenContext;
......
......@@ -689,7 +689,7 @@
let center;
if (Preferences.usePivot)
center = pivot;
center = Globals.pivot;
else
center = Utilities.calculateCenterOfMass(this.view.selection.data.getAllPositions());
......@@ -719,7 +719,7 @@
let center;
if (Preferences.usePivot)
center = pivot;
center = Globals.pivot;
else
center = Utilities.calculateBBCenter(this.view.selection.data.getAllPositions());
......@@ -749,9 +749,9 @@
let radius = 10 / this.view.camera.zoom;
let color = Color.black();
this.drawRealCircle(pivot, radius, 1, color, false, true, false);
this.batchLine(new Line(pivot.add(-radius), pivot.add(radius)), true);
this.batchLine(new Line(pivot.addVector(new Vector2(-radius, radius)), pivot.addVector(new Vector2(radius, -radius))), true);
this.drawRealCircle(Globals.pivot, radius, 1, color, false, true, false);
this.batchLine(new Line(Globals.pivot.add(-radius), Globals.pivot.add(radius)), true);
this.batchLine(new Line(Globals.pivot.addVector(new Vector2(-radius, radius)), Globals.pivot.addVector(new Vector2(radius, -radius))), true);
this.renderBatchedLines(1, color, false, true);
}
}
......
......@@ -32,7 +32,7 @@
// TODO PERFORMANCE calculate center is calculated on every mouse update. maybe save somewhere?
let rotationCenter;
if (Preferences.usePivot)
rotationCenter = pivot;
rotationCenter = Globals.pivot;
else
rotationCenter = Utilities.calculateCenterOfMass(Application.currentView.selection.data.getAllPositions());
......
......@@ -36,7 +36,7 @@
// TODO PERFORMANCE calculate center is calculated on every mouse update. maybe save somewhere?
let center;
if (Preferences.usePivot)
center = pivot;
center = Globals.pivot;
else
center = Utilities.calculateBBCenter(Application.currentView.selection.data.getAllPositions());
......
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