diff --git a/src/components/project/virtual-sample/Interactive360.vue b/src/components/project/virtual-sample/Interactive360.vue index c81c21f..264b11d 100644 --- a/src/components/project/virtual-sample/Interactive360.vue +++ b/src/components/project/virtual-sample/Interactive360.vue @@ -35,22 +35,6 @@ const virtualSampleStore = useVirtualSampleStore(); const isHelperHidden = ref(localStorage.getItem("isHelperHidden")); localStorage.setItem("isHelperHidden", true); -// Images preload -const imageUrls = computed(() => activeTrack.files.map((file) => file.url)); -watch( - imageUrls, - () => { - preloadImages(); - }, - { immediate: true } -); -function preloadImages() { - imageUrls.value.forEach((imageUrl) => { - const image = new Image(); - image.src = imageUrl; - }); -} - // Grab interaction const yMax = computed(() => { return parseInt( @@ -136,6 +120,11 @@ function handleVerticalRotation(event) { } } +function resetView() { + currentX.value = 0; + currentY.value = 0; +} + const throttledDragToRotate = throttle(dragToRotate, 50); watch(isDragToRotateEnabled, (newValue) => { @@ -170,4 +159,21 @@ watch(isLoopAnimationEnabled, (newValue) => { clearInterval(animationIntervalId); } }); + +// Images preload +const imageUrls = computed(() => activeTrack.files.map((file) => file.url)); +watch( + imageUrls, + () => { + preloadImages(); + resetView(); + }, + { immediate: true } +); +function preloadImages() { + imageUrls.value.forEach((imageUrl) => { + const image = new Image(); + image.src = imageUrl; + }); +}