[Pkg-javascript-commits] [d3-tip.js] 66/277: rename orient, use direction instead
bhuvan krishna
bhuvan-guest at moszumanska.debian.org
Thu Dec 8 06:57:17 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 3f8b7823eac3159ca440fdba8cb3d660e0faa0ed
Author: Justin Palmer <justin at github.com>
Date: Sun Apr 7 13:54:29 2013 -0700
rename orient, use direction instead
---
examples/bars.html | 4 ++--
src/d3.tip.js | 20 +++++++++++---------
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/examples/bars.html b/examples/bars.html
index af952ce..a93bfd0 100644
--- a/examples/bars.html
+++ b/examples/bars.html
@@ -63,8 +63,8 @@
var tip = d3.svg.tip()
.attr('class', 'd3-tip')
.text(function(d) { return d.total })
- .orient(function(d) {
- return d3.shuffle(['top', 'bottom', 'left', 'right'])[0]
+ .direction(function(d) {
+ return d3.shuffle(['n', 's', 'e', 'w'])[0]
})
var w = 800,
diff --git a/src/d3.tip.js b/src/d3.tip.js
index 842b541..13ecd75 100644
--- a/src/d3.tip.js
+++ b/src/d3.tip.js
@@ -2,10 +2,9 @@
//
// Returns a tip
d3.svg.tip = function() {
- var orient = 'top',
+ var direction = d3_svg_direction,
offset = d3_svg_offset,
text = d3_svg_text,
- orient = 'top',
node = init_node(),
svg = null,
container = null,
@@ -18,6 +17,10 @@ d3.svg.tip = function() {
document.body.appendChild(node)
}
+ function d3_svg_direction() {
+ return 'n'
+ }
+
function d3_svg_offset() {
return [0, 0]
}
@@ -29,14 +32,13 @@ d3.svg.tip = function() {
tip.show = function(v) {
var bbox = get_screen_bbox(),
content = text.apply(this, arguments),
- side = orient.apply(this, arguments),
+ dir = direction.apply(this, arguments),
top, left;
- console.log(side)
node.innerHTML = content
node.style.display = 'block'
- switch(side) {
+ switch(dir) {
case 'bottom':
top = (bbox.s.y - (node.offsetHeight / 2)) + 'px'
left = (bbox.s.x - node.offsetWidth / 2) + 'px'
@@ -79,8 +81,8 @@ d3.svg.tip = function() {
//
// v - One of top, bottom, left, or right
//
- // Returns tip or oreint
- tip.orient = function(v) {
+ // Returns tip or direction
+ tip.direction = function(v) {
if (!arguments.length) return orient;
orient = v == null ? v : d3.functor(v);
return tip;
@@ -93,7 +95,7 @@ d3.svg.tip = function() {
// Returns offset or
tip.offset = function(v) {
if (!arguments.length) return offset;
- offset = v == null ? v: d3.functor(v);
+ offset = v == null ? v : d3.functor(v);
return tip;
};
@@ -104,7 +106,7 @@ d3.svg.tip = function() {
// Returns text value or tip
tip.text = function(v) {
if (!arguments.length) return text;
- text = v == null ? v: d3.functor(v);
+ text = v == null ? v : d3.functor(v);
return tip;
};
--
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