Addressed CR of 9684

This commit is contained in:
Menithal 2017-03-02 21:39:56 +02:00
parent d9f86612de
commit 9c31f66b75
4 changed files with 9 additions and 5 deletions

View file

@ -56,6 +56,7 @@ selectionManager.addEventListener(function () {
lightOverlayManager.updatePositions(); lightOverlayManager.updatePositions();
}); });
const KEY_P = 80; //Key code for letter p used for Parenting hotkey.
var DEGREES_TO_RADIANS = Math.PI / 180.0; var DEGREES_TO_RADIANS = Math.PI / 180.0;
var RADIANS_TO_DEGREES = 180.0 / Math.PI; var RADIANS_TO_DEGREES = 180.0 / Math.PI;
var epsilon = 0.001; var epsilon = 0.001;
@ -1406,7 +1407,7 @@ var keyReleaseEvent = function (event) {
}); });
grid.setPosition(newPosition); grid.setPosition(newPosition);
} }
} else if (event.key === 80 && event.isControl && !event.isAutoRepeat ) { } else if (event.key === KEY_P && event.isControl && !event.isAutoRepeat ) {
if (event.isShifted) { if (event.isShifted) {
unparentSelectedEntities(); unparentSelectedEntities();
} else { } else {

View file

@ -19,6 +19,7 @@ const VISIBLE_GLYPH = "";
const TRANSPARENCY_GLYPH = ""; const TRANSPARENCY_GLYPH = "";
const SCRIPT_GLYPH = "k"; const SCRIPT_GLYPH = "k";
const DELETE = 46; // Key code for the delete key. const DELETE = 46; // Key code for the delete key.
const KEY_P = 80; // Key code for letter p used for Parenting hotkey.
const MAX_ITEMS = Number.MAX_VALUE; // Used to set the max length of the list of discovered entities. const MAX_ITEMS = Number.MAX_VALUE; // Used to set the max length of the list of discovered entities.
debugPrint = function (message) { debugPrint = function (message) {
@ -292,7 +293,7 @@ function loaded() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'delete' })); EventBridge.emitWebEvent(JSON.stringify({ type: 'delete' }));
refreshEntities(); refreshEntities();
} }
if (keyDownEvent.keyCode === 80 && keyDownEvent.ctrlKey) { if (keyDownEvent.keyCode === KEY_P && keyDownEvent.ctrlKey) {
if (keyDownEvent.shiftKey) { if (keyDownEvent.shiftKey) {
EventBridge.emitWebEvent(JSON.stringify({ type: 'unparent' })); EventBridge.emitWebEvent(JSON.stringify({ type: 'unparent' }));
} else { } else {

View file

@ -24,7 +24,7 @@ var ICON_FOR_TYPE = {
} }
var EDITOR_TIMEOUT_DURATION = 1500; var EDITOR_TIMEOUT_DURATION = 1500;
const KEY_P = 80; //Key code for letter p used for Parenting hotkey.
var colorPickers = []; var colorPickers = [];
var lastEntityID = null; var lastEntityID = null;
debugPrint = function(message) { debugPrint = function(message) {
@ -1442,7 +1442,7 @@ function loaded() {
}); });
document.addEventListener("keydown", function (keyDown) { document.addEventListener("keydown", function (keyDown) {
if (keyDown.keyCode === 80 && keyDown.ctrlKey) { if (keyDown.keyCode === KEY_P && keyDown.ctrlKey) {
if (keyDown.shiftKey) { if (keyDown.shiftKey) {
EventBridge.emitWebEvent(JSON.stringify({ type: 'unparent' })); EventBridge.emitWebEvent(JSON.stringify({ type: 'unparent' }));
} else { } else {

View file

@ -6,6 +6,8 @@
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
const KEY_P = 80; //Key code for letter p used for Parenting hotkey.
function loaded() { function loaded() {
openEventBridge(function() { openEventBridge(function() {
elPosY = document.getElementById("horiz-y"); elPosY = document.getElementById("horiz-y");
@ -132,7 +134,7 @@ function loaded() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'init' })); EventBridge.emitWebEvent(JSON.stringify({ type: 'init' }));
}); });
document.addEventListener("keydown", function (keyDown) { document.addEventListener("keydown", function (keyDown) {
if (keyDown.keyCode === 80 && keyDown.ctrlKey) { if (keyDown.keyCode === KEY_P && keyDown.ctrlKey) {
if (keyDown.shiftKey) { if (keyDown.shiftKey) {
EventBridge.emitWebEvent(JSON.stringify({ type: 'unparent' })); EventBridge.emitWebEvent(JSON.stringify({ type: 'unparent' }));
} else { } else {