Skip to content

Commit 992352b

Browse files
committed
add hover and spike modes to extra modes that could be enabled
1 parent b19d960 commit 992352b

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/components/modebar/manage.js

+21-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,25 @@ var DRAW_MODES = [
6666
'eraseshape'
6767
];
6868

69+
var HOVER_MODES = [
70+
'hoverCompareCartesian',
71+
'hoverClosestCartesian',
72+
'hoverClosestGl2d',
73+
'hoverClosest3d',
74+
'hoverClosestGeo',
75+
'hoverClosestPie',
76+
'toggleHover'
77+
];
78+
79+
var SPIKE_MODES = [
80+
'toggleSpikelines'
81+
];
82+
83+
var EXTRA_MODES = []
84+
.concat(DRAW_MODES)
85+
.concat(HOVER_MODES)
86+
.concat(SPIKE_MODES);
87+
6988
// logic behind which buttons are displayed by default
7089
function getButtonGroups(gd) {
7190
var fullLayout = gd._fullLayout;
@@ -152,8 +171,9 @@ function getButtonGroups(gd) {
152171
for(var i = 0; i < buttonsToAdd.length; i++) {
153172
var b = buttonsToAdd[i];
154173
if(typeof b === 'string') {
155-
if(DRAW_MODES.indexOf(b) !== -1) {
174+
if(EXTRA_MODES.indexOf(b) !== -1) {
156175
if(
176+
DRAW_MODES.indexOf(b) === -1 ||
157177
fullLayout._has('mapbox') || // draw shapes in paper coordinate (could be improved in future to support data coordinate, when there is no pitch)
158178
fullLayout._has('cartesian') // draw shapes in data coordinate
159179
) {

0 commit comments

Comments
 (0)