mirror of
https://github.com/overte-org/overte.git
synced 2025-07-13 16:38:52 +02:00
Add Grid Actions Shortkeys
Add Grid Actions Shortkeys Toggle Grid G Activate/Deactivate Snap to Grid H Align Grid to Selected Entities J Align Grid to Avatar K
This commit is contained in:
parent
64caa54d08
commit
1f20536574
1 changed files with 32 additions and 7 deletions
|
@ -2044,10 +2044,23 @@ function focusKey(value) {
|
||||||
}
|
}
|
||||||
function gridKey(value) {
|
function gridKey(value) {
|
||||||
if (value === 0) { // on release
|
if (value === 0) { // on release
|
||||||
if (selectionManager.hasSelection()) {
|
alignGridToSelection();
|
||||||
grid.moveToSelection();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function viewGridKey(value) {
|
||||||
|
if (value === 0) { // on release
|
||||||
|
toggleGridVisibility();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function snapKey(value) {
|
||||||
|
if (value === 0) { // on release
|
||||||
|
entityListTool.toggleSnapToGrid();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function gridToAvatarKey(value) {
|
||||||
|
if (value === 0) { // on release
|
||||||
|
alignGridToAvatar();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function recursiveAdd(newParentID, parentData) {
|
function recursiveAdd(newParentID, parentData) {
|
||||||
if (parentData.children !== undefined) {
|
if (parentData.children !== undefined) {
|
||||||
|
@ -2446,7 +2459,6 @@ var PropertiesTool = function (opts) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (data.onlyUpdateEntities) {
|
if (data.onlyUpdateEntities) {
|
||||||
blockPropertyUpdates = true;
|
blockPropertyUpdates = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2455,6 +2467,10 @@ var PropertiesTool = function (opts) {
|
||||||
}
|
}
|
||||||
selectionManager._update(false, this);
|
selectionManager._update(false, this);
|
||||||
blockPropertyUpdates = false;
|
blockPropertyUpdates = false;
|
||||||
|
|
||||||
|
if (data.snapToGrid !== undefined) {
|
||||||
|
entityListTool.setListMenuSnapToGrid(data.snapToGrid);
|
||||||
|
}
|
||||||
} else if (data.type === 'saveUserData' || data.type === 'saveMaterialData') {
|
} else if (data.type === 'saveUserData' || data.type === 'saveMaterialData') {
|
||||||
data.ids.forEach(function(entityID) {
|
data.ids.forEach(function(entityID) {
|
||||||
Entities.editEntity(entityID, data.properties);
|
Entities.editEntity(entityID, data.properties);
|
||||||
|
@ -2809,7 +2825,10 @@ if (isOnMacPlatform) {
|
||||||
}
|
}
|
||||||
mapping.from([Controller.Hardware.Keyboard.T]).to(toggleKey);
|
mapping.from([Controller.Hardware.Keyboard.T]).to(toggleKey);
|
||||||
mapping.from([Controller.Hardware.Keyboard.F]).to(focusKey);
|
mapping.from([Controller.Hardware.Keyboard.F]).to(focusKey);
|
||||||
mapping.from([Controller.Hardware.Keyboard.G]).to(gridKey);
|
mapping.from([Controller.Hardware.Keyboard.J]).to(gridKey);
|
||||||
|
mapping.from([Controller.Hardware.Keyboard.G]).to(viewGridKey);
|
||||||
|
mapping.from([Controller.Hardware.Keyboard.H]).to(snapKey);
|
||||||
|
mapping.from([Controller.Hardware.Keyboard.K]).to(gridToAvatarKey);
|
||||||
mapping.from([Controller.Hardware.Keyboard.X])
|
mapping.from([Controller.Hardware.Keyboard.X])
|
||||||
.when([Controller.Hardware.Keyboard.Control])
|
.when([Controller.Hardware.Keyboard.Control])
|
||||||
.to(whenReleased(function() { selectionManager.cutSelectedEntities() }));
|
.to(whenReleased(function() { selectionManager.cutSelectedEntities() }));
|
||||||
|
@ -2850,8 +2869,14 @@ keyUpEventFromUIWindow = function(keyUpEvent) {
|
||||||
toggleKey(pressedValue);
|
toggleKey(pressedValue);
|
||||||
} else if (keyUpEvent.keyCodeString === "F") {
|
} else if (keyUpEvent.keyCodeString === "F") {
|
||||||
focusKey(pressedValue);
|
focusKey(pressedValue);
|
||||||
} else if (keyUpEvent.keyCodeString === "G") {
|
} else if (keyUpEvent.keyCodeString === "J") {
|
||||||
gridKey(pressedValue);
|
gridKey(pressedValue);
|
||||||
|
} else if (keyUpEvent.keyCodeString === "G") {
|
||||||
|
viewGridKey(pressedValue);
|
||||||
|
} else if (keyUpEvent.keyCodeString === "H") {
|
||||||
|
snapKey(pressedValue);
|
||||||
|
} else if (keyUpEvent.keyCodeString === "K") {
|
||||||
|
gridToAvatarKey(pressedValue);
|
||||||
} else if (keyUpEvent.controlKey && keyUpEvent.keyCodeString === "X") {
|
} else if (keyUpEvent.controlKey && keyUpEvent.keyCodeString === "X") {
|
||||||
selectionManager.cutSelectedEntities();
|
selectionManager.cutSelectedEntities();
|
||||||
} else if (keyUpEvent.controlKey && keyUpEvent.keyCodeString === "C") {
|
} else if (keyUpEvent.controlKey && keyUpEvent.keyCodeString === "C") {
|
||||||
|
|
Loading…
Reference in a new issue