From f1f8d74338d3911f87c12749de0c5bc9701957ca Mon Sep 17 00:00:00 2001 From: Vadim <44135514+vodemn@users.noreply.github.com> Date: Fri, 5 May 2023 23:32:17 +0200 Subject: [PATCH] ML-59 ND filter value is not applied on measure (#60) --- lib/screens/metering/bloc_metering.dart | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/screens/metering/bloc_metering.dart b/lib/screens/metering/bloc_metering.dart index 5b0d584..95448e5 100644 --- a/lib/screens/metering/bloc_metering.dart +++ b/lib/screens/metering/bloc_metering.dart @@ -33,7 +33,7 @@ class MeteringBloc extends Bloc { late IsoValue _iso = _userPreferencesService.iso; late NdValue _nd = _userPreferencesService.ndFilter; late Film _film = _userPreferencesService.film; - double _ev = 0.0; + double _ev100 = 0.0; bool _isMeteringInProgress = false; MeteringBloc( @@ -90,14 +90,12 @@ class MeteringBloc extends Bloc { /// doesn't contain currently selected value if (!event.equipmentProfileData.isoValues.any((v) => _iso.value == v.value)) { _userPreferencesService.iso = event.equipmentProfileData.isoValues.first; - _ev = _ev + log2(event.equipmentProfileData.isoValues.first.value / _iso.value); _iso = event.equipmentProfileData.isoValues.first; } /// The same for ND filter if (!event.equipmentProfileData.ndValues.any((v) => _nd.value == v.value)) { _userPreferencesService.ndFilter = event.equipmentProfileData.ndValues.first; - _ev = _ev - event.equipmentProfileData.ndValues.first.stopReduction + _nd.stopReduction; _nd = event.equipmentProfileData.ndValues.first; } @@ -122,14 +120,12 @@ class MeteringBloc extends Bloc { _film = Film.values.first; } _userPreferencesService.iso = event.isoValue; - _ev = _ev + log2(event.isoValue.value / _iso.value); _iso = event.isoValue; _emitMeasuredState(emit); } void _onNdChanged(NdChangedEvent event, Emitter emit) { _userPreferencesService.ndFilter = event.ndValue; - _ev = _ev - event.ndValue.stopReduction + _nd.stopReduction; _nd = event.ndValue; _emitMeasuredState(emit); } @@ -143,25 +139,26 @@ class MeteringBloc extends Bloc { void _onMeasured(MeasuredEvent event, Emitter emit) { _meteringInteractor.responseVibration(); - _ev = event.ev100 + log2(_iso.value / 100); + _ev100 = event.ev100; _emitMeasuredState(emit); } void _emitMeasuredState(Emitter emit) { + final ev = _ev100 + log2(_iso.value / 100) - _nd.stopReduction; emit(_isMeteringInProgress ? MeteringInProgressState( - ev: _ev, + ev: ev, film: _film, iso: _iso, nd: _nd, - exposurePairs: _buildExposureValues(_ev), + exposurePairs: _buildExposureValues(ev), ) : MeteringEndedState( - ev: _ev, + ev: ev, film: _film, iso: _iso, nd: _nd, - exposurePairs: _buildExposureValues(_ev), + exposurePairs: _buildExposureValues(ev), )); }