-
-
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
1852 persistent click via select points #2944
Conversation
Reason: to be reviewable from a perf standpoint.
- Set hoverMode to 'closest' where needed.
- Instead of an expandingIndex to identify the actual trace wanted, expecting a searchInfo object.
- Reason: the selection cache wasn't cleared when a user clicked the last selected point with Shift and thus a new selection started with Shift would add to the still cached selection testers from previous selection.
- Ensure click-to-select cleanly clears and starts selections although add/subtract mode on. - Ensure double click in lasso and select mode cleanly clears and restarts selections when add/subtract mode on.
- TODO: deactivated a mouseout listener in geo.js cause with it, click-to-select won't work. To be reviewed. - Include additional for choropleth that's based on geo. - One double click location in an existing choropleth test needed to change though to be on an empty area that is not a world country.
- Reason: some tests ran into async timeout issues on CI.
- Thereby fixed bug in geo base plot: set a subplot id in dragOptions so that selection cache isn't coerced each time an interaction happens.
- Ternary was the only base plot with inconsistent behavior in terms of holding the Shift key. It allowed to temporarily pan (zoom when in pan) in zoom, lasso and select drag modes.
- Updates of TODO comments are based on discussions on Github and Slack.
- Reason: isPointOrBinSelected is a potentially costly operation and thus leverage an assignment in an if condition trick to avoid executing isPointOrBinSelected unnecessarily.
- Renaming because since click-to-select, selections not only can be defined by polygons, but also by point numbers. Up until now code was centered around polygons being the sole means to define a selection. Renamed identifiers to be more general. - Extract `multitester` to new module `lib/select.js` because `multitester` is no longer to been seen in the sole context of polygons.
Thanks for the report -> #2958 |
@etpinard, regarding this bug
This is a little unfortunate. It all happens when the selection state is cleared in plotly.js/src/plots/cartesian/dragbox.js Line 197 in ac4b909
I believe we do that here because if we've drawn polygons previously in lasso / select and then we pan or zoom the plotting area, these polygons are no longer valid. Why? Because panning / zooming isn't implemented for those polygons. Haven't looked at the code explicitly, but that's my interpretation when testing it interactively. If my interpretation is correct, what could we do?
|
@rmoestl about #2944 (comment). First, thanks very much for the detailed response. Thinking about this again, I'm starting to believe that the current behavior isn't that bad. Or, in other words, fixing it won't be worth it. The current behavior only looks odd when users shift-select pt in |
- Wait until 'plotly_click' event is fired before checking that no point has been selected.
- Reason: dynamically set CI tags in Jasmine `it` test descriptions are not parsed by CI.
src/components/fx/layout_defaults.js
Outdated
@@ -16,6 +16,8 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { | |||
return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); | |||
} | |||
|
|||
coerce('clickmode'); |
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.
We're still missing @alexcjohnson's smart default suggestion where when a user sets clickmode: 'select'
the default hovermode
value becomes 'closest'
.
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.
Oh, sorry, I misunderstood that. I thought mentioning in clickmode
's description that hovermode set to closest is best for most applications was "enough".
So what we want to have is when clickmode
includes the select
flag and nothing is set explicitly for hovermode
, the default of hovermode
should be closest
. Is that right?
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.
So what we want to have is when
clickmode
includes theselect
flag and nothing is set explicitly forhovermode
, the default ofhovermode
should beclosest
. Is that right?
Yep! Which should be as simple as modifying the hovermodeDflt
logic below.
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.
Done!
- Put throwing an error in place should it be called with this parameter shape still. See PR #2944 for the discussion.
- Reason: it's pretty sure it'll no longer be called. - See #2944 (comment)
Amazing work @rmoestl . A hard-fought 💃 This thing will be in the running for PR of the year 🏆 |
🙇♂️ Thanks for your support, @etpinard and @alexcjohnson! |
Superseding PR #2824, this PR will introduce the select-on-click / persistent selection feature discussed in issue #1852.
A few remarks:
select_test.js
.