Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IInteractionData

InteractionData is used to make a TreeNode interactable.

Via the interactionTypes the type of interaction that is possible can be specified for the node. Example: Only if the property drag in the interactionTypes is set to true it will be possible to drag the node.

If the node is interacted with, the interactionStates are set to the corresponding types. Example: If the node is dragged, the drag property in the interactionStates is set to true.

The dragOrigin and dragAnchors are only used when the object is being dragged. The logic for dragging is as follow:

  • If neither dragOrigin or dragAnchors are defined, the intersection point of the ray with the node is used as the origin for dragging.
  • If a dragOrigin is defined, but no dragAnchors, the dragOrigin is used as the origin for dragging.
  • If at least one anchor is defined in dragAnchors, the dragAnchors are used for dragging. In that case, the anchors are positioned accoriding to the drag transformation and then transformed with the rotation that has been provided. The transformed result is used to measure the distance to the ray, and the closest distanced anchor of the dragAnchors is chosen to compute the tranformation matrix that is applied to the node.

The calculations that are mentioned above happen in close proximity with the {@link IDragConstraint}s. As this is not the easiest of topics, please visit our help desk section on interactions. There we explain the process to set this up with many examples.

Hierarchy

  • ITreeNodeData
    • IInteractionData

Implemented by

Index

Properties

convertedObject: {}

The converted object of the tree node.

Type declaration

  • [key: string]: unknown
dragAnchors: { position: vec3; rotation?: { angle: number; axis: vec3 } }[]

The drag anchors can be defined as various points in space that will be transformed according to the node matrix that this data item belongs to. These anchors are used when an object is being dragged instead of the dragOrigin or the default, the intersection with the node.

The optional rotation in axis-angle representation is being applied to the node if the specified drag anchor has been used.

id: string

The ID of the tree node data.

interactionStates: IInteractionTypes

The keys should respond to the ones in the interactionType. They represent the current state of the interactions.

interactionTypes: IInteractionTypes

The types of interactions that are activated for this node.

restrictedManagers: string[]

The restricted managers are the managers that are allowed to interact with this node. If the array is empty, all managers are allowed to interact with this node.

updateCallback: null | ((newVersion: string, oldVersion: string) => void)

The update callback for the tree node data. This callback is called when the node is updated, e.g. when the version changes.

updateCallbackConvertedObject: null | ((newObj: unknown, oldObj: unknown, viewport: string) => void)

The update callback for the converted object of the tree node.

version: string

The version of the tree node data. If the version changes, the node data will be marked for an update. A version change can be triggered via updateVersion.

dragOrigin?: vec3

The drag origin can be defined instead of usind the default, the intersection with the node, as a dragging origin. If at least one dragAnchors is used, this property will be ignored.

groupId?: string

The group id to be able to interact with multiple nodes at once. If the same group id is specified at the InteractionData of another node, these nodes are treated as being one.

Methods

  • updateVersion(): void
  • Update the version.

    Returns void