fix(mobile): switch to new OpenAPI int in RotateParameters (#31246)

This commit is contained in:
Adam Gastineau
2026-09-03 14:32:01 +00:00
committed by GitHub
parent 399217bf5f
commit 6d85f202f4
3 changed files with 11 additions and 12 deletions
@@ -11,16 +11,16 @@ abstract final class ExifDtoConverter {
timeZone: dto.timeZone.orElse(null),
dateTimeOriginal: dto.dateTimeOriginal.orElse(null),
isFlipped: isOrientationFlipped(dto.orientation.orElse(null)),
latitude: dto.latitude.orElse(null)?.toDouble(),
longitude: dto.longitude.orElse(null)?.toDouble(),
latitude: dto.latitude.orElse(null),
longitude: dto.longitude.orElse(null),
city: dto.city.orElse(null),
state: dto.state.orElse(null),
country: dto.country.orElse(null),
make: dto.make.orElse(null),
model: dto.model.orElse(null),
lens: dto.lensModel.orElse(null),
f: dto.fNumber.orElse(null)?.toDouble(),
mm: dto.focalLength.orElse(null)?.toDouble(),
f: dto.fNumber.orElse(null),
mm: dto.focalLength.orElse(null),
iso: dto.iso.orElse(null),
exposureSeconds: exposureTimeToSeconds(dto.exposureTime.orElse(null)),
);
@@ -43,7 +43,7 @@ class EditorProvider extends Notifier<EditorState> {
flipVertical: transform.mirrorVertical,
);
_animateRotation(transform.rotation.toInt(), duration: Duration.zero);
_animateRotation(transform.rotation, duration: Duration.zero);
}
void _animateRotation(int angle, {Duration duration = const Duration(milliseconds: 300)}) {
+6 -7
View File
@@ -45,7 +45,7 @@ bool isCloseToZero(double value, [double epsilon = 1e-15]) {
return value.abs() < epsilon;
}
typedef NormalizedTransform = ({double rotation, bool mirrorHorizontal, bool mirrorVertical});
typedef NormalizedTransform = ({int rotation, bool mirrorHorizontal, bool mirrorVertical});
NormalizedTransform normalizeTransformEdits(List<AssetEdit> edits) {
final matrix = buildAffineFromEdits(edits);
@@ -55,11 +55,10 @@ NormalizedTransform normalizeTransformEdits(List<AssetEdit> edits) {
final double c = matrix.c;
final double d = matrix.d;
final rotation = ((isCloseToZero(a) ? asin(c) : acos(a)) * 180) / pi;
final degrees = ((isCloseToZero(a) ? asin(c) : acos(a)) * 180) / pi;
return (
rotation: rotation < 0 ? 360 + rotation : rotation,
mirrorHorizontal: false,
mirrorVertical: isCloseToZero(a) ? b == c : a == -d,
);
// We only allow 90 degree increments
final quarterTurns = (degrees / 90).round() % 4;
return (rotation: quarterTurns * 90, mirrorHorizontal: false, mirrorVertical: isCloseToZero(a) ? b == c : a == -d);
}