copyWith method

GraphViewport copyWith({
  1. double? x,
  2. double? y,
  3. double? zoom,
})

Creates a new viewport with updated values.

Returns a copy of this viewport with the specified properties changed. Unspecified properties retain their current values.

Example:

final viewport = GraphViewport(x: 100, y: 50, zoom: 1.0);
final zoomed = viewport.copyWith(zoom: 2.0);
// New viewport: x=100, y=50, zoom=2.0

Implementation

GraphViewport copyWith({double? x, double? y, double? zoom}) {
  return GraphViewport(
    x: x ?? this.x,
    y: y ?? this.y,
    zoom: zoom ?? this.zoom,
  );
}