animateToRange method
Smoothly animate zoom to a fractional range 0..1
Implementation
Future<void> animateToRange(
double start,
double end, {
Duration duration = const Duration(milliseconds: 450),
}) async {
if (_disposed) return;
if (!start.isFinite || !end.isFinite) return;
// Note: Actual animation logic typically lives in the widget layer
// using a Ticker. This method triggers the state change.
final s = start.clamp(0.0, 1.0);
final e = end.clamp(0.0, 1.0);
// Fallback point count if not provided
const totalPoints = 100;
final startIdx = (s * (totalPoints - 1)).round();
final endIdx = (e * (totalPoints - 1)).round();
zoomTo(start: startIdx, end: endIdx);
replay();
}