From 562da2f706e2a8869a2cf2614ca29bbaa7826d60 Mon Sep 17 00:00:00 2001
From: unknown
Date: Wed, 17 Apr 2024 19:18:01 +0200
Subject: [PATCH] Test fix for #335
---
CHANGELOG.txt | 3 ++-
app/js/keyboard.js | 22 ++++++++++++++++++++--
app/js/macros.js | 2 +-
3 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1ac9a83..ecaf062 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,6 +1,7 @@
v1.0.371:
- Updated Max Rate for LEAD1010 Plasma Add On profile
- - Added electron's app.setAppUserModelId(id) to clean up Windows notications
+ - Added electron's app.setAppUserModelId(id) to clean up Windows notications (to be tested)
+ - Fixed #353 - jog buttons no longer accidentally change override sliders if sliders was in focus
v1.0.371:
- Fixed Issue #257 Changed Arc drawing behavior for G2 full circles in 3D viewer
- Fixed Issue #285 Updated ACRO with Pen servo default Grbl profile PWM parameters
diff --git a/app/js/keyboard.js b/app/js/keyboard.js
index 5dfec6c..5b6f349 100644
--- a/app/js/keyboard.js
+++ b/app/js/keyboard.js
@@ -134,8 +134,26 @@ function bindKeys() {
if (e.shiftKey) {
newVal += 'shift+'
}
- newVal += e.key
- newVal = newVal.toLowerCase();
+ if (e.key.toLowerCase() != 'alt' && e.key.toLowerCase() != 'control' && e.key.toLowerCase() != 'shift') {
+ if (e.keyCode == 32) {
+ newVal += 'space';
+ } else if (e.key.toLowerCase() == 'escape') {
+ newVal += 'esc';
+ } else if (e.key.toLowerCase() == 'arrowleft') {
+ newVal += 'left';
+ } else if (e.key.toLowerCase() == 'arrowright') {
+ newVal += 'right';
+ } else if (e.key.toLowerCase() == 'arrowup') {
+ newVal += 'up';
+ } else if (e.key.toLowerCase() == 'arrowdown') {
+ newVal += 'down';
+ } else if (e.key.toLowerCase() == 'delete') {
+ newVal += 'del';
+ } else {
+ newVal += e.key.toLowerCase();
+ }
+ }
+
var macro = searchMacro("macrokeyboardshortcut", newVal, buttonsarray)
console.log(macro)
if (macro && macro.codetype == "gcode") {
diff --git a/app/js/macros.js b/app/js/macros.js
index 3a52a34..4c28735 100644
--- a/app/js/macros.js
+++ b/app/js/macros.js
@@ -462,7 +462,7 @@ function sortMacros(index, delta) {
// var index = array.indexOf(element);
var newIndex = index + delta;
if (newIndex < 0 || newIndex == buttonsarray.length) return; //Already at the top or bottom.
- var indexes = [index, newIndex].sort((a,b)=>a-b); //Sort the indixes
+ var indexes = [index, newIndex].sort((a, b) => a - b); //Sort the indixes
buttonsarray.splice(indexes[0], 2, buttonsarray[indexes[1]], buttonsarray[indexes[0]]); //Replace from lowest index, two elements, reverting the order
populateMacroButtons();
};