mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:29:01 +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
|
@ -1853,13 +1853,7 @@ var keyReleaseEvent = function (event) {
|
||||||
}
|
}
|
||||||
} else if (event.text === 'g') {
|
} else if (event.text === 'g') {
|
||||||
if (isActive && selectionManager.hasSelection()) {
|
if (isActive && selectionManager.hasSelection()) {
|
||||||
var newPosition = selectionManager.worldPosition;
|
grid.moveToSelection();
|
||||||
newPosition = Vec3.subtract(newPosition, {
|
|
||||||
x: 0,
|
|
||||||
y: selectionManager.worldDimensions.y * 0.5,
|
|
||||||
z: 0
|
|
||||||
});
|
|
||||||
grid.setPosition(newPosition);
|
|
||||||
}
|
}
|
||||||
} else if (event.key === KEY_P && event.isControl && !event.isAutoRepeat ) {
|
} else if (event.key === KEY_P && event.isControl && !event.isAutoRepeat ) {
|
||||||
if (event.isShifted) {
|
if (event.isShifted) {
|
||||||
|
|
|
@ -154,6 +154,12 @@ Grid = function(opts) {
|
||||||
that.emitUpdate();
|
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() {
|
that.emitUpdate = function() {
|
||||||
if (that.onUpdate) {
|
if (that.onUpdate) {
|
||||||
|
@ -280,9 +286,7 @@ GridTool = function(opts) {
|
||||||
}
|
}
|
||||||
horizontalGrid.setPosition(position);
|
horizontalGrid.setPosition(position);
|
||||||
} else if (action == "moveToSelection") {
|
} else if (action == "moveToSelection") {
|
||||||
var newPosition = selectionManager.worldPosition;
|
horizontalGrid.moveToSelection();
|
||||||
newPosition = Vec3.subtract(newPosition, { x: 0, y: selectionManager.worldDimensions.y * 0.5, z: 0 });
|
|
||||||
grid.setPosition(newPosition);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue