applyDragTransform function

Rect applyDragTransform({
  1. required Offset newCenter,
  2. required Rect baseRect,
  3. required double aspectRatio,
  4. required double scaleFactor,
})

Pure rect-construction helper. Takes the final per-axis newCenter (already decided by the caller's routing — scaleResponse center, anchor center, or friction-translated current center) and the final scaleFactor (multiplier on baseRect's width). Builds the new rect centered at newCenter with newWidth = baseRect.width * scaleFactor, newHeight = newWidth / aspectRatio.

Implementation

Rect applyDragTransform({
  required Offset newCenter,
  required Rect baseRect,
  required double aspectRatio,
  required double scaleFactor,
}) {
  final newWidth = baseRect.width * scaleFactor;
  final newHeight = newWidth / aspectRatio;
  return Rect.fromCenter(
    center: newCenter,
    width: newWidth,
    height: newHeight,
  );
}