You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wish to force user to draw only 1 polygon on map. So I'm waiting for the finish event, to disable polygon mode. Managed to do it like this:
draw.on('finish, function () {
draw.setMode('static');
deactivateButtons();
});
I understand onFinish event as finishing some work, the whole task:
If user finished drawing polygon
If user finished editing polygon (clicked out of & deselected polygon)
If user finished dragging a polygon (clicked out of & deselected polygon)...
Currently, if user drags a coordinate it calls the finish event, which in my case deselects polygon and the select mode. User needs to select the polygon again... And again...
Describe your proposed idea for the solution to this problem
For me:
onChange should be called on the whole polygon drag, but onFinish works ok,
onChange & onDrag should be called on coordinate drag.
Describe alternatives you've considered
If onFinish needs to stay, then we need to know what was the action and which object did call it, examples:
draw.on('finish', function(e) {
console.log(e.id); // prints same as current uuid 44d4b4d7-8b6c-4760-9c6c-c38989e785bb
console.log(e.objectType); // prints 'coordinate', 'polygon' etc.
console.log(e.action); // drag or coordinateDrag
});
Unfortunately, I don't have experience in designing open source product, so I cannot provide any professional examples/ideas.
This solution is important for me to provide advanced UX for user, so if you make a proper solution, I will gladly make a small $ contribution. Edit: Oh, you don't have the sponsor button yet lol.
For now I'm saving the last action and resetting mode only if it's not the Select mode to keep this mode running.
Hey @aircodepl - thanks for raising this. I am going to try and address this with #261 . This will allow you to determine why the onFinish event was called and from which mode. I hope this helps!
Is your feature request related to a problem? Please describe.
Hi. Calling 'onFinish' event on every change (coordinate drag end) is a bad idea. There should be more dedicated events created for this purpose.
There was this change request:
#80
and done here:
#82
Example:
I wish to force user to draw only 1 polygon on map. So I'm waiting for the
finish
event, to disablepolygon mode
. Managed to do it like this:I understand
onFinish
event as finishing some work, the whole task:Currently, if user drags a coordinate it calls the finish event, which in my case deselects polygon and the select mode. User needs to select the polygon again... And again...
Describe your proposed idea for the solution to this problem
For me:
onChange
should be called on the whole polygon drag, butonFinish
works ok,onChange
&onDrag
should be called on coordinate drag.Describe alternatives you've considered
If
onFinish
needs to stay, then we need to know what was the action and which object did call it, examples:Unfortunately, I don't have experience in designing open source product, so I cannot provide any professional examples/ideas.
This solution is important for me to provide advanced UX for user, so if you make a proper solution, I will gladly make a small $ contribution. Edit: Oh, you don't have the sponsor button yet lol.
For now I'm saving the last action and resetting mode only if it's not the
Select
mode to keep this mode running.The text was updated successfully, but these errors were encountered: