From 18d4db0c526451bb73af5f9306192dee66a30430 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Fri, 22 Apr 2022 18:03:54 -0500 Subject: [PATCH] Fix tab order for the three point quadratic and four point cubic tools. There was an indexing error in the logic of the tab focus handler of the selection tool that results in the last defining point of an object that has three or more defining points not working correctly. To see the issue, graph any object and then graph a quadratic or cubic after that. Immediately after completing the graph of the quadratic or cubic hit shift-tab. With the code in the release candidate branch the focus will jump back to the last point on first object that was graphed. With this pull request the focus will go to the next to last point on the quadratic or cubic as it should. --- htdocs/js/apps/GraphTool/graphtool.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/js/apps/GraphTool/graphtool.js b/htdocs/js/apps/GraphTool/graphtool.js index 0885a92bf2..2a52364559 100644 --- a/htdocs/js/apps/GraphTool/graphtool.js +++ b/htdocs/js/apps/GraphTool/graphtool.js @@ -1174,7 +1174,8 @@ window.graphTool = (containerId, options) => { if (e.key !== 'Tab' || (index === 0 && e.shiftKey) || (index === gt.graphedObjs.length - 1 && !e.shiftKey) || - (a.length > 1 && ((pIndex === 0 && !e.shiftKey) || (pIndex === 1 && e.shiftKey))) + (a.length > 1 && + ((pIndex === 0 && !e.shiftKey) || (pIndex === a.length - 1 && e.shiftKey))) ) return; @@ -1194,8 +1195,8 @@ window.graphTool = (containerId, options) => { obj.blur(); }; + point.rendNode.addEventListener('keydown', point.focusOutHandler); } - point.rendNode.addEventListener('keydown', point.focusOutHandler); // Attach a focusin handler to all points to update the coordinates display. point.focusInHandler = (e) => gt.setTextCoords(point.X(), point.Y());