setNodePosition method
Sets a node's position to an absolute position.
The position will be automatically snapped to the grid if snap-to-grid is enabled in the controller's configuration.
Example:
controller.setNodePosition('node1', Offset(200, 150));
Implementation
void setNodePosition(String nodeId, Offset position) {
final node = _nodes[nodeId];
if (node != null) {
final previousPosition = node.position.value;
runInAction(() {
node.position.value = position;
node.setVisualPosition(_config.snapToGridIfEnabled(position));
});
internalMarkNodeDirty(nodeId);
// Emit extension event
_emitEvent(NodeMoved<T>(node, previousPosition));
}
}