fix #37
This commit is contained in:
parent
ab60a50437
commit
64af50816b
3 changed files with 30 additions and 2 deletions
|
|
@ -9,6 +9,7 @@
|
|||
import throttle from "lodash/throttle";
|
||||
import { ref, computed, watch } from "vue";
|
||||
import { useVirtualSampleStore } from "../../../stores/virtualSample";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
const { activeTrack } = defineProps({
|
||||
activeTrack: Object,
|
||||
|
|
@ -111,4 +112,27 @@ watch(isDragToRotateEnabled, (newValue) => {
|
|||
previousMouseYPos = undefined;
|
||||
}
|
||||
});
|
||||
|
||||
const { isLoopAnimationEnabled } = storeToRefs(useVirtualSampleStore());
|
||||
|
||||
function loopAnimation() {
|
||||
rotateX("right");
|
||||
|
||||
if (currentX.value < xMax.value / 2) {
|
||||
if (currentY.value < yMax.value - 1) currentY.value++;
|
||||
} else {
|
||||
if (currentY.value > 0) currentY.value--;
|
||||
}
|
||||
}
|
||||
|
||||
let animationIntervalId;
|
||||
watch(isLoopAnimationEnabled, (newValue) => {
|
||||
if (newValue) {
|
||||
currentX.value = 0;
|
||||
currentY.value = 0;
|
||||
animationIntervalId = setInterval(loopAnimation, 300);
|
||||
} else {
|
||||
clearInterval(animationIntervalId);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue