Correctly inherit a Link class with shape paths

The problem is that copying an instance of the Link will do the wrong thing.

  • First it will make a construct an instance of your Link class, resulting in a visual tree consisting of:
    Link
        Shape
  • Then because a Link is a Panel, the panel will copy its elements, which includes a Shape. That results in:
    Link
        Shape
        Shape

And I’m guessing that the second Shape gets its default size (100x100) and default fill and stroke (black), because it’s not being used as a second link path.

(The default is that there is only one shape used for the link path. If you want more than one link path shape, you need to set isPanelMain on each of them to true. But I’m assuming that’s not the case here.)