From 8b03c8f0bb550399f5f90eb308e4d726a9163bc1 Mon Sep 17 00:00:00 2001 From: Rin Date: Sun, 4 Jan 2026 00:11:47 +0800 Subject: [PATCH] fix(stage-ui): selectedMotionGroup can be empty string (fix #870) --- packages/stage-ui/src/components/scenes/live2d/Model.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/stage-ui/src/components/scenes/live2d/Model.vue b/packages/stage-ui/src/components/scenes/live2d/Model.vue index 694693d5d..869657757 100644 --- a/packages/stage-ui/src/components/scenes/live2d/Model.vue +++ b/packages/stage-ui/src/components/scenes/live2d/Model.vue @@ -255,7 +255,7 @@ async function loadModel() { const selectedMotionIndex = localStorage.getItem('selected-runtime-motion-index') // Configure the selected motion to loop - if (selectedMotionGroup && selectedMotionIndex) { + if (selectedMotionGroup !== null && selectedMotionIndex) { const groupIndex = (motionManager.groups as Record)[selectedMotionGroup] if (groupIndex !== undefined && motionManager.motionGroups[groupIndex]) { const motionIndex = Number.parseInt(selectedMotionIndex) @@ -268,7 +268,7 @@ async function loadModel() { } } - if (selectedMotionGroup && selectedMotionIndex && live2dIdleAnimationEnabled.value) { + if (selectedMotionGroup !== null && selectedMotionIndex && live2dIdleAnimationEnabled.value) { setTimeout(() => { console.info('Playing selected runtime motion:', selectedMotionGroup, selectedMotionIndex) currentMotion.value = { @@ -322,7 +322,7 @@ async function loadModel() { const selectedMotionGroup = localStorage.getItem('selected-runtime-motion-group') const selectedMotionIndex = localStorage.getItem('selected-runtime-motion-index') - if (selectedMotionGroup && selectedMotionIndex && live2dIdleAnimationEnabled.value) { + if (selectedMotionGroup !== null && selectedMotionIndex && live2dIdleAnimationEnabled.value) { // Restart the selected runtime motion immediately for seamless looping console.info('Motion finished, restarting runtime motion:', selectedMotionGroup, selectedMotionIndex) // Use requestAnimationFrame to restart on the next frame for smooth transition