zoomTo method
Sets the viewport zoom to a specific value.
The zoom is clamped to the min/max zoom values configured in NodeFlowConfig.
Unlike zoomBy, this sets an absolute zoom level rather than a relative change.
Parameters:
zoom: The target zoom level (1.0 = 100%, 2.0 = 200%, etc.)
Example:
controller.zoomTo(1.5); // Set zoom to 150%
controller.zoomTo(1.0); // Reset zoom to 100%
Implementation
void zoomTo(double zoom) {
final clampedZoom = zoom.clamp(
_config.minZoom.value,
_config.maxZoom.value,
);
final currentVp = _viewport.value;
setViewport(
GraphViewport(x: currentVp.x, y: currentVp.y, zoom: clampedZoom),
);
}