calculateFinalDestinationRect method

Rect calculateFinalDestinationRect(
  1. Rect layoutRect,
  2. Rect destinationRect
)

Implementation

Rect calculateFinalDestinationRect(Rect layoutRect, Rect destinationRect) {
  final bool destinationRectChanged = rawDestinationRect != destinationRect;

  rawDestinationRect = destinationRect;

  final Offset? temp = offset;
  _innerCalculateFinalDestinationRect(layoutRect, destinationRect);
  offset = temp;
  Rect result =
      _innerCalculateFinalDestinationRect(layoutRect, destinationRect);

  ///first call,initial image rect with alignment
  if (totalScale! > 1.0 &&
      destinationRectChanged &&
      initialAlignment != null) {
    offset = _getFixedOffset(destinationRect,
        result.center + _getCenterDif(result, layoutRect, initialAlignment));
    result = _innerCalculateFinalDestinationRect(layoutRect, destinationRect);
    //initialAlignment = null;
  }
  this.destinationRect = result;
  this.layoutRect = layoutRect;
  return result;
}