refitCamera method

void refitCamera({
  1. Curve? curve,
  2. Duration? duration,
})

Re-target the camera at the current fit rect + crop rect without changing either — the crop editor calls this after a handle-drag confirm / aspect snap so the (new) crop rect refills the surface. curve/duration select the animation feel (TgSpring for the telegram evenlyFill confirm).

Implementation

void refitCamera({Curve? curve, Duration? duration}) {
  final src = sourceSize;
  final rect = fitRect.value;
  if (src == null || rect.isEmpty) return;
  cameraAnimator
      .animate(
        target: _fitOf(rect, _cameraContentRect),
        curve: curve,
        duration: duration ?? kAnimation,
      )
      .unawaited();
}