[Pkg-javascript-commits] [d3-tip.js] 41/277: use getCTM for x offset
bhuvan krishna
bhuvan-guest at moszumanska.debian.org
Thu Dec 8 06:57:14 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 4f91d288b30e46021d0bcef1af490f2ee7d6a8bf
Author: Caged <justin at labratrevenge.com>
Date: Tue Feb 7 16:48:43 2012 -0800
use getCTM for x offset
---
examples/nested-groups.html | 2 +-
src/d3.tip.js | 10 ++++++----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/examples/nested-groups.html b/examples/nested-groups.html
index 77fb10f..60eff0d 100644
--- a/examples/nested-groups.html
+++ b/examples/nested-groups.html
@@ -197,7 +197,7 @@
tip.apply(this, arguments)
var rect = this.getBoundingClientRect(),
bbox = this.getBBox(),
- // trans = this.getTransformToElement(),
+ trans = this.getTransformToElement(this.ownerSVGElement),
scree = this.getScreenCTM(),
ctm = this.getCTM(),
x = ctm.e - ctm.f + (bbox.width / 2),
diff --git a/src/d3.tip.js b/src/d3.tip.js
index ebcc4bd..1b2c45f 100644
--- a/src/d3.tip.js
+++ b/src/d3.tip.js
@@ -17,14 +17,15 @@ d3.svg.tip = function() {
tipText = text.apply(this, arguments),
container = d3.select(node),
tag = this.tagName.toLowerCase(),
- loc, stem, stem_gen, backingRect, containerRect, stemRect, d3_orient_types;
+ loc, stem, stem_gen, backingRect, containerRect, containerCTM, stemRect, d3_orient_types;
// Elements and Bounds
var doc = d3.select(this.ownerSVGElement),
target = d3.select(this),
backing = d3.select(make('rect')),
docRect = this.ownerSVGElement.getBoundingClientRect(),
- targetRect = this.getBBox();
+ targetRect = this.getBBox(),
+ targetCTM = this.getCTM();
// TODO: Allow ability to specify this in someway
target.on('mouseout', function() { container.remove() })
@@ -60,9 +61,10 @@ d3.svg.tip = function() {
top: function() {
stem.attr('transform', 'translate(' + (backingRect.width / 2) + ',' + backingRect.height + ')');
containerRect = container.node().getBBox()
+ stemRect = stem.node().getBBox()
- x = targetRect.x + (targetRect.width / 2) - (containerRect.width / 2) + tipOffset[0];
- y = targetRect.y - containerRect.height + tipOffset[1];
+ x = targetCTM.e + (targetRect.width / 2) - (containerRect.width / 2) + tipOffset[0];
+ y = targetRect.y - stemRect.height + tipOffset[1];
return {x: x, y: y}
},
--
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