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:
Alezia Kurdis 2020-12-01 00:13:26 -05:00 committed by GitHub
parent 1f20536574
commit 6a31c19747
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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