onScaleUpdate method

void onScaleUpdate(
  1. ScaleUpdateDetails details
)

Called when a scale gesture updates. Usually you would not want to override this

Implementation

void onScaleUpdate(ScaleUpdateDetails details) {
  // uses usual display conventions and final vector postion - initial vector position
  // convention is that if I drag from right to left, dx is negative
  // for top to bottom, dy is postive

  // scale + offset => scale then offset

  if (details.scale != 1) {
    _scaledDuringGesture = true;
    final newScale = _baseScale * details.scale;
    _gsTopLeftOffset = newGsTopLeftOnScaling(
      _gsTopLeftOffset,
      details.localFocalPoint,
      _scale,
      newScale,
    );
    _scale = newScale;
  }

  if (details.focalPointDelta != Offset.zero) {
    // if ss distnace is x, and zoom is 2x, gs only moves by x/2
    _gsTopLeftOffset -= details.focalPointDelta / _scale;
  }

  markDirty();
}