CompositionInteraction

class CompositionInteraction(val composition: Composition)(source)

Interaction with a composition by the mouse, like the pointer events of SVG documents in browsers: entered and exited when the pointer moves onto or off a node and the groups it is in, pressed, released and clicked for the topmost node under the pointer. transform maps the coordinates of the composition to those of the mouse, the transform the composition is drawn with.

val interaction = CompositionInteraction(composition).apply { listenTo(mouse) }
interaction.clicked.listen { println("clicked ${it.node.id} ${it.link}") }

Constructors

Link copied to clipboard
constructor(composition: Composition)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

the topmost node under the pointer and the groups it is in, the node first

Link copied to clipboard

the topmost node under the pointer, null when there is none

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var transform: Matrix44

Functions

Link copied to clipboard
fun listenTo(mouse: MouseEvents)

listens to the events of mouse

Link copied to clipboard
fun move(position: Vector2, mouseEvent: MouseEvent? = null)

updates hovered for the pointer at position, sends exited and entered for the nodes that change

Link copied to clipboard
fun press(mouseEvent: MouseEvent)

sends pressed for the node at the position of mouseEvent

Link copied to clipboard
fun release(mouseEvent: MouseEvent)

sends released, and clicked when the node was pressed too, for the node at the position of mouseEvent