Skip to content

Profectus / game/boards/board / DraggableNode

Interface: DraggableNode<T> ​

An object that represents a system for moving nodes on a board by dragging them.

Type Parameters ​

• T

Properties ​

drag() ​

drag: (e) => void

A function to call when the mouse moves during a drag, typically attached to the Board's onDrag listener.

Parameters ​

e ​

MouseEvent | TouchEvent

Returns ​

void

Defined in ​

profectus/src/game/boards/board.tsx:85


dragDelta ​

dragDelta: Ref<NodePosition, NodePosition>

The position of the node being dragged relative to where it started at the beginning of the drag.

Defined in ​

profectus/src/game/boards/board.tsx:77


endDrag ​

endDrag: VoidFunction

A function to call whenever a drag should end, typically attached to the Board's onMouseUp and onMouseLeave listeners.

Defined in ​

profectus/src/game/boards/board.tsx:83


hasDragged ​

hasDragged: Ref<boolean, boolean>

A ref to whether or not the node being dragged has actually been dragged away from its starting position.

Defined in ​

profectus/src/game/boards/board.tsx:75


nodeBeingDragged ​

nodeBeingDragged: Ref<undefined | T, undefined | T>

A ref to the node currently being moved.

Defined in ​

profectus/src/game/boards/board.tsx:71


receivingNode ​

receivingNode: Ref<undefined | T, undefined | T>

A ref to the node the node being dragged could be dropped upon if let go, if any. The node closest to the node being dragged if there are more than one within the drop area radius.

Defined in ​

profectus/src/game/boards/board.tsx:73


receivingNodes ​

receivingNodes: Ref<T[], T[]>

The nodes that can receive the node currently being dragged.

Defined in ​

profectus/src/game/boards/board.tsx:79


startDrag() ​

startDrag: (e, node) => void

A function to call whenever a drag should start, that takes the mouse event that triggered it. Typically attached to each node's onMouseDown listener.

Parameters ​

e ​

MouseEvent | TouchEvent

node ​

T

Returns ​

void

Defined in ​

profectus/src/game/boards/board.tsx:81