CanvasViewport class

Represents the viewport state of the canvas.

The viewport defines what portion of the infinite canvas is currently visible, including the pan offset and zoom level.

Constructors

CanvasViewport({Offset offset = Offset.zero, double zoom = 1.0})
Creates a canvas viewport.
const
CanvasViewport.fromJson(Map<String, dynamic> json)
Creates a viewport from JSON.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
offset → Offset
The pan offset of the viewport (in logical pixels).
final
props → List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stringify → bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
transformMatrix → Matrix4
Returns the transformation matrix for this viewport.
no setter
zoom → double
The current zoom level.
final

Methods

canvasToScreen(Offset canvasPoint) → Offset
Transforms a point from canvas coordinates to screen coordinates.
copyWith({Offset? offset, double? zoom}) → CanvasViewport
Creates a copy of this viewport with optional new values.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
screenToCanvas(Offset screenPoint) → Offset
Transforms a point from screen coordinates to canvas coordinates.
toJson() → Map<String, dynamic>
Converts this viewport to JSON.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited