mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 07:20:39 +00:00
clamp zoom to the nearest value
This commit is contained in:
parent
153cb9ca51
commit
7b3ccfe6d2
1 changed files with 4 additions and 3 deletions
|
@ -169,9 +169,10 @@ class CameraContainerBloc extends EvSourceBlocBase<CameraContainerEvent, CameraC
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onZoomChanged(ZoomChangedEvent event, Emitter emit) async {
|
Future<void> _onZoomChanged(ZoomChangedEvent event, Emitter emit) async {
|
||||||
if (_cameraController != null && event.value >= _zoomRange!.start && event.value <= _zoomRange!.end) {
|
if (_cameraController != null) {
|
||||||
_cameraController!.setZoomLevel(event.value);
|
final double zoom = event.value.clamp(_zoomRange!.start, _zoomRange!.end);
|
||||||
_currentZoom = event.value;
|
_cameraController!.setZoomLevel(zoom);
|
||||||
|
_currentZoom = zoom;
|
||||||
_emitActiveState(emit);
|
_emitActiveState(emit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue