[Pkg-javascript-commits] [d3-tip.js] 199/277: allow explict passing of target element

bhuvan krishna bhuvan-guest at moszumanska.debian.org
Thu Dec 8 06:57:30 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 d62c4bbfc236ab26f1de18dcb24373b060d8759b
Author: Justin Palmer <justin at github.com>
Date:   Tue Nov 5 14:05:59 2013 -0800

    allow explict passing of target element
---
 index.js | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/index.js b/index.js
index e84ca7f..5a27756 100644
--- a/index.js
+++ b/index.js
@@ -12,7 +12,8 @@ d3.tip = function() {
       html      = d3_tip_html,
       node      = initNode(),
       svg       = null,
-      point     = null
+      point     = null,
+      target    = null
 
   function tip(vis) {
     svg = getSVGNode(vis)
@@ -24,9 +25,12 @@ d3.tip = function() {
   //
   // Returns a tip
   tip.show = function() {
-    var content = html.apply(this, arguments),
-        poffset = offset.apply(this, arguments),
-        dir     = direction.apply(this, arguments),
+    var args = Array.prototype.slice.call(arguments)
+    if(args.length > 1) target = args.pop()
+
+    var content = html.apply(this, args),
+        poffset = offset.apply(this, args),
+        dir     = direction.apply(this, args),
         nodel   = d3.select(node), i = 0,
         coords
 
@@ -238,10 +242,10 @@ d3.tip = function() {
   //
   // Returns an Object {n, s, e, w, nw, sw, ne, se}
   function getScreenBBox() {
-    var target     = d3.event.target,
+    var targetel   = target || d3.event.target,
         bbox       = {},
-        matrix     = target.getScreenCTM(),
-        tbbox      = target.getBBox(),
+        matrix     = targetel.getScreenCTM(),
+        tbbox      = targetel.getBBox(),
         width      = tbbox.width,
         height     = tbbox.height,
         x          = tbbox.x,

-- 
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