From 8f3dd106de460015ff1faee22677a7bdf2fda4ee Mon Sep 17 00:00:00 2001
From: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com>
Date: Fri, 15 Nov 2024 07:29:10 +0100
Subject: [PATCH] fix(web): don't refresh panorama viewer when modifying asset
---
.../asset-viewer/asset-viewer.svelte | 4 +-
.../asset-viewer/image-panorama-viewer.svelte | 32 +++++++++++
.../asset-viewer/panorama-viewer.svelte | 54 -------------------
.../photo-sphere-viewer-adapter.svelte | 2 +-
.../asset-viewer/video-panorama-viewer.svelte | 29 ++++++++++
.../asset-viewer/video-wrapper-viewer.svelte | 5 +-
6 files changed, 66 insertions(+), 60 deletions(-)
create mode 100644 web/src/lib/components/asset-viewer/image-panorama-viewer.svelte
delete mode 100644 web/src/lib/components/asset-viewer/panorama-viewer.svelte
create mode 100644 web/src/lib/components/asset-viewer/video-panorama-viewer.svelte
diff --git a/web/src/lib/components/asset-viewer/asset-viewer.svelte b/web/src/lib/components/asset-viewer/asset-viewer.svelte
index 988707cfa7413..79b61d3a30191 100644
--- a/web/src/lib/components/asset-viewer/asset-viewer.svelte
+++ b/web/src/lib/components/asset-viewer/asset-viewer.svelte
@@ -43,10 +43,10 @@
import DetailPanel from './detail-panel.svelte';
import CropArea from './editor/crop-tool/crop-area.svelte';
import EditorPanel from './editor/editor-panel.svelte';
- import PanoramaViewer from './panorama-viewer.svelte';
import PhotoViewer from './photo-viewer.svelte';
import SlideshowBar from './slideshow-bar.svelte';
import VideoViewer from './video-wrapper-viewer.svelte';
+ import ImagePanoramaViewer from './image-panorama-viewer.svelte';
interface Props {
assetStore?: AssetStore | null;
@@ -510,7 +510,7 @@
{:else if asset.exifInfo?.projectionType === ProjectionType.EQUIRECTANGULAR || (asset.originalPath && asset.originalPath
.toLowerCase()
.endsWith('.insp'))}
-
+
{:else if isShowEditor && selectedEditType === 'crop'}
{:else}
diff --git a/web/src/lib/components/asset-viewer/image-panorama-viewer.svelte b/web/src/lib/components/asset-viewer/image-panorama-viewer.svelte
new file mode 100644
index 0000000000000..6da8cc33d3bc9
--- /dev/null
+++ b/web/src/lib/components/asset-viewer/image-panorama-viewer.svelte
@@ -0,0 +1,32 @@
+
+
+
+ {#await Promise.all([loadAssetData(asset.id), import('./photo-sphere-viewer-adapter.svelte')])}
+
+ {:then [data, { default: PhotoSphereViewer }]}
+
+ {:catch}
+ {$t('errors.failed_to_load_asset')}
+ {/await}
+
diff --git a/web/src/lib/components/asset-viewer/panorama-viewer.svelte b/web/src/lib/components/asset-viewer/panorama-viewer.svelte
deleted file mode 100644
index b17f9fdea77d2..0000000000000
--- a/web/src/lib/components/asset-viewer/panorama-viewer.svelte
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
- {#await Promise.all([loadAssetData(), import('./photo-sphere-viewer-adapter.svelte'), ...photoSphereConfigs])}
-
- {:then [data, module, adapter, plugins, navbar]}
-
- {:catch}
- {$t('errors.failed_to_load_asset')}
- {/await}
-
diff --git a/web/src/lib/components/asset-viewer/photo-sphere-viewer-adapter.svelte b/web/src/lib/components/asset-viewer/photo-sphere-viewer-adapter.svelte
index c18e6bd14bd1e..0c8f76a01ed7a 100644
--- a/web/src/lib/components/asset-viewer/photo-sphere-viewer-adapter.svelte
+++ b/web/src/lib/components/asset-viewer/photo-sphere-viewer-adapter.svelte
@@ -12,7 +12,7 @@
interface Props {
panorama: string | { source: string };
- originalImageUrl: string | null;
+ originalImageUrl?: string;
adapter?: AdapterConstructor | [AdapterConstructor, unknown];
plugins?: (PluginConstructor | [PluginConstructor, unknown])[];
navbar?: boolean;
diff --git a/web/src/lib/components/asset-viewer/video-panorama-viewer.svelte b/web/src/lib/components/asset-viewer/video-panorama-viewer.svelte
new file mode 100644
index 0000000000000..73315d661ed49
--- /dev/null
+++ b/web/src/lib/components/asset-viewer/video-panorama-viewer.svelte
@@ -0,0 +1,29 @@
+
+
+
+ {#await modules}
+
+ {:then [PhotoSphereViewer, adapter, videoPlugin]}
+
+ {:catch}
+ {$t('errors.failed_to_load_asset')}
+ {/await}
+
diff --git a/web/src/lib/components/asset-viewer/video-wrapper-viewer.svelte b/web/src/lib/components/asset-viewer/video-wrapper-viewer.svelte
index 3ee4791b073db..7ee21e59a237b 100644
--- a/web/src/lib/components/asset-viewer/video-wrapper-viewer.svelte
+++ b/web/src/lib/components/asset-viewer/video-wrapper-viewer.svelte
@@ -1,8 +1,7 @@
{#if projectionType === ProjectionType.EQUIRECTANGULAR}
-