applyDragTransform function
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,
);
}