Marquee Rectangle Node Creation Demo
This demo shows how to use
MarqueeSelectionInputMode
to create new nodes.
This is done by adding a listener that creates a node the size of the marquee rectangle
when a selection is finished.
Also note that the marquee rectangle snaps to other nodes. This is achieved by using a
custom
MarqueeSelectionInputMode
and relaying the size and location of the marquee rectangle to a
SnapContext
, which provides a visualisation as well as a
SnapResult
to which the marquee rectangle can be snapped to. The
NodeStyle
used for default node creation is reused in the marquee's template to style the selection
rectangle.
Things to Try
Drag the mouse to span a rectangular selection that transforms into a node on release.