From 0e9a6d1a1531dc0208955a735a1ec658784a8f8d Mon Sep 17 00:00:00 2001 From: Tim Young Date: Thu, 16 May 2024 12:13:41 -0600 Subject: [PATCH] Fixed a bug where clicking on a line would change how things were viewed. It turned out to be a rather bizarre bug based off of !== null not working properly. --- Web/ui.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Web/ui.js b/Web/ui.js index 55f889a..a7a4c31 100644 --- a/Web/ui.js +++ b/Web/ui.js @@ -228,9 +228,10 @@ function CheckForActions(actionPoint, action) { var checkit = false; var inside = false; for (var index = 0; index < uiActions.length; index++) { - if (action == "leftclick" && uiActions[index].funcLeftClick !== null) checkit = true; - if (action == "rightclick" && uiActions[index].funcRightClick !== null) checkit = true; - if (action == "mouseover" && uiActions[index].funcMouseover !== null) checkit = true; + checkit = true; + if (action == "leftclick" && uiActions[index].funcLeftClick == null) checkit = false; + if (action == "rightclick" && uiActions[index].funcRightClick == null) checkit = false; + if (action == "mouseover" && uiActions[index].funcMouseover == null) checkit = false; checklocation = uiActions[index]; var point = newPointFromPair(actionPoint.pageX - checklocation.shapePoints.offsetx, actionPoint.pageY - checklocation.shapePoints.offsety); if (checkit) { @@ -258,14 +259,16 @@ function CheckForActions(actionPoint, action) { //console.log("Is inside"); switch (action) { case "leftclick": - if (checklocation.funcLeftClick != null) { + if (checklocation.funcLeftClick == null) { } + else { checklocation.funcLeftClick(actionPoint, checklocation); - //console.log("Successfully did a UI action"); + //console.log("Successfully did a left-click UI action"); return true; } break; case "mouseover": - if (checklocation.funcMouseover != null) { + if (checklocation.funcMouseover == null) { } + else { checklocation.funcMouseover(actionPoint, checklocation); //console.log("Successfully did a UI action"); return true; @@ -677,6 +680,7 @@ function actionStruct(shapeText, shapePoints, theObject=null, funcLeftClick=null funcRightClick: funcRightClick, funcMouseover: funcMouseover, } + //if (shapeText == "line") console.log("Creating a line: " + JSON.stringify(struct)); shapePoints.shapeText = shapeText; return struct; }