Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5a4f945

Browse files
committedJan 18, 2017
Merge branch 'master' into annotations-gl2d
2 parents afaa4cb + 4f00c99 commit 5a4f945

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1639
-572
lines changed
 

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"gl-spikes2d": "^1.0.1",
7878
"gl-surface3d": "^1.3.0",
7979
"mapbox-gl": "^0.22.0",
80-
"mouse-change": "1.3.0",
80+
"mouse-change": "^1.4.0",
8181
"mouse-wheel": "^1.0.2",
8282
"ndarray": "^1.0.16",
8383
"ndarray-fill": "^1.0.1",

‎src/components/annotations/annotation_defaults.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op
2525
}
2626

2727
var visible = coerce('visible', !itemOpts.itemIsNotPlainObject);
28+
var clickToShow = coerce('clicktoshow');
2829

29-
if(!visible) return annOut;
30+
if(!(visible || clickToShow)) return annOut;
3031

3132
coerce('opacity');
3233
coerce('align');
@@ -75,7 +76,7 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op
7576
}
7677

7778
// xanchor, yanchor
78-
else coerce(axLetter + 'anchor');
79+
coerce(axLetter + 'anchor');
7980
}
8081

8182
// if you have one coordinate you should have both
@@ -86,10 +87,21 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op
8687
coerce('arrowhead');
8788
coerce('arrowsize');
8889
coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2);
90+
coerce('standoff');
8991

9092
// if you have one part of arrow length you should have both
9193
Lib.noneOrAll(annIn, annOut, ['ax', 'ay']);
9294
}
9395

96+
if(clickToShow) {
97+
var xClick = coerce('xclick');
98+
var yClick = coerce('yclick');
99+
100+
// put the actual click data to bind to into private attributes
101+
// so we don't have to do this little bit of logic on every hover event
102+
annOut._xclick = (xClick === undefined) ? annOut.x : xClick;
103+
annOut._yclick = (yClick === undefined) ? annOut.y : yClick;
104+
}
105+
94106
return annOut;
95107
};

0 commit comments

Comments
 (0)
Please sign in to comment.