Skip to content

Commit 488a073

Browse files
author
Robert Paskowitz
committed
Allow controlling pan/zoom range entry.
For either UI appearance reasons, or because the range entry doesn't work as one might expect (for example, on http://localhost:3000/devtools/test_dashboard/#axes_category_categoryarray, which should maybe be addressed in addition), allow people to disable the entry. Default to on so that introduction of the option is backwards compatible.
1 parent 190b3b5 commit 488a073

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

src/plot_api/plot_config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ module.exports = {
4848
// new users see some hints about interactivity
4949
showTips: true,
5050

51+
// enable/disable direct range entry at the pan/zoom drag points
52+
enableRangeEntry: true,
53+
5154
// link to open this plot in plotly
5255
showLink: false,
5356

src/plots/cartesian/dragbox.js

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -352,22 +352,23 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
352352
if(ax.side === 'right') hAlign = 'right';
353353
}
354354
else if(ew === 'e') hAlign = 'right';
355-
356-
dragger3
357-
.call(svgTextUtils.makeEditable, null, {
358-
immediate: true,
359-
background: fullLayout.paper_bgcolor,
360-
text: String(initialText),
361-
fill: ax.tickfont ? ax.tickfont.color : '#444',
362-
horizontalAlign: hAlign,
363-
verticalAlign: vAlign
364-
})
365-
.on('edit', function(text) {
366-
var v = ax.d2r(text);
367-
if(v !== undefined) {
368-
Plotly.relayout(gd, attrStr, v);
369-
}
370-
});
355+
if (gd._context.enableRangeEntry) {
356+
dragger3
357+
.call(svgTextUtils.makeEditable, null, {
358+
immediate: true,
359+
background: fullLayout.paper_bgcolor,
360+
text: String(initialText),
361+
fill: ax.tickfont ? ax.tickfont.color : '#444',
362+
horizontalAlign: hAlign,
363+
verticalAlign: vAlign
364+
})
365+
.on('edit', function(text) {
366+
var v = ax.d2r(text);
367+
if(v !== undefined) {
368+
Plotly.relayout(gd, attrStr, v);
369+
}
370+
});
371+
}
371372
}
372373
}
373374

0 commit comments

Comments
 (0)