-
Notifications
You must be signed in to change notification settings - Fork 15
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
Prevent double clicks for point annotations #896
Conversation
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.
I can produce incorrect features with this change (the blue ones):
Screencast.from.26.07.2024.09.58.05.webm
If I try to delete one of those, the app crashes. The features that are created within the cool down period should be immediately removed again. Also maybe we could check if the new point is "near" the previous point (there should be an OpenLayers method for that)? If not, users should be able to create points faster than the cool down period (as in the video).
If i throttle my connection speed I also see that problem. Before I simply could not reproduce that. |
Strange, it should not have anything to do with the connection speed. This is purely client-side. You have to click faster than the 400 ms for this to happen. |
I guess now the point is removed after all, BUT the map is also dragged after a double click. I also added the distance to last annotation feature. |
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.
I've updated the code a bit so the point and time are only updated if drawing points. However, this still fails because there is no distanceTo()
method in an OpenLayers geometry. LLM fail? 😄
This is likely also the reason why the map is "dragged" for you because there should be a JS error in your console.
Pretty sure that I actually got a distance and no error, but I'll have a look at this. No LLM fail😉, but rather StackOverflow |
Don't know why the console error slipped. Now it works, without any errors ;-) Please have a look if the position of the computeDistance function is correct or if it should be somewhere else. |
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.
The distance calculation works but the feature wasn't removed for me now, too. This was because the feature is added to the source after the drawend event was handled. I fixed that now.
fixes #491