9cb1c014fe8ede37d3bf519a62746731b44c7bc5 hiram Tue Feb 2 07:06:05 2021 -0800 style update code review refs #26904 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index e89f7fc..dde8d4e 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -4655,31 +4655,33 @@ } // can show 'no data' when not found var mouseOverValue = mouseOver.noDataString; if (foundIdx > -1) { // value to display if (mouseOver.items[trackName][foundIdx].c > 1) { mouseOverValue = " ~ " + mouseOver.items[trackName][foundIdx].v + " "; } else { mouseOverValue = " " + mouseOver.items[trackName][foundIdx].v + " "; } } $('#mouseOverText').html(mouseOverValue); var msgWidth = mouseOver.maximumWidth[trackName]; $('#mouseOverText').width(msgWidth); var msgHeight = Math.ceil($('#mouseOverText').height()); var lineHeight = Math.max(0, tdHeight - msgHeight); - if (tdTop < 0) { lineHeight = Math.max(0, tdHeight + tdTop - msgHeight); } + if (tdTop < 0) { + lineHeight = Math.max(0, tdHeight + tdTop - msgHeight); + } var msgLeft = Math.max(tdLeft, clientX - (msgWidth/2) - 3); // with magic 3 var msgTop = Math.max(0, tdTop); var lineTop = Math.max(0, msgTop + msgHeight); var lineLeft = Math.max(0, clientX - 3); // with magic 3 if (clientY < msgTop + msgHeight) { // cursor overlaps with the msg box msgLeft = clientX - msgWidth - 6; // to the left of the cursor if (msgLeft < tdLeft || msgLeft < 0) { // hits left edge, switch msgLeft = clientX; // to right of cursor } } else { // apply limits to left and right edges, window or image msgLeft = Math.min(msgLeft, tdRight - msgWidth); // image right limit msgLeft = Math.min(msgLeft, $(window).width() - msgWidth); // window right msgLeft = Math.max(0, msgLeft); // left window edge limit } $('#mouseOverText').css('top',msgTop + "px");