mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 22:51:20 +02:00
fix align to selection to grid
This commit is contained in:
parent
6e3bede7d0
commit
acae4df3c3
2 changed files with 11 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) {
|
||||||
|
@ -263,6 +269,8 @@ GridTool = function(opts) {
|
||||||
print("gridTool.js: Error parsing JSON: " + e.name + " data " + data);
|
print("gridTool.js: Error parsing JSON: " + e.name + " data " + data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print("DBACKTEST webEventReceived " + data.type);
|
||||||
|
|
||||||
if (data.type == "init") {
|
if (data.type == "init") {
|
||||||
horizontalGrid.emitUpdate();
|
horizontalGrid.emitUpdate();
|
||||||
|
@ -272,6 +280,7 @@ GridTool = function(opts) {
|
||||||
listeners[i] && listeners[i](data);
|
listeners[i] && listeners[i](data);
|
||||||
}
|
}
|
||||||
} else if (data.type == "action") {
|
} else if (data.type == "action") {
|
||||||
|
print("DBACKTEST webEventReceived action " + data.action);
|
||||||
var action = data.action;
|
var action = data.action;
|
||||||
if (action == "moveToAvatar") {
|
if (action == "moveToAvatar") {
|
||||||
var position = MyAvatar.getJointPosition("LeftFoot");
|
var position = MyAvatar.getJointPosition("LeftFoot");
|
||||||
|
@ -280,9 +289,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