Skip to content

Commit

Permalink
clamp zoom to the nearest value
Browse files Browse the repository at this point in the history
  • Loading branch information
vodemn committed Apr 6, 2024
1 parent 153cb9c commit 7b3ccfe
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@ class CameraContainerBloc extends EvSourceBlocBase<CameraContainerEvent, CameraC
}

Future<void> _onZoomChanged(ZoomChangedEvent event, Emitter emit) async {
if (_cameraController != null && event.value >= _zoomRange!.start && event.value <= _zoomRange!.end) {
_cameraController!.setZoomLevel(event.value);
_currentZoom = event.value;
if (_cameraController != null) {
final double zoom = event.value.clamp(_zoomRange!.start, _zoomRange!.end);
_cameraController!.setZoomLevel(zoom);
_currentZoom = zoom;
_emitActiveState(emit);
}
}
Expand Down

0 comments on commit 7b3ccfe

Please sign in to comment.