mirror of
https://github.com/lubosz/overte.git
synced 2025-04-12 09:42:28 +02:00
Merge pull request #13608 from dback2/alignSelectionToGridFix
Fix aligning selection to grid
This commit is contained in:
commit
c225c3deca
2 changed files with 8 additions and 10 deletions
scripts/system
|
@ -1853,13 +1853,7 @@ var keyReleaseEvent = function (event) {
|
|||
}
|
||||
} else if (event.text === 'g') {
|
||||
if (isActive && selectionManager.hasSelection()) {
|
||||
var newPosition = selectionManager.worldPosition;
|
||||
newPosition = Vec3.subtract(newPosition, {
|
||||
x: 0,
|
||||
y: selectionManager.worldDimensions.y * 0.5,
|
||||
z: 0
|
||||
});
|
||||
grid.setPosition(newPosition);
|
||||
grid.moveToSelection();
|
||||
}
|
||||
} else if (event.key === KEY_P && event.isControl && !event.isAutoRepeat ) {
|
||||
if (event.isShifted) {
|
||||
|
|
|
@ -154,6 +154,12 @@ Grid = function(opts) {
|
|||
that.emitUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
that.moveToSelection = function() {
|
||||
var newPosition = SelectionManager.worldPosition;
|
||||
newPosition = Vec3.subtract(newPosition, { x: 0, y: SelectionManager.worldDimensions.y * 0.5, z: 0 });
|
||||
that.setPosition(newPosition);
|
||||
};
|
||||
|
||||
that.emitUpdate = function() {
|
||||
if (that.onUpdate) {
|
||||
|
@ -280,9 +286,7 @@ GridTool = function(opts) {
|
|||
}
|
||||
horizontalGrid.setPosition(position);
|
||||
} else if (action == "moveToSelection") {
|
||||
var newPosition = selectionManager.worldPosition;
|
||||
newPosition = Vec3.subtract(newPosition, { x: 0, y: selectionManager.worldDimensions.y * 0.5, z: 0 });
|
||||
grid.setPosition(newPosition);
|
||||
horizontalGrid.moveToSelection();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue