From 6a31c19747c1f8a8d6fc8b4a783f02ca09812dae Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Tue, 1 Dec 2020 00:13:26 -0500 Subject: [PATCH] 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 --- .../system/create/entityList/entityList.js | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/scripts/system/create/entityList/entityList.js b/scripts/system/create/entityList/entityList.js index 8ca62e780f..a4d4decedb 100644 --- a/scripts/system/create/entityList/entityList.js +++ b/scripts/system/create/entityList/entityList.js @@ -146,6 +146,20 @@ EntityListTool = function(shouldUseEditTabletApp) { }); }; + that.setListMenuSnapToGrid = function (isSnapToGrid) { + emitJSONScriptEvent({ "type": "setSnapToGrid", "snap": isSnapToGrid }); + }; + + that.toggleSnapToGrid = function () { + if (!grid.getSnapToGrid()) { + grid.setSnapToGrid(true); + emitJSONScriptEvent({ "type": "setSnapToGrid", "snap": true }); + } else { + grid.setSnapToGrid(false); + emitJSONScriptEvent({ "type": "setSnapToGrid", "snap": false }); + } + }; + function valueIfDefined(value) { return value !== undefined ? value : ""; } @@ -394,16 +408,9 @@ EntityListTool = function(shouldUseEditTabletApp) { } else if (data.type === 'toggleGridVisibility') { toggleGridVisibility(); } else if (data.type === 'toggleSnapToGrid') { - if (!grid.getSnapToGrid()) { - grid.setSnapToGrid(true); - emitJSONScriptEvent({ "type": "setSnapToGrid", "snap": true }); - } else { - grid.setSnapToGrid(false); - emitJSONScriptEvent({ "type": "setSnapToGrid", "snap": false }); - } + that.toggleSnapToGrid(); } - }; webView.webEventReceived.connect(onWebEventReceived);