DiagramCamera class final
Viewport mathematics and navigation over one controller's camera.
The camera keeps no state of its own: it reads
DiagramController.camera and moves through
DiagramController.setCamera, which keeps a fit canvas over the content
and its padding. onNavigate runs before each move
this camera makes, so a surface can stop its own animation first.
Constructors
- DiagramCamera(DiagramController controller, {})
- DiagramCamera.fixed(DiagramCameraState state)
-
A camera fixed at
state, for painting offscreen. It cannot move.
Properties
- bounds → CanvasBounds
-
The diagram's canvas bounds.
no setter
- changes → Listenable
-
Notifies after each change of state.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → DiagramCameraState
-
no setter
- visibleWorldBounds → DiagramRect
-
no setter
Methods
-
fitBounds(
DiagramRect bounds, {double padding = 48}) → void -
fitWidth(
DiagramRect bounds, {double padding = 48}) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
panByScreenDelta(
DiagramPoint delta) → void -
panZoom(
{required DiagramPoint fromFocalPoint, required DiagramPoint toFocalPoint, required double scaleFactor}) → void - Publishes one camera state for a combined pan and pinch sample.
-
screenToWorld(
DiagramPoint screen) → DiagramPoint -
setCenter(
DiagramPoint center) → void -
setState(
DiagramCameraState state) → void -
setViewport(
DiagramSize viewportSize) → void -
setZoom(
double zoom) → void -
showAtActualSize(
DiagramRect bounds, {double padding = 48, double top = 0}) → void -
Shows
boundsat 100%: whole, centered, when they fit withpaddingaround them, and otherwise scrolled to their start, the top left, with the person left to zoom out.topis room in pixels the host keeps over the canvas, such as a floating toolbar. It never zooms in. -
toString(
) → String -
A string representation of this object.
inherited
-
worldToScreen(
DiagramPoint world) → DiagramPoint -
zoomAt(
DiagramPoint screenFocalPoint, double scaleFactor) → void -
zoomBy(
double factor) → void -
Zooms by
factorabout the center of the viewport.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited