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);