Fixed not clearing the old highlights when we moused-off something.

This commit is contained in:
Tim Young 2024-05-10 11:23:10 -06:00
parent 7b57cbe97a
commit f3ed276ca9

View File

@ -377,11 +377,11 @@ function handleMouseMove(evt)
removeHighlightsNamed("mouseover"); removeHighlightsNamed("mouseover");
if (!CheckForActions(evt, "mouseover")) { if (!CheckForActions(evt, "mouseover")) {
//We did not find anything //We did not find anything
if (JSON.stringify(findHighlightsNamed("mouseover")) === JSON.stringify(oldRect)) { if (oldRect == null) {
} }
else { else {
//console.log("Rects are not equal:" + JSON.stringify(ui_highlightRect) + " - " + JSON.stringify(oldRect) ) //We used to have a highlight, but it was removed
needrefresh = true; needrefresh = true;
} }
if (ui_HadHighlight) { needrefresh = true; } if (ui_HadHighlight) { needrefresh = true; }
@ -716,7 +716,7 @@ function registerHighlightShape(shapeText, shapePoints, shapeColor, shapeName, o
function removeHighlightsNamed(shapeName) { function removeHighlightsNamed(shapeName) {
//console.log("Trying to remove " + shapeName + " in array of " + ui_HighlightArray.length); //console.log("Trying to remove " + shapeName + " in array of " + ui_HighlightArray.length);
for (var index = ui_HighlightArray.length; index > 0; index--) { for (var index = ui_HighlightArray.length; index >= 0; index--) {
if (ui_HighlightArray[index] == null) { } if (ui_HighlightArray[index] == null) { }
else { else {
//console.log("Comparing " + shapeName + " in " + JSON.stringify(ui_HighlightArray[index])); //console.log("Comparing " + shapeName + " in " + JSON.stringify(ui_HighlightArray[index]));
@ -729,10 +729,13 @@ function removeHighlightsNamed(shapeName) {
} }
function findHighlightsNamed(shapeName) { function findHighlightsNamed(shapeName) {
for (var index = ui_HighlightArray.length; index < 0; index--) { for (var index = ui_HighlightArray.length; index >= 0; index--) {
if (ui_HighlightArray[index] == null) { }
else {
if (ui_HighlightArray[index].shapeName == shapeName) if (ui_HighlightArray[index].shapeName == shapeName)
return ui_HighlightArray[index]; return ui_HighlightArray[index];
} }
}
return null; //null if not there return null; //null if not there
} }