[Pkg-javascript-commits] [d3-tip.js] 230/277: put scrollLeft scrollTop outside the bbox function, so user can have a full size scrollLeft/Top value, instead of the scaled ones

bhuvan krishna bhuvan-guest at moszumanska.debian.org
Thu Dec 8 06:57:34 UTC 2016


This is an automated email from the git hooks/post-receive script.

bhuvan-guest pushed a commit to branch master
in repository d3-tip.js.

commit 1c0b4a19f8ac3bab1b7d800aba80734ede6b44d7
Author: Jeffrey Li <jli at millennialmedia.com>
Date:   Tue Mar 4 16:59:46 2014 -0500

    put scrollLeft scrollTop outside the bbox function, so user can have a full size scrollLeft/Top value, instead of the scaled ones
---
 index.js | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/index.js b/index.js
index dbf0200..8c9f4e0 100644
--- a/index.js
+++ b/index.js
@@ -43,7 +43,9 @@
           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' })
@@ -51,8 +53,8 @@
       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
@@ -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)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/d3-tip.js.git



More information about the Pkg-javascript-commits mailing list