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");
if (!CheckForActions(evt, "mouseover")) {
//We did not find anything
if (JSON.stringify(findHighlightsNamed("mouseover")) === JSON.stringify(oldRect)) {
if (oldRect == null) {
}
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;
}
if (ui_HadHighlight) { needrefresh = true; }
@ -716,7 +716,7 @@ function registerHighlightShape(shapeText, shapePoints, shapeColor, shapeName, o
function removeHighlightsNamed(shapeName) {
//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) { }
else {
//console.log("Comparing " + shapeName + " in " + JSON.stringify(ui_HighlightArray[index]));
@ -729,9 +729,12 @@ function removeHighlightsNamed(shapeName) {
}
function findHighlightsNamed(shapeName) {
for (var index = ui_HighlightArray.length; index < 0; index--) {
if (ui_HighlightArray[index].shapeName == shapeName)
return ui_HighlightArray[index];
for (var index = ui_HighlightArray.length; index >= 0; index--) {
if (ui_HighlightArray[index] == null) { }
else {
if (ui_HighlightArray[index].shapeName == shapeName)
return ui_HighlightArray[index];
}
}
return null; //null if not there
}