From 10dc75af5db9fa345034d88b60986b119b157e35 Mon Sep 17 00:00:00 2001 From: armored-dragon Date: Tue, 27 Aug 2024 15:24:18 -0500 Subject: [PATCH 1/6] Listen for click instead of release. --- scripts/system/create/edit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/create/edit.js b/scripts/system/create/edit.js index be1ba053ab..8808f3792e 100644 --- a/scripts/system/create/edit.js +++ b/scripts/system/create/edit.js @@ -2140,7 +2140,7 @@ Controller.keyPressEvent.connect(keyPressEvent); function deleteKey(value) { - if (value === 0) { // on release + if (value === 1) { // on release createApp.deleteSelectedEntities(); } } From 1ab2a7e1e3d1cf8ec90c73844f947c7aae3c1242 Mon Sep 17 00:00:00 2001 From: armored-dragon Date: Tue, 27 Aug 2024 16:10:46 -0500 Subject: [PATCH 2/6] Reverted initial commit. Implemented hack to listen for menu click events. --- scripts/system/create/edit.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/scripts/system/create/edit.js b/scripts/system/create/edit.js index 8808f3792e..5889eab967 100644 --- a/scripts/system/create/edit.js +++ b/scripts/system/create/edit.js @@ -2130,6 +2130,24 @@ if (isActive) { cameraManager.keyPressEvent(event); } + + // Hacks to get the menu bar buttons to work + // Copy + if (event.key === 67 && event.isControl && !event.isShifted) { + selectionManager.copySelectedEntities(); + } + // Paste + if (event.key === 86 && event.isControl && !event.isShifted) { + selectionManager.pasteEntities(); + } + // Cut + if (event.key === 88 && event.isControl && !event.isShifted) { + selectionManager.cutSelectedEntities(); + } + // Delete + if (event.key === 16777223 && !event.isControl && !event.isShifted) { + createApp.deleteSelectedEntities(); + } }; var keyReleaseEvent = function (event) { if (isActive) { @@ -2140,7 +2158,12 @@ Controller.keyPressEvent.connect(keyPressEvent); function deleteKey(value) { - if (value === 1) { // on release + if (value === 0) { // on press + createApp.deleteSelectedEntities(); + } + } + function copyKey(value){ + if (value === 1) { // on press createApp.deleteSelectedEntities(); } } From 7fc7f5e617763dbfaca7926bf5d022ce6fbf0391 Mon Sep 17 00:00:00 2001 From: armored-dragon Date: Tue, 27 Aug 2024 16:13:12 -0500 Subject: [PATCH 3/6] Missed some reverts. --- scripts/system/create/edit.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/system/create/edit.js b/scripts/system/create/edit.js index 5889eab967..ac929ee895 100644 --- a/scripts/system/create/edit.js +++ b/scripts/system/create/edit.js @@ -2130,7 +2130,7 @@ if (isActive) { cameraManager.keyPressEvent(event); } - + // Hacks to get the menu bar buttons to work // Copy if (event.key === 67 && event.isControl && !event.isShifted) { @@ -2158,12 +2158,12 @@ Controller.keyPressEvent.connect(keyPressEvent); function deleteKey(value) { - if (value === 0) { // on press + if (value === 0) { // on release createApp.deleteSelectedEntities(); } } function copyKey(value){ - if (value === 1) { // on press + if (value === 0) { // on release createApp.deleteSelectedEntities(); } } From edb08572f5fb4511ba9b4509fe7838920a9645a4 Mon Sep 17 00:00:00 2001 From: armored-dragon Date: Tue, 27 Aug 2024 16:14:02 -0500 Subject: [PATCH 4/6] Missed another one. --- scripts/system/create/edit.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/system/create/edit.js b/scripts/system/create/edit.js index ac929ee895..148e1efba1 100644 --- a/scripts/system/create/edit.js +++ b/scripts/system/create/edit.js @@ -2162,11 +2162,6 @@ createApp.deleteSelectedEntities(); } } - function copyKey(value){ - if (value === 0) { // on release - createApp.deleteSelectedEntities(); - } - } function deselectKey(value) { if (value === 0) { // on release selectionManager.clearSelections(this); From cf3afa8855843aacc2ab7842c87a12ee66ec996f Mon Sep 17 00:00:00 2001 From: armored-dragon Date: Mon, 2 Sep 2024 12:29:44 -0500 Subject: [PATCH 5/6] Prevent duplicate actions. --- scripts/system/create/edit.js | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/scripts/system/create/edit.js b/scripts/system/create/edit.js index 148e1efba1..c9f167e54b 100644 --- a/scripts/system/create/edit.js +++ b/scripts/system/create/edit.js @@ -2157,11 +2157,6 @@ Controller.keyReleaseEvent.connect(keyReleaseEvent); Controller.keyPressEvent.connect(keyPressEvent); - function deleteKey(value) { - if (value === 0) { // on release - createApp.deleteSelectedEntities(); - } - } function deselectKey(value) { if (value === 0) { // on release selectionManager.clearSelections(this); @@ -3123,11 +3118,6 @@ var isOnMacPlatform = Controller.getValue(Controller.Hardware.Application.PlatformMac); var mapping = Controller.newMapping(CONTROLLER_MAPPING_NAME); - if (isOnMacPlatform) { - mapping.from([Controller.Hardware.Keyboard.Backspace]).to(deleteKey); - } else { - mapping.from([Controller.Hardware.Keyboard.Delete]).to(deleteKey); - } mapping.from([Controller.Hardware.Keyboard.T]).to(toggleKey); mapping.from([Controller.Hardware.Keyboard.F]).to(focusKey); mapping.from([Controller.Hardware.Keyboard.J]).to(gridKey); @@ -3138,15 +3128,9 @@ mapping.from([Controller.Hardware.Keyboard["7"]]).to(quickRotate90xKey); mapping.from([Controller.Hardware.Keyboard["8"]]).to(quickRotate90yKey); mapping.from([Controller.Hardware.Keyboard["9"]]).to(quickRotate90zKey); - mapping.from([Controller.Hardware.Keyboard.X]) - .when([Controller.Hardware.Keyboard.Control]) - .to(whenReleased(function() { selectionManager.cutSelectedEntities() })); mapping.from([Controller.Hardware.Keyboard.C]) .when([Controller.Hardware.Keyboard.Control]) .to(whenReleased(function() { selectionManager.copySelectedEntities() })); - mapping.from([Controller.Hardware.Keyboard.V]) - .when([Controller.Hardware.Keyboard.Control]) - .to(whenReleased(function() { selectionManager.pasteEntities() })); mapping.from([Controller.Hardware.Keyboard.D]) .when([Controller.Hardware.Keyboard.Control]) .to(whenReleased(function() { selectionManager.duplicateSelection() })); @@ -3170,10 +3154,8 @@ var pressedValue = 0.0; - if ((!isOnMacPlatform && keyUpEvent.keyCodeString === "Delete") - || (isOnMacPlatform && keyUpEvent.keyCodeString === "Backspace")) { - - deleteKey(pressedValue); + if (isOnMacPlatform && keyUpEvent.keyCodeString === "Backspace") { + createApp.deleteSelectedEntities(); } else if (keyUpEvent.keyCodeString === "T") { toggleKey(pressedValue); } else if (keyUpEvent.keyCodeString === "F") { @@ -3194,12 +3176,8 @@ quickRotate90yKey(pressedValue); } else if (keyUpEvent.keyCodeString === "9") { quickRotate90zKey(pressedValue); - } else if (keyUpEvent.controlKey && keyUpEvent.keyCodeString === "X") { - selectionManager.cutSelectedEntities(); } else if (keyUpEvent.controlKey && keyUpEvent.keyCodeString === "C") { selectionManager.copySelectedEntities(); - } else if (keyUpEvent.controlKey && keyUpEvent.keyCodeString === "V") { - selectionManager.pasteEntities(); } else if (keyUpEvent.controlKey && keyUpEvent.keyCodeString === "D") { selectionManager.duplicateSelection(); } else if (!isOnMacPlatform && keyUpEvent.controlKey && !keyUpEvent.shiftKey && keyUpEvent.keyCodeString === "Z") { From 1ede7ed3e9ee72be055cd93b6ec57c3f247de08c Mon Sep 17 00:00:00 2001 From: armored-dragon Date: Mon, 30 Sep 2024 08:02:44 -0500 Subject: [PATCH 6/6] Replaced key value with key text. Added additional comment about the specific delete key used. --- scripts/system/create/edit.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/system/create/edit.js b/scripts/system/create/edit.js index c9f167e54b..624886e454 100644 --- a/scripts/system/create/edit.js +++ b/scripts/system/create/edit.js @@ -2133,19 +2133,19 @@ // Hacks to get the menu bar buttons to work // Copy - if (event.key === 67 && event.isControl && !event.isShifted) { + if (event.text.toLowerCase() === "c" && event.isControl && !event.isShifted) { selectionManager.copySelectedEntities(); } // Paste - if (event.key === 86 && event.isControl && !event.isShifted) { + if (event.text.toLowerCase() === "v" && event.isControl && !event.isShifted) { selectionManager.pasteEntities(); } // Cut - if (event.key === 88 && event.isControl && !event.isShifted) { + if (event.text.toLowerCase() === "x" && event.isControl && !event.isShifted) { selectionManager.cutSelectedEntities(); } - // Delete - if (event.key === 16777223 && !event.isControl && !event.isShifted) { + // Delete - This uses the physical 'delete' key on a keyboard. + if (event.text.toLowerCase() === "delete" && !event.isControl && !event.isShifted) { createApp.deleteSelectedEntities(); } };