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.
This commit is contained in:
Tim Young 2024-05-16 12:13:41 -06:00
parent 3e902cba95
commit 0e9a6d1a15

View File

@ -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;
}