MCPcopy Create free account
hub / github.com/BloombergGraphics/whatiscode / ttMove

Function ttMove

scripts/libs/d3-jetpack.js:247–259  ·  view source on GitHub ↗
(d)

Source from the content-addressed store, hash-verified

245 }
246
247 function ttMove(d){
248 var tt = d3.select('.tooltip')
249 if (!tt.size()) return
250 var e = d3.event,
251 x = e.clientX,
252 y = e.clientY,
253 doctop = (window.scrollY)? window.scrollY : (document.documentElement && document.documentElement.scrollTop)? document.documentElement.scrollTop : document.body.scrollTop;
254 n = tt.node(),
255 nBB = n.getBoundingClientRect()
256
257 tt.style('top', (y+doctop-nBB.height-18)+"px");
258 tt.style('left', Math.min(Math.max(0, (x-nBB.width/2)), window.innerWidth - nBB.width)+"px");
259 }
260
261 function ttHide(d){
262 d3.select('.tooltip').classed('tooltip-hidden', true);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected