i'm looking to change the cursor of ol3 during drawing from blue circle to crosshair, i've tried this answer, but it changes only OS cursor not ol3 cursor, is there any idea ?
Answer
You can use the Draw interaction's style
property to change the default appeal of the cursor. To change the style, you have to provide all of the appropriate properties for the type of the drawn geometry (e.g. stroke, fill, image for polygon).
As you can see in this example, the ol.style.Icon
does not work on the draw interaction. This might be a bug, I didn't check the source code. The other two image styles, ol.style.Circle
and ol.style.RegularShape
work like a charm.
Your best bet for now would be to use a regular shape, and create a star with 4 points, a big outer radius, and a very small inner radius. This way the resulting star could represent a crosshair.
PS: Other option would be not setting the image
property of the interaction's style, just altering the browser's cursor over the map while the drawing interaction is active.
No comments:
Post a Comment