[Pkg-javascript-commits] [d3-tip.js] 48/277: Fix placement of tip for left/right orientation
bhuvan krishna
bhuvan-guest at moszumanska.debian.org
Thu Dec 8 06:57:15 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 3e0515162d87f1764f7684e33749047c54265af5
Author: Karl Broman <kbroman at gmail.com>
Date: Mon Feb 18 10:54:31 2013 -0600
Fix placement of tip for left/right orientation
- Calculations were complicated and not-quite-right
---
src/d3.tip.js | 23 ++++-------------------
1 file changed, 4 insertions(+), 19 deletions(-)
diff --git a/src/d3.tip.js b/src/d3.tip.js
index e0a5ad6..0901ac2 100644
--- a/src/d3.tip.js
+++ b/src/d3.tip.js
@@ -100,16 +100,8 @@ d3.svg.tip = function() {
stem.attr('transform', 'translate(' + (backingRect.width + (stemRect.height/2)) + ',' + (backingRect.height / 2) + ') rotate(-90)');
containerRect = container.node().getBBox()
- x = targetRect.x - (stemRect.height / 2) + tipOffset[0];
- y = targetRect.y + tipOffset[1];
-
- if(tag == 'circle') {
- x -= containerRect.width - (stemRect.height / 2)
- y -= targetRect.height / 2
- } else if(tag == 'rect') {
- x -= containerRect.width - (stemRect.height / 2)
- y += targetRect.height / 2
- }
+ x = targetRect.x - (containerRect.x + containerRect.width) + tipOffset[0];
+ y = targetRect.y + targetRect.height/2 - (containerRect.y + containerRect.height/2) + tipOffset[1];
return {x: x, y: y}
},
@@ -118,16 +110,9 @@ d3.svg.tip = function() {
stem.attr('transform', 'translate(' + -(stemRect.height / 2) + ',' + (backingRect.height / 2) + ') rotate(90)');
containerRect = container.node().getBBox()
- x = targetRect.x + stemRect.height + tipOffset[0];
- y = targetRect.y + tipOffset[1];
- if(tag == 'circle') {
- x += targetRect.width
- y -= targetRect.height / 2
- } else if(tag == 'rect') {
- x += targetRect.width
- y += targetRect.height / 2
- }
+ x = targetRect.x + targetRect.width - containerRect.x + tipOffset[0];
+ y = targetRect.y + targetRect.height/2 - (containerRect.y + containerRect.height/2) + 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