Skip to content

Commit 5645787

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 5645787

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
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 & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -353,21 +353,23 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
353353
}
354354
else if(ew === 'e') hAlign = 'right';
355355

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-
});
356+
if(gd._context.enableRangeEntry) {
357+
dragger3
358+
.call(svgTextUtils.makeEditable, null, {
359+
immediate: true,
360+
background: fullLayout.paper_bgcolor,
361+
text: String(initialText),
362+
fill: ax.tickfont ? ax.tickfont.color : '#444',
363+
horizontalAlign: hAlign,
364+
verticalAlign: vAlign
365+
})
366+
.on('edit', function(text) {
367+
var v = ax.d2r(text);
368+
if(v !== undefined) {
369+
Plotly.relayout(gd, attrStr, v);
370+
}
371+
});
372+
}
371373
}
372374
}
373375

0 commit comments

Comments
 (0)