mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 07:20:39 +00:00
fixed shutter speed anchor issue
This commit is contained in:
parent
0713527cfa
commit
200812758d
1 changed files with 21 additions and 3 deletions
|
@ -146,8 +146,26 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
|||
List<ExposurePair> _buildExposureValues(double ev) {
|
||||
/// Depending on the `stopType` the exposure pairs list length is multiplied by 1,2 or 3
|
||||
final int evSteps = (ev * (stopType.index + 1)).round();
|
||||
final int evOffset =
|
||||
_shutterSpeedValues.indexOf(const ShutterSpeedValue(1, false, StopType.full)) - evSteps;
|
||||
|
||||
/// Basically we use 1" shutter speed as an anchor point for building the exposure pairs list.
|
||||
/// But user can exclude this value from the list using custom equipment profile.
|
||||
/// So we have to restore the index of the anchor value.
|
||||
const ShutterSpeedValue anchorShutterSpeed = ShutterSpeedValue(1, false, StopType.full);
|
||||
int anchorIndex = _shutterSpeedValues.indexOf(anchorShutterSpeed);
|
||||
if (anchorIndex < 0) {
|
||||
final filteredFullList = shutterSpeedValues.whereStopType(stopType);
|
||||
final customListStartIndex = filteredFullList.indexOf(_shutterSpeedValues.first);
|
||||
final fullListAnchor = filteredFullList.indexOf(anchorShutterSpeed);
|
||||
if (customListStartIndex < fullListAnchor) {
|
||||
/// This means, that user excluded anchor value at the end,
|
||||
/// i.e. all shutter speed values are shorter than 1".
|
||||
anchorIndex = fullListAnchor - customListStartIndex;
|
||||
} else {
|
||||
/// In case user excludes anchor value at the start,
|
||||
/// we can do no adjustment.
|
||||
}
|
||||
}
|
||||
final int evOffset = anchorIndex - evSteps;
|
||||
|
||||
late final int apertureOffset;
|
||||
late final int shutterSpeedOffset;
|
||||
|
|
Loading…
Reference in a new issue