quickZoomTo method

Future<void> quickZoomTo(
  1. Offset offset,
  2. double scale, {
  3. Duration? duration,
  4. Curve? curve,
})

Quickly toggles zoom in or out based on the current scaleFactor.

If the view is currently zoomed in (scale > 1), this will reset to the default scale and position. Otherwise, it will zoom in to scale centered around the given offset. Uses animation with optional duration and curve.

Implementation

Future<void> quickZoomTo(
  Offset offset,
  double scale, {
  Duration? duration,
  Curve? curve,
}) async {
  if (!_enableInteraction) return;
  if (scaleFactor > 1) {
    await animateZoomToPoint(offset: Offset.zero, scale: 1);
  } else {
    await animateZoomToPoint(offset: -offset, scale: scale);
  }
}