annotorious / annotorious-v2-plugins

Plugins compatible with the RecogitoJS, Annotorious and AnnotoriousOSD annotation libraries
BSD 3-Clause "New" or "Revised" License
28 stars 20 forks source link

DEL-key in annotorious-better-polygon deletes whole polygon #24

Closed pwuertz closed 2 years ago

pwuertz commented 2 years ago

The annotorious-better-polygon functionality "Remove points by selecting them with a click and pressing the DEL key" seems to have an event-propagation issue.

When I select a polygon-point and hit DEL, I can see the point being deleted, but shortly after the whole polygon is being deleted as well.

rsimon commented 2 years ago

Yes, sorry. I noticed that a while back - will look into it!

pwuertz commented 2 years ago

Would it be sufficient to return true if deleteSelected() deleted a point in https://github.com/recogito/recogito-client-plugins/blob/85db3c5b9970163a481aab8d95483bbbb3c82e97/plugins/annotorious-better-polygon/src/ImEditablePolygon.js#L90 .. and if so, call event.preventDefault(); event.stopPropagation(); here? https://github.com/recogito/recogito-client-plugins/blob/85db3c5b9970163a481aab8d95483bbbb3c82e97/plugins/annotorious-better-polygon/src/ImEditablePolygon.js#L193

That is, if the plugin-handler is guaranteed to be called prior to the annotorious handler. Also, perhaps it is better to register the handler to the main annotorious/openseadragon div to prevent confusion if there are multiple instances?