Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Clamp tall mosaic thumbnails

ashil-pilot7e15dad96e18
diff --git a/mobile/apps/photos/lib/models/gallery/mosaic_layout.dart b/mobile/apps/photos/lib/models/gallery/mosaic_layout.dart
index 5a862ec70d..b6958fc1c4 100644
--- a/mobile/apps/photos/lib/models/gallery/mosaic_layout.dart
+++ b/mobile/apps/photos/lib/models/gallery/mosaic_layout.dart
@@ -92,7 +92,7 @@ class MosaicSectionLayout extends SectionLayout {
}
class MosaicLayoutCalculator {
- static const double _minimumAspectRatio = 0.25;
+ static const double _minimumAspectRatio = 1 / 3;
static const double _maximumAspectRatio = 4.0;
static const double _maximumRowHeightFactor = 2.4;
static const double _minimumTileExtentFactor = 0.62;
diff --git a/mobile/apps/photos/test/models/mosaic_layout_test.dart b/mobile/apps/photos/test/models/mosaic_layout_test.dart
index 194fb9bc0d..f4eef1fd8c 100644
--- a/mobile/apps/photos/test/models/mosaic_layout_test.dart
+++ b/mobile/apps/photos/test/models/mosaic_layout_test.dart
@@ -14,7 +14,7 @@ void main() {
test("preserves normal ratios and clamps extreme dimensions", () {
expect(MosaicLayoutCalculator.aspectRatioForDimensions(4, 3), 4 / 3);
- expect(MosaicLayoutCalculator.aspectRatioForDimensions(1, 100), 0.25);
+ expect(MosaicLayoutCalculator.aspectRatioForDimensions(1, 100), 1 / 3);
expect(MosaicLayoutCalculator.aspectRatioForDimensions(100, 1), 4);
});
@@ -98,7 +98,7 @@ void main() {
expect(rows, hasLength(1));
final row = rows.single;
expect(row.height, targetRowHeight);
- expect(row.itemWidths.single / row.height, closeTo(0.25, 1e-9));
+ expect(row.itemWidths.single / row.height, closeTo(1 / 3, 1e-9));
expect(row.itemWidths.single, lessThan(availableWidth));
});