#11 - add reset view on track change
This commit is contained in:
parent
2a743e6377
commit
677309be6b
1 changed files with 22 additions and 16 deletions
|
|
@ -35,22 +35,6 @@ const virtualSampleStore = useVirtualSampleStore();
|
||||||
const isHelperHidden = ref(localStorage.getItem("isHelperHidden"));
|
const isHelperHidden = ref(localStorage.getItem("isHelperHidden"));
|
||||||
localStorage.setItem("isHelperHidden", true);
|
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
|
// Grab interaction
|
||||||
const yMax = computed(() => {
|
const yMax = computed(() => {
|
||||||
return parseInt(
|
return parseInt(
|
||||||
|
|
@ -136,6 +120,11 @@ function handleVerticalRotation(event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetView() {
|
||||||
|
currentX.value = 0;
|
||||||
|
currentY.value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
const throttledDragToRotate = throttle(dragToRotate, 50);
|
const throttledDragToRotate = throttle(dragToRotate, 50);
|
||||||
|
|
||||||
watch(isDragToRotateEnabled, (newValue) => {
|
watch(isDragToRotateEnabled, (newValue) => {
|
||||||
|
|
@ -170,4 +159,21 @@ watch(isLoopAnimationEnabled, (newValue) => {
|
||||||
clearInterval(animationIntervalId);
|
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;
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue