From 5e1c00a3e9a8bf346c1c47141fc185e471df9e13 Mon Sep 17 00:00:00 2001
From: Innei
Date: Thu, 5 Jun 2025 18:31:23 +0800
Subject: [PATCH] fix: first load thumbnail transition
- Removed the loading progress percentage display from the LoadingIndicator component.
- Updated the ProgressiveImage component to manage thumbnail loading state with a new useState hook.
- Adjusted the thumbnail image rendering to transition opacity based on loading state.
Signed-off-by: Innei
---
.../ui/photo-viewer/LoadingIndicator.tsx | 3 ---
.../ui/photo-viewer/ProgressiveImage.tsx | 21 +++++++++----------
2 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/apps/web/src/components/ui/photo-viewer/LoadingIndicator.tsx b/apps/web/src/components/ui/photo-viewer/LoadingIndicator.tsx
index 77ad6f38..e14a75c9 100644
--- a/apps/web/src/components/ui/photo-viewer/LoadingIndicator.tsx
+++ b/apps/web/src/components/ui/photo-viewer/LoadingIndicator.tsx
@@ -79,9 +79,6 @@ export const LoadingIndicator = ({
{loadingState.codecInfo}
)}
-
- {Math.round(loadingState.loadingProgress)}%
-
>
) : (
<>
diff --git a/apps/web/src/components/ui/photo-viewer/ProgressiveImage.tsx b/apps/web/src/components/ui/photo-viewer/ProgressiveImage.tsx
index 69033d73..4f932173 100644
--- a/apps/web/src/components/ui/photo-viewer/ProgressiveImage.tsx
+++ b/apps/web/src/components/ui/photo-viewer/ProgressiveImage.tsx
@@ -69,7 +69,7 @@ export const ProgressiveImage = ({
const thumbnailRef = useRef(null)
const transformRef = useRef(null)
- const thumbnailAnimateController = useAnimationControls()
+
const loadingIndicatorRef = useRef(null)
const imageLoaderManagerRef = useRef(null)
@@ -139,11 +139,11 @@ export const ProgressiveImage = ({
[onZoomChange],
)
+ const [isThumbnailLoaded, setIsThumbnailLoaded] = useState(false)
+
const handleThumbnailLoad = useCallback(() => {
- thumbnailAnimateController.start({
- opacity: 1,
- })
- }, [thumbnailAnimateController])
+ setIsThumbnailLoaded(true)
+ }, [])
const showContextMenu = useShowContextMenu()
@@ -167,16 +167,15 @@ export const ProgressiveImage = ({
{/* 缩略图 */}
{thumbnailSrc && (
-
)}