-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow controlling pan/zoom range entry. #1389
Conversation
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.
488a073
to
5645787
Compare
Ha, yeah that's probably plotly.js' most hidden feature. Good 👁️ First, can you elaborate on the bug you're seeing? At first glance, those range entry input boxes handlers behave as expected (i.e. as what a plain I'm open to adding a config argument, but I'm not convinced range entry is best at describing this feature. Maybe Moreover, we should make sure that the drag corners can also be optionally taken out. |
Oh, and you may be right, what I see for a category axis isn't necessarily a bug, but still isn't what people would expect. (It's almost an argument for it being disabled all the time on category axes since while it works the same way it would via an API, I don't think there's any way for an end-user to understand the behavior). A larger discussion I'm sure, and doesn't necessarily need to be tied up in providing an ad-hoc method to disabling the range entry. |
Also renamed the range entry option as per PR.
Range entry option renamed and controlling whether the drag handles are shown to be begin with is added. There is a dependency between the option now (noted in comment). If you disable the drag handles, even if range entry is enabled you won't be able to use it. |
src/plot_api/plot_config.js
Outdated
// enable/disable direct range entry at the pan/zoom drag points | ||
enableRangeEntry: true, | ||
// enable axis pan/zoom drag handles | ||
showAxisDragHandles: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A straight-up boolean is fine for now.
I'm thinking down the road, we could allow users to specify which drag handles to show for example:
showAxisDragHandles: 'n+s'
would only show the north (or top) and south (or bottom) dragger.
But that's for another day. 👍
DRAGGERSIZE, ya._length * 0.1, 's', ''); | ||
dragBox(gd, plotinfo, x0, 0, | ||
DRAGGERSIZE, ya._length * 0.1, 'n', ''); | ||
if(gd._context.showAxisDragHandles) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Before merging, we'll need to add a few test cases to 🔒 this down.
In test/jasmine/config_test.js
, call Plotly.plot
with the a config object that set both new options to false
and make sure that the corresponding handle and range entry boxes don't show up in the DOM. The showLink
test case should serve as a good example.
Let me know if you have any questions!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got some tests added.
click(cornerX, cornerY); | ||
|
||
var editBox = document.getElementsByClassName('plugin-editable editable')[0]; | ||
expect(editBox).toBeUndefined(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow. Very nicely done!
@rpaskowitz amazing work! Thanks for your efforts 🍻 This patch will part of the new release |
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.