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
NodeFlowConfig(
  autoPan: AutoPanConfig(
    edgePadding: 60.0,
    panAmount: 15.0,
    useProximityScaling: true,
  ),
)

Edge Detection Zones

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

Constructors

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

Properties

edgePadding double
Distance from 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) double
Calculates the scaled pan amount based on proximity to 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.