onPinchZoom method
Unified atomic pinch-to-zoom & pan method.
Smoothly adjusts candleWidth clamped to 1.5, 60.0 while anchoring the zoom
around focalPoint and translating by panDeltaX, preserving focal stability
identical to TradingView.
Implementation
void onPinchZoom(double scaleFactor, Offset focalPoint, double panDeltaX) {
_applyPinchZoom(scaleFactor, focalPoint, panDeltaX);
if (_syncGroup != null &&
!_isReceivingSync &&
_viewport.viewportWidth > 0) {
final ratio = (focalPoint.dx / _viewport.viewportWidth).clamp(0.0, 1.0);
_syncGroup!.broadcastZoom(
source: this,
scaleFactor: scaleFactor,
focalPointRatio: ratio,
);
}
}