Skip to content

Finite and infinite canvas

Loading interactive example…Open in new tab ↗
Opening the live canvas…

Choose Bounded, then Far away. The camera clamps the requested position to the finite world bounds. Switch to Infinite and repeat: the camera can leave the drawing behind. Fit returns to the document contents.

The finite region is (-240, -160, 1000, 600) in world coordinates. It constrains camera navigation; it is not a parent frame and does not rewrite, clip or delete document elements. A viewport larger than the bounded region can pan within the range that keeps the region covered, as defined by the shared camera policy.

Configuration and camera changes do not enter document undo history. Use an owning frame's clipping grammar when the document itself needs clipped content.

See Canvas API and Navigation.

Source

dart
actions: {
  'Bounded': (session) => session.setConfiguration(
    session.canvasConfiguration.copyWith(
      canvasPolicy: const FiniteCanvasPolicy(exampleWorldBounds),
    ),
  ),
  'Infinite': (session) => session.setConfiguration(
    session.canvasConfiguration.copyWith(
      canvasPolicy: const InfiniteCanvasPolicy(),
    ),
  ),
  'Far away': (session) =>
      session.navigateToPoint(const DiagramPoint(4000, 4000), zoom: 1),
},