Skip to content

Commit 68959b3

Browse files
committedMay 11, 2017
add return boolean to translatePoint
- return false when sel is removed i.e. when its x/y coords are non-numeric - this is helpful for clearing associated <g textpoint> - return true otherwise
1 parent 310e67a commit 68959b3

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed
 

Diff for: ‎src/components/drawing/index.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ drawing.setRect = function(s, x, y, w, h) {
4747
s.call(drawing.setPosition, x, y).call(drawing.setSize, w, h);
4848
};
4949

50+
/** Translate / remove node
51+
*
52+
* @param {object} d : calcdata point item
53+
* @param {sel} sel : d3 selction of node to translate
54+
* @param {object} xa : corresponding full xaxis object
55+
* @param {object} ya : corresponding full yaxis object
56+
*
57+
* @return {boolean} :
58+
* true if selection got translated
59+
* false if selection got removed
60+
*/
5061
drawing.translatePoint = function(d, sel, xa, ya) {
5162
// put xp and yp into d if pixel scaling is already done
5263
var x = d.xp || xa.c2p(d.x),
@@ -59,8 +70,12 @@ drawing.translatePoint = function(d, sel, xa, ya) {
5970
} else {
6071
sel.attr('transform', 'translate(' + x + ',' + y + ')');
6172
}
73+
} else {
74+
sel.remove();
75+
return false;
6276
}
63-
else sel.remove();
77+
78+
return true;
6479
};
6580

6681
drawing.translatePoints = function(s, xa, ya, trace) {

0 commit comments

Comments
 (0)