Dragging Anchors Error
zindlerb opened this issue · 3 comments
When you drag an Anchor in the outline into a spot where it will render it throws an exception ("Not implemented") because the Graphic.Anchor does not implement the render or hitDetect methods.
I see 3 ways to resolve this:
- Don't allow Anchors to be dragged. This is the simplest and might make sense since there is not much that can be done with draggable anchors.
- Make anchors renderable. They could be represented as little circles. I don't know if this is a good idea because anchors are more of an abstract concept than a shape.
- Only make anchors draggable to areas that don't render. I think this would mean it could only be reordered within itself and dragged within other shapes.
I'd be willing to do a pr for this. Let me know if any of these sound good.
Good point!
I think the ideal solution would be a version of your idea 3. In particular, it would be nice to know where in the element tree is a "rendering context" and where in the tree is a "anchor-collection context", and to prevent dragging renderable elements to anchor-collection contexts or dragging anchors to rendering contexts. I can think of a few complications in making this determination:
Group
s can be in rendering or anchor contexts. (See howcollectAnchors
descends throughGroup
s in the definition ofGraphic.Path
.)- Not all
Path
s should be able to take anchors.Circle
andText
are secretlyPath
s, but they override the rendering code which cares about anchor descendants. So really, you shouldn't be able to give them children at all.
But these aren't huge problems, and I still think this version of idea 3 would be ideal.
(Your idea 1 isn't great, since dragging anchors within a path serves the useful function of reordering the points on the path. Your idea 2 is interesting, but I agree that it might be confusing to present anchors as independent graphical elements.)
What do you think? If you are interested in taking this on, I would be happy to help however I can.
I agree. I can do a pr for this. I'll message you if I have any questions 👍