LazyCanvasController constructor

LazyCanvasController({
  1. double? minScale,
  2. double? maxScale,
  3. bool debug = false,
  4. double buildExtentMultiplier = 2,
  5. Size hashCellSize = const Size(100, 100),
  6. Duration defaultAnimationDuration = const Duration(milliseconds: 300),
  7. bool inertiaEnabled = true,
  8. double inertiaFrictionCoefficient = 0.0000135,
  9. CanvasBackground background = const DotGridBackground(),
  10. bool useIdsFromArgs = false,
  11. OnWidgetEnteredRender? onWidgetEnteredRender,
  12. OnWidgetExitedRender? onWidgetExitedRender,
  13. PointerSignalEventListener? rawPointerSignalListener,
  14. PointerDownEventListener? rawPointerDownListener,
  15. PointerMoveEventListener? rawPointerMoveListener,
  16. PointerUpEventListener? rawPointerUpListener,
  17. PointerCancelEventListener? rawPointerCancelListener,
})

Supplied zoom limits must be finite, positive, and ordered. The initial scale of 1 is clamped to these limits.

Implementation

LazyCanvasController({
  this.minScale,
  this.maxScale,
  this.debug = false,
  this.buildExtentMultiplier = 2,
  Size hashCellSize = const Size(100, 100),
  this.defaultAnimationDuration = const Duration(milliseconds: 300),
  this.inertiaEnabled = true,
  this.inertiaFrictionCoefficient = 0.0000135,
  CanvasBackground background = const DotGridBackground(),
  this.useIdsFromArgs = false,
  this.onWidgetEnteredRender,
  this.onWidgetExitedRender,
  this.rawPointerSignalListener,
  this.rawPointerDownListener,
  this.rawPointerMoveListener,
  this.rawPointerUpListener,
  this.rawPointerCancelListener,
}) : assert(buildExtentMultiplier >= 1),
     assert(inertiaFrictionCoefficient > 0 && inertiaFrictionCoefficient < 1),
     _background = background,
     _spatialHash = SpatialHashing<CanvasChildId>(cellSize: hashCellSize) {
  if (minScale != null && (!minScale!.isFinite || minScale! <= 0)) {
    throw ArgumentError.value(
      minScale,
      'minScale',
      'Must be finite and positive',
    );
  }
  if (maxScale != null && (!maxScale!.isFinite || maxScale! <= 0)) {
    throw ArgumentError.value(
      maxScale,
      'maxScale',
      'Must be finite and positive',
    );
  }
  if (minScale != null && maxScale != null && minScale! > maxScale!) {
    throw ArgumentError.value(
      maxScale,
      'maxScale',
      'Must be at least minScale',
    );
  }
  _baseScale = _scale = _clampScale(1);
}