-
Notifications
You must be signed in to change notification settings - Fork 591
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
Better support for finalising drawn shapes #314
Comments
@aidanlister - just to make sure we're on the same page here. In your use case the user is drawing a polygon and you are using this polygon to highlight a bunch of points. Is that correct?
Assuming there is a good reason debouncing doesn't work, there are a few other events that draw emits that help us guess at when someone is done editing. This is a great idea and is a problem worth solving but the Good luck! |
@mcwhittemore Yes that's right, here's a screenshot of the process in google maps: http://share.aidanlister.com/gHrz I also sent you a link to the sandbox if you wanted to play with it, no worries if you don't have time. I see what you're saying though ... the nature of the polygon tool in mapbox-gl-draw is quite different as it's immediately a valid shape from the first click. The google maps polygon tool is only valid once you've double clicked to complete the shape. The modechanged sort of works but it's not clear to the user what the trigger points are (as you said, gets you 90% of the way). We've implemented the debouncing as an intermediary solution ... it's okay ... there's considerable jank every 500ms when we call Turf to do the calculation but it is what it is. Is there any way I can hook into the line tool to make it behave the same way the google maps polygon tool does? |
+1 Also I noticed there's no way to finish the polygon without double clicking, however the double click is interpreted as zoom in addition to "finishing" the shape. This doesn't seem like the behaviour the user would expect. |
@aidanlister I'm getting a 403 with your demo page. That said, if all you care about is when a user is done drawing a polygon (editing isn't an option) the move from Also, there is some talk here about letting users implement their own modes. I don't have time to work on this, but if you want to make the PR that would be amazing. |
@mcwhittemore there's two issues I guess:
|
Enter will also work. I think mapbox/mapbox-gl-js#2237 is blocking Draw's ability to turn off zoom, but this should be worked on. If the debouncing is a frustration, can you just inform your users to unselect the feature and run the processing on the mode change back to simple_select? This still has problems as the feature can change in multi select. |
I've been spending some time thinking about this today. Knowing when someone is done editing is hard, but knowing when they click is easy. We can use this to emit a less granular change. We will want to make this change in
|
That sounds good (I assume mousedown/mouseup aren't the actual click and hold events they sound like, which the code seems to reflect) |
@aidanlister I'm not sure what this means? |
mousedown sounds like click and hold, mouseup sounds like releasing that click. When drawing a shape you're not mousedown/mouseup, you're just clicking once ... but maybe I'm reading it wrong? |
@aidanlister gotcha. Click is down and up quickly. So in the draw modes you'd get a updated event with each new node rather than each time the mouse is moved. |
@aidanlister - 0.9.0 of Draw now has Closed by #358 |
My use case is the user creates a bounding box and I highlight all the markers within that bounding box.
The Google Maps API has a draw.end style event when the user double clicks, allowing me to change the color of the bounded area and move to the next step. This works quite well.
I haven't been able to do this as elegantly with draw.changed ... it fires in realtime as the user changes their shape so I either need to debounce it or try and add a "finished" button somewhere into the process.
What's the thinking on how this could be better supported?
The text was updated successfully, but these errors were encountered: