AutoPanConfig class

Configuration for autopan behavior during drag operations.

When a dragged element (node, annotation, or connection) approaches the edge of the viewport, autopan automatically pans the viewport to reveal more canvas, allowing continued dragging beyond the current visible area.

Basic Usage

// Use default configuration
NodeFlowConfig(
  autoPan: AutoPanConfig.normal,
)

// Custom configuration with uniform padding
NodeFlowConfig(
  autoPan: AutoPanConfig(
    edgePadding: EdgeInsets.all(60.0),
    panAmount: 15.0,
    useProximityScaling: true,
  ),
)

// Custom configuration with per-edge padding
NodeFlowConfig(
  autoPan: AutoPanConfig(
    edgePadding: EdgeInsets.only(
      left: 50.0,
      right: 50.0,
      top: 30.0,
      bottom: 80.0,  // Larger to avoid bottom toolbar
    ),
    panAmount: 10.0,
  ),
)

Edge Detection Zones

┌─────────────────────────────────────────────┐
│░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░│ ← edgePadding.top
│░░┌─────────────────────────────────────┐░░░░│
│░░│                                     │░░░░│
│░░│         Safe area (no pan)          │░░░░│
│░░│                                     │░░░░│
│░░└─────────────────────────────────────┘░░░░│
│░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░│ ← edgePadding.bottom
└─────────────────────────────────────────────┘
 ↑                                           ↑
 edgePadding.left               edgePadding.right

Constructors

AutoPanConfig({EdgeInsets edgePadding = const EdgeInsets.all(50.0), double panAmount = 10.0, Duration panInterval = const Duration(milliseconds: 16), bool useProximityScaling = false, Curve? speedCurve})
Creates an autopan configuration.
const

Properties

edgePadding EdgeInsets
Distance from each viewport edge (in screen pixels) where autopan activates.
final
hashCode int
The hash code for this object.
no setteroverride
isEnabled bool
Whether autopan is effectively enabled.
no setter
panAmount double
Base pan amount per tick in graph units.
final
panInterval Duration
Duration between pan ticks.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
speedCurve Curve?
Curve for proximity-based speed scaling.
final
useProximityScaling bool
Whether to scale pan speed based on proximity to the edge.
final

Methods

calculatePanAmount(double proximity, {required double edgePaddingValue}) double
Calculates the scaled pan amount based on proximity to a specific edge.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override

Constants

defaultConfig → const AutoPanConfig
Alias for normal configuration.
fast → const AutoPanConfig
Fast panning configuration for large canvases.
normal → const AutoPanConfig
Normal autopan configuration suitable for most use cases.
precise → const AutoPanConfig
Slow, precise panning configuration.