zoomInOut method

zoomInOut Positions a node with a zoom effect of type AwsNodeZoomInOutNodesSpace.

This function takes a node of type AwsNodeZoomInOutNodesSpace and places it at a specific position on the screen. Calculates the position based on the offset provided in the node and the dimensions of the zoomIn and zoomOut effect. Returns a Positioned widget containing the node with the zoom effect correctly positioned.

Implementation

Positioned zoomInOut(AwsNodeZoomInOutNodesSpace node) {
  return Positioned(
    left: node.offset.dx - (node.zoomOut.width / 2),
    top: node.offset.dy - (node.zoomOut.height / 2),
    child: Draggable(
      feedback: Container(),
      child: _AwsDetectorZoomInOutMoveNodesSpace(
        // This method updates the position of the node when it moves.
        onChanged: (Offset offset) => updateNode(node.id, offset),
        node: node,
        // Calls the [hover] function if it is defined on the node when the state of [hover] changes.
        hover: (bool state) => node.hover?.call(state),
      ),
    ),
  );
}