From 9c31f66b75b4ee5618d38378a128dbf1971ceda4 Mon Sep 17 00:00:00 2001 From: Menithal Date: Thu, 2 Mar 2017 21:39:56 +0200 Subject: [PATCH] Addressed CR of 9684 --- scripts/system/edit.js | 3 ++- scripts/system/html/js/entityList.js | 3 ++- scripts/system/html/js/entityProperties.js | 4 ++-- scripts/system/html/js/gridControls.js | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 7731edd622..16a49dbf41 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -56,6 +56,7 @@ selectionManager.addEventListener(function () { lightOverlayManager.updatePositions(); }); +const KEY_P = 80; //Key code for letter p used for Parenting hotkey. var DEGREES_TO_RADIANS = Math.PI / 180.0; var RADIANS_TO_DEGREES = 180.0 / Math.PI; var epsilon = 0.001; @@ -1406,7 +1407,7 @@ var keyReleaseEvent = function (event) { }); 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) { unparentSelectedEntities(); } else { diff --git a/scripts/system/html/js/entityList.js b/scripts/system/html/js/entityList.js index 53d2d9030b..914fc6525e 100644 --- a/scripts/system/html/js/entityList.js +++ b/scripts/system/html/js/entityList.js @@ -19,6 +19,7 @@ const VISIBLE_GLYPH = ""; const TRANSPARENCY_GLYPH = ""; const SCRIPT_GLYPH = "k"; 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. debugPrint = function (message) { @@ -292,7 +293,7 @@ function loaded() { EventBridge.emitWebEvent(JSON.stringify({ type: 'delete' })); refreshEntities(); } - if (keyDownEvent.keyCode === 80 && keyDownEvent.ctrlKey) { + if (keyDownEvent.keyCode === KEY_P && keyDownEvent.ctrlKey) { if (keyDownEvent.shiftKey) { EventBridge.emitWebEvent(JSON.stringify({ type: 'unparent' })); } else { diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index ab8a3f7c85..c51293f4bc 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -24,7 +24,7 @@ var ICON_FOR_TYPE = { } var EDITOR_TIMEOUT_DURATION = 1500; - +const KEY_P = 80; //Key code for letter p used for Parenting hotkey. var colorPickers = []; var lastEntityID = null; debugPrint = function(message) { @@ -1442,7 +1442,7 @@ function loaded() { }); document.addEventListener("keydown", function (keyDown) { - if (keyDown.keyCode === 80 && keyDown.ctrlKey) { + if (keyDown.keyCode === KEY_P && keyDown.ctrlKey) { if (keyDown.shiftKey) { EventBridge.emitWebEvent(JSON.stringify({ type: 'unparent' })); } else { diff --git a/scripts/system/html/js/gridControls.js b/scripts/system/html/js/gridControls.js index 75052414ee..be4271788e 100644 --- a/scripts/system/html/js/gridControls.js +++ b/scripts/system/html/js/gridControls.js @@ -6,6 +6,8 @@ // Distributed under the Apache License, Version 2.0. // 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() { openEventBridge(function() { elPosY = document.getElementById("horiz-y"); @@ -132,7 +134,7 @@ function loaded() { EventBridge.emitWebEvent(JSON.stringify({ type: 'init' })); }); document.addEventListener("keydown", function (keyDown) { - if (keyDown.keyCode === 80 && keyDown.ctrlKey) { + if (keyDown.keyCode === KEY_P && keyDown.ctrlKey) { if (keyDown.shiftKey) { EventBridge.emitWebEvent(JSON.stringify({ type: 'unparent' })); } else {