5fef9ecfe121867dc6bd750a6a01b46150bb868e hiram Tue Nov 3 15:46:21 2020 -0800 dirty checkin for transition to click through to description page working and streamline the popUp text window definition refs #21980 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 9f76930..6da3b50 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -4460,192 +4460,221 @@ }; /////////////////////////////////////// //// mouseOver data display 2020-10 /// /////////////////////////////////////// var mouseOver = { spans: {}, visible: false, tracks: {}, popUpDelay: 1000, // one second delay before popUp appears popUpTimer: null,// handle from setTimeout to use in clearTimout(popUpTimer) delayDone: true, // mouse has not left element, still receiving move evts delayInProgress: false, // true if working with delay timer done mostRecentMouseEvt: null, + mouseMoveCount: 0, + mouseDelayCount: 0, + mouseInTrackCount: 0, // spans{} - key name is track name, value is an array of // objects: {x1, x2, value} // visible - keep track of window visible or not, value: true|false // shouldn't need to do this here, the window knows if it // is visible or not, just ask it for status // tracks{} - tracks that were set up initially, key is track name // value is the number of boxes (for debugging) // given hgt_....png file name, change to trackName_....json file name jsonFileName: function(imgElement, trackName) { var jsonFile=imgElement.src.replace("hgt/hgt_", "hgt/" + trackName + "_"); jsonFile = jsonFile.replace(".png", ".json"); return jsonFile; }, // called from: updateImgForId when it has updated a track in place // need to refresh the event handlers and json data updateMouseOver: function (trackName) { if (mouseOver.tracks[trackName]) { // there should be a more simple jQuery function to bind these events var tdData = "td_data_" + trackName; - var tdElement = document.getElementById(tdData); - var id = tdElement.id; - tdElement.addEventListener('mousemove', mouseOver.mouseMoveDelay); - tdElement.addEventListener('mouseout', mouseOver.popUpDisappear); + var tdDataId = document.getElementById(tdData); + $( tdDataId ).mousemove(mouseOver.mouseMoveDelay); + $( tdDataId ).mouseout(mouseOver.popUpDisappear); +// $( tdDataId ).bind('mousemove', mouseOver.mouseMoveDelay); +// $( tdDataId ).bind('mouseout', mouseOver.popUpDisappear); +// tdDataId.addEventListener('mousemove', mouseOver.mouseMoveDelay, true); +// tdDataId.addEventListener('mouseout', mouseOver.popUpDisappear, true); var imgData = "img_data_" + trackName; var imgElement = document.getElementById(imgData); mouseOver.fetchMapData(mouseOver.jsonFileName(imgElement, trackName), trackName); } }, // given an X coordinate: x, find the index idx // in the rects[idx] array where rects[idx].x1 <= x < rects[idx].x2 // returning -1 when not found // if we knew the array was sorted on x1 we could get out early // when x < x1 findRange: function (x, rects) { var answer = -1; // assmume not found for ( var idx in rects ) { if ((rects[idx].x1 <= x) && (x < rects[idx].x2)) { answer = idx; break; } } return answer; }, popUpDisappear: function () { if (mouseOver.visible) { // should *NOT* have to keep track !*! // $('#mouseOverText').hide(); // does not function ? - var msgWindow = document.querySelector(".wigMouseOver"); - msgWindow.classList.toggle("showMouseOver"); +// var msgWindow = document.querySelector(".wigMouseOver"); +// msgWindow.classList.toggle("showMouseOver"); mouseOver.visible = false; +// hPrintf("
\n"); // $('#mouseOverContainer').css('display','none'); // does not work - $('#mouseOverLine').css('display','none'); + $('#mouseOverText').css('display','none'); + $('#mouseOverVerticalLine').css('display','none'); } if (mouseOver.popUpTimer) { clearTimeout(mouseOver.popUpTimer); mouseOver.popUpTimer = null; } mouseOver.delayDone = true; mouseOver.delayInProgress = false; }, popUpVisible: function () { if (! mouseOver.visible) { // should *NOT* have to keep track !*! // $('#mouseOverText').show(); // does not function ? - var msgWindow = document.querySelector(".wigMouseOver"); - msgWindow.classList.toggle("showMouseOver"); +// var msgWindow = document.querySelector(".wigMouseOver"); +// msgWindow.classList.toggle("showMouseOver"); mouseOver.visible = true; // $('#mouseOverContainer').css('display','block'); // does not work - $('#mouseOverLine').css('display','block'); + $('#mouseOverText').css('display','block'); + $('#mouseOverVerticalLine').css('display','block'); } }, +// hPrintf("\n"); +// hPrintf("\n"); - //the evt.target.id is the img_data_