a90b29ffd9e8db10f6e15aca0f74497772ad8c3c chmalee Mon Jan 22 16:06:30 2024 -0800 Delete old debug code that was unused and fix typo from not properly deleting the debuggin code, refs #32697 diff --git src/hg/js/utils.js src/hg/js/utils.js index d47aece..4ab45ee 100644 --- src/hg/js/utils.js +++ src/hg/js/utils.js @@ -3927,34 +3927,30 @@ let mouseoverTimer; // the timer for when a user is moving the mouse after already bringing up // a pop up, there may be many items close together and we want the user // to bring up those mouseovers let mousemoveTimer; // flags to help figure out what state the users mouse is in: // hovered an item, moving to new item, moving to popup, moving away from popup/item let mousedNewItem = false; let canShowNewMouseover = true; // signal handler for when mousemove has gone far enough away from the pop up // we can't use removeEventListener because the function call is hard to keep // track of because of a bounded this keyword let mousemoveController; // The div that moves around the users screen with the visible mouseover text let mouseoverContainer; -// save the last moused over ele to show when the mouse has stopped moving -let newTooltipElement; -// the last time the mouse moved -//let lastTime = 0; function tooltipIsVisible() { /* Is the tooltip visible on the screen right now? */ return mouseoverContainer.style.visibility !== "hidden"; } function hideMouseoverText(ele) { /* Actually hides the tooltip text */ let tooltipTarget = ele; tooltipTarget.classList.remove("isShown"); tooltipTarget.style.opacity = "0"; tooltipTarget.style.visibility = "hidden"; } function mouseIsOverPopup(ev, ele, fudgeFactor=25) { @@ -3974,31 +3970,31 @@ let origName = ele.getAttribute("origItemMouseoverId"); let origTargetBox = boundingRect($("[mouseoverid='"+origName+"']")[0]); let mouseX = ev.clientX; let mouseY = ev.clientY; if ( (mouseX >= (origTargetBox.left - fudgeFactor) && mouseX <= (origTargetBox.right + fudgeFactor) && mouseY >= (origTargetBox.top - fudgeFactor) && mouseY <= (origTargetBox.bottom + fudgeFactor)) ) { return true; } return false; } function mousemoveTimerHelper(triggeringMouseMoveEv, currTooltip) { /* Called after 100ms of the mouse being stationary, show a new tooltip * if we are over a new mouseover element */ e = triggeringMouseMoveEv; - if (mousedNewItem && !(mouseIsOverPopup(e, currTooltip, 0) || mouseIsOverItem(e, currTooltip, 0))) { + if (mousedNewItem) { mousemoveController.abort(); hideMouseoverText(currTooltip); showMouseoverText(triggeringMouseMoveEv); } } function mousemoveHelper(e) { /* Helper function for deciding whether to keep a tooltip visible upon a mousemove event */ if (mousemoveTimer) { clearTimeout(mousemoveTimer); } mousemoveTimer = setTimeout(mousemoveTimerHelper, 100, e, this); // we are moving the mouse away, hide the tooltip regardless how much time has passed if (!(mouseIsOverPopup(e, this) || mouseIsOverItem(e, this))) { mousemoveController.abort(); @@ -4042,32 +4038,30 @@ mouseoverContainer.style.visibility = "visible"; mouseoverContainer.setAttribute("origItemMouseoverId", referenceElement.getAttribute("mouseoverid")); // Events all get their own unique id but they are tough to keep track of if we // want to remove one. We can use the AbortController interface to let the // web browser automatically raise a signal when the event is fired and remove // appropriate event mousemoveController = new AbortController(); let callback = mousemoveHelper.bind(mouseoverContainer); mousedNewItem = false; clearTimeout(mouseoverTimer); mouseoverTimer = undefined; // allow the user to mouse over the mouse over, (eg. clicking a link or selecting text) document.addEventListener("mousemove", callback, {signal: mousemoveController.signal}); document.addEventListener("scroll", callback, {signal: mousemoveController.signal}); - } else { - newTooltipElement = referenceElement; } } function showMouseover(e) { /* Helper function for showing a mouseover. Uses a timeout function to allow * user to not immediately see all available tooltips. */ e.preventDefault(); // if a tooltip is currently visible, we need to wait for its mousemove // event to clear it before we can show this one, ie a user "hovers" // this element on their way to mousing over the shown mouseover mousedNewItem = true; if (mouseoverTimer) { // user is moving their mouse around, make sure where they stop is what we show clearTimeout(mouseoverTimer); }