Reputation: 167
I'm currently developing a webapp that allows the end-user to draw different shapes. I've set the draw-object up with a condition to check for various things. This includes checking for intersections with other geometry objects.
The issue i have is that the condition is always called, and only returns the "pointerdown"-event. Basically if the user clicks and hold down the mouse (dragging), this leads to the segment not being added drawing due to the "clickTolerance":
https://openlayers.org/en/latest/apidoc/module-ol_interaction_Draw-Draw.html
This is fine, and i don't want to change this. The user should be able to drag the map while drawing. But the problem is that the condition is always called, even though the segment is not added to the drawing.
Is there any way around this?
Upvotes: 3
Views: 839
Reputation: 819
I think these examples covers your use case:
Free hand drawing:
https://openlayers.org/en/latest/examples/draw-freehand.html
Drawing shapes:
https://openlayers.org/en/latest/examples/draw-shapes.html
Hope this helps!
Upvotes: 2