Allow deleting the whole feature from direct_select#975
Allow deleting the whole feature from direct_select#975trygveaa wants to merge 1 commit intomapbox:mainfrom
Conversation
cf58748 to
3cd03ba
Compare
When no vertices are selected, trash deletes the whole feature.
3cd03ba to
a4c3ab8
Compare
adrianababakanian
left a comment
There was a problem hiding this comment.
Thanks for opening this PR @trygveaa . The suggestion conflicts a bit with the logic outlined by the difference between the direct_select and simple_select modes -- which is not to say this can't be changed, just that we should consider the implications before moving forward.
Per the API reference for simple_select and direct_select, the former lets you "select, delete, and drag features" whereas the later lets you "select, delete, and drag vertices." This is reinforced by direct_select's fireActionableState method:
mapbox-gl-draw/src/modes/direct_select.js
Lines 22 to 28 in fb37f93
The trash action is intended to only have effect when state.selectedCoordPaths.length > 0, which this PR would change.
Is the motivation here to remove the need to "click away" from a feature when it is in direct_select in order to then delete the feature with simple_select? I see the benefit this could provide to the user experience (i.e. fewer clicks), but also would like to consider the fact that this would blur the distinction between direct_select (more vertex-oriented) and simple_select (more feature-oriented).
That being said, both modes do allow features to be dragged.
|
I think this change would be great. It's not always immediately obvious to the user whether they're in direct or simple select mode, especially after just creating a shape. If no vertices are selected, it's pretty strange to just do nothing when hitting trash/delete. |
When no vertices are selected, trash deletes the whole feature.