Mercurial > hg > batmud > maputils
changeset 2555:f45d38b826e5
Clean up some variable names.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 27 Jan 2024 02:08:40 +0200 |
parents | 1eab7bcea1cd |
children | e5be8e4e3820 |
files | src/tooltip.js |
diffstat | 1 files changed, 20 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/tooltip.js Tue Jan 23 16:52:55 2024 +0200 +++ b/src/tooltip.js Sat Jan 27 02:08:40 2024 +0200 @@ -3,10 +3,10 @@ // Programmed by Matti 'ccr' Hamalainen <ccr@tnsp.org> // (C) Copyright 2006-2021 Tecnic Software productions (TNSP) // -var myprev = null; -var mytt = null; -var myx = 0; -var myy = 0; +var mapTipPrev = null; +var mapTipItem = null; +var mapTipXC = 0; +var mapTipYC = 0; function mapGetWindowSize() @@ -62,16 +62,16 @@ // Hilite map and list elements of given id function qh(uid) { - if (myprev != null) mapSetActive(myprev, false); + if (mapTipPrev != null) mapSetActive(mapTipPrev, false); mapSetActive(uid, true); - myprev = uid; + mapTipPrev = uid; } function qn() { - if (myprev != null) mapSetActive(myprev, false); - myprev = null; + if (mapTipPrev != null) mapSetActive(mapTipPrev, false); + mapTipPrev = null; htt(); } @@ -88,10 +88,10 @@ { var x = document.all ? (window.event.x + document.body.scrollLeft) : ev.pageX; var y = document.all ? (window.event.y + document.body.scrollTop) : ev.pageY; - if (mytt != null) + if (mapTipItem != null) { const dim = mapGetWindowSize(); - var boxW = mytt.clientWidth + 25, boxH = mytt.clientHeight + 25; + var boxW = mapTipItem.clientWidth + 25, boxH = mapTipItem.clientHeight + 25; if (x + boxW + 15 >= dim.w) x -= boxW; @@ -103,11 +103,11 @@ else y += 15; - myx = x; - myy = y; + mapTipXC = x; + mapTipYC = y; - mytt.style.left = x + "px"; - mytt.style.top = y + "px"; + mapTipItem.style.left = x + "px"; + mapTipItem.style.top = y + "px"; } } @@ -117,20 +117,20 @@ { htt(); - mytt = document.getElementById("tt"+ id); + mapTipItem = document.getElementById("tt"+ id); - mytt.style.left = myx + "px"; - mytt.style.top = myy + "px"; - mytt.style.display = "block"; + mapTipItem.style.left = mapTipXC + "px"; + mapTipItem.style.top = mapTipYC + "px"; + mapTipItem.style.display = "block"; } // Hide tooltip function htt() { - if (mytt) + if (mapTipItem) { - mytt.style.display = "none"; + mapTipItem.style.display = "none"; } }