Skip to content

armgit / ente

Public Imported from GitHub
0

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

Disable super cluster zoom behavior on mobile in trip layout

anandbaburajan32eaba851283
diff --git a/web/apps/photos/src/components/TripLayout/index.tsx b/web/apps/photos/src/components/TripLayout/index.tsx
index 40d6ce1d91..3957bd4e8d 100644
--- a/web/apps/photos/src/components/TripLayout/index.tsx
+++ b/web/apps/photos/src/components/TripLayout/index.tsx
@@ -219,14 +219,13 @@ export const TripLayout: React.FC<TripLayoutProps> = ({
setPhotoClusters(sortedClusters);
- // Check if first location is in a super cluster and adjust initial zoom
+ // Check if first location is in a super cluster and adjust initial zoom (desktop only)
const firstLocationInSuperCluster =
clusterToSuperClusterMap.has(0);
- const initialZoom = firstLocationInSuperCluster
- ? isMobileOrTablet
- ? 15
- : 14 // Super cluster zoom level
- : optimalZoomLevel;
+ const initialZoom =
+ firstLocationInSuperCluster && !isMobileOrTablet
+ ? 14 // Super cluster zoom level (desktop only)
+ : optimalZoomLevel;
setOptimalZoom(initialZoom);
setSuperClusterInfo({
diff --git a/web/apps/photos/src/components/TripLayout/utils/scrollUtils.ts b/web/apps/photos/src/components/TripLayout/utils/scrollUtils.ts
index 28a307158e..059bd1a28c 100644
--- a/web/apps/photos/src/components/TripLayout/utils/scrollUtils.ts
+++ b/web/apps/photos/src/components/TripLayout/utils/scrollUtils.ts
@@ -179,15 +179,19 @@ export const handleTimelineScroll = ({
const targetZoom = isMobileOrTablet ? 8 : 10; // Touch device-aware zoom level
// Get super cluster info for both source and destination
+ // On mobile, disable super cluster zoom behavior
const currentSuperClusterIndex =
- superClusterInfo.clusterToSuperClusterMap.get(
- currentActiveLocationIndex,
- ) ?? -1;
+ !isMobileOrTablet
+ ? (superClusterInfo.clusterToSuperClusterMap.get(
+ currentActiveLocationIndex,
+ ) ?? -1)
+ : -1;
const isInSuperCluster = currentSuperClusterIndex !== -1;
// Get the super cluster index of where we're coming FROM (not the stored state)
+ // On mobile, disable super cluster zoom behavior
const fromSuperClusterIndex =
- previousActiveLocationIndex >= 0
+ previousActiveLocationIndex >= 0 && !isMobileOrTablet
? (superClusterInfo.clusterToSuperClusterMap.get(
previousActiveLocationIndex,
) ?? -1)
@@ -585,8 +589,9 @@ export const handleMarkerClick = ({
}
// Check if both current and target locations are in the same super cluster
+ // On mobile, disable super cluster zoom behavior
let shouldJustPan = false;
- if (superClusterInfo && currentActiveLocationIndex >= 0) {
+ if (superClusterInfo && currentActiveLocationIndex >= 0 && !isMobileOrTablet) {
const currentSuperClusterIndex =
superClusterInfo.clusterToSuperClusterMap.get(
currentActiveLocationIndex,
@@ -628,10 +633,13 @@ export const handleMarkerClick = ({
};
} else {
// Check if the target cluster is part of a super cluster
+ // On mobile, disable super cluster zoom behavior
const targetSuperClusterIndex =
- superClusterInfo?.clusterToSuperClusterMap.get(
- clusterIndex,
- );
+ !isMobileOrTablet
+ ? superClusterInfo?.clusterToSuperClusterMap.get(
+ clusterIndex,
+ )
+ : undefined;
const isInSuperCluster = targetSuperClusterIndex !== undefined;
if (isInSuperCluster) {