annotorious / annotorious-v2-selector-pack

Additional selection tools for Annotorious and the Annotorious OpenSeadragon plugin
BSD 3-Clause "New" or "Revised" License
14 stars 19 forks source link

handles to stretch the shape #15

Open vera0005 opened 2 years ago

rsimon commented 2 years ago

Thanks for this. I think the PR might be missing some code parts, however. At the moment, it doesn't do anything. If I understand correctly, the code is for moving stretch handles that will resize the shape. However, there are currently no stretch handles, meaning that code will never get executed. Can you check, or describe what you intend to do?

vera0005 commented 2 years ago

Woops... I forgot to change a line in the function getPoints. I will commit a change soon. The correct line should be const pointList = shape.querySelector('.a9s-inner').getAttribute('d').split('L');

My purpose in this pull request is to add many stretch handles to the boundary, so that we can adjust a local part of the boundary by dragging a handle. This feature is useful if we want to correct/refine a part of the boundary.

I also plan to redraw freely a part of the boundary. After connecting the end points, the old part would disappear. Is that a good idea?

rsimon commented 2 years ago

Thanks for the update! Redrawing freely sounds like an interesting use case & would be a good addition I think.

Just one thing: at the moment, its no longer possible to move the shape as a whole. There's an exception when getPoints is called with the inner shape. Your modified getPoints queries again for .a9s-inner which doesn't exist any more. That's part is easy to fix. But more importantly, when the whole shape is dragged, the handles don't move along - see screenshot below.

image

I think with just a bit of refactoring, that's probably easy to address without additional code. Would you be ok looking into this? Editable freehand would be an excellent addition - thanks for the work so far!

vera0005 commented 2 years ago

Thanks, Rainer. You are right. Now the freehand shape is not moveable as a whole. A regression. How to fix that? Without querySelector('.a9s-inner'), the function getPoints does not work.

I will look into the "handles don't move along" problem. In the mean time, I will keep working on the editable freehand drawing tool. Hopefully I can get some preliminary results in a few days.