bringNodeToFront method

void bringNodeToFront(
  1. String nodeId
)

Brings a node to the front of the z-order (renders on top of all other nodes).

Sets the node's z-index to be higher than all other nodes.

Parameters:

  • nodeId: The ID of the node to bring to front

Example:

controller.bringNodeToFront('node1');

Implementation

void bringNodeToFront(String nodeId) {
  final node = _nodes[nodeId];
  if (node != null) {
    runInAction(() {
      // Set to highest z-index
      final maxZIndex = _nodes.values
          .map((n) => n.zIndex.value)
          .fold(0, math.max);
      node.zIndex.value = maxZIndex + 1;
    });
  }
}