Skip to content
This repository has been archived by the owner on Mar 17, 2020. It is now read-only.

Commit

Permalink
put scrollLeft scrollTop outside the bbox function, so user can have …
Browse files Browse the repository at this point in the history
…a full size scrollLeft/Top value, instead of the scaled ones
  • Loading branch information
Jeffrey Li committed Mar 4, 2014
1 parent be99e94 commit 1c0b4a1
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,18 @@
dir = direction.apply(this, args),
nodel = d3.select(node),
i = directions.length,
coords
coords,
scrollTop = document.documentElement.scrollTop || document.body.scrollTop,
scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft

nodel.html(content)
.style({ opacity: 1, 'pointer-events': 'all' })

while(i--) nodel.classed(directions[i], false)
coords = direction_callbacks.get(dir).apply(this)
nodel.classed(dir, true).style({
top: (coords.top + poffset[0]) + 'px',
left: (coords.left + poffset[1]) + 'px'
top: (coords.top + poffset[0]) + scrollTop + 'px',
left: (coords.left + poffset[1]) + scrollLeft + 'px'
})

return tip
Expand Down Expand Up @@ -261,14 +263,10 @@
width = tbbox.width,
height = tbbox.height,
x = tbbox.x,
y = tbbox.y,
scrollEl = document.documentElement? document.documentElement : document.body,
scrollTop = scrollEl.scrollTop,
scrollLeft = scrollEl.scrollLeft
y = tbbox.y


point.x = x + scrollLeft
point.y = y + scrollTop
point.x = x
point.y = y
bbox.nw = point.matrixTransform(matrix)
point.x += width
bbox.ne = point.matrixTransform(matrix)
Expand Down

0 comments on commit 1c0b4a1

Please sign in to comment.