ailon / markerjs2

Add image annotation to your web apps.
https://markerjs.com
Other
142 stars 39 forks source link

marker state misses first freehand marker #154

Closed mbenzenhoefer closed 1 year ago

mbenzenhoefer commented 1 year ago

I am trying to check if there has been any change made to the image by checking the count of added markers.

I encountered, that if have only one freehand marker present and added, the list of markers retrieved by getState().markers is empty. When any other marker is present, it works, also all other markers work.

No other markers: image

With other markers present: image

I can also remove the rectangular again, and the freehand marker is still there: image

Can you please assist here? I tried to find the cause but did not find the right spot in the code yet. Thanks!

ailon commented 1 year ago

The freehand marker is "created" only when you switch to something else since in default configuration you can draw on the same marker until you switch/save.

There's a statechange event fired when something changes. Having said that, in your scenario I think it will only fire after you switch away from creating the freehand marker.

There's also a setting to change how freehand marker behaves in this regard: https://markerjs.com/reference/classes/settings.html#newfreehandmarkeronpointerup

mbenzenhoefer commented 1 year ago

Thanks for the information. So I think the only way for me would be setting the mentioned option to true.