diff --git a/packages/webgal/src/store/stageReducer.ts b/packages/webgal/src/store/stageReducer.ts index 894aad736..901c3624e 100644 --- a/packages/webgal/src/store/stageReducer.ts +++ b/packages/webgal/src/store/stageReducer.ts @@ -23,6 +23,7 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; import cloneDeep from 'lodash/cloneDeep'; import { commandType } from '@/Core/controller/scene/sceneInterface'; import { STAGE_KEYS } from '@/Core/constants'; +import { baseBlinkParam, baseFocusParam } from '@/Core/live2DCore'; // 初始化舞台数据 @@ -275,10 +276,12 @@ const stageSlice = createSlice({ const index = state.live2dBlink.findIndex((e) => e.target === target); if (index < 0) { // Add a new blink - state.live2dBlink.push({ target, blink }); + const fullBlink = { ...baseBlinkParam, ...blink }; + state.live2dBlink.push({ target, blink: fullBlink }); } else { // Update the existing blink - state.live2dBlink[index].blink = blink; + const fullBlink = { ...state.live2dBlink[index].blink, ...blink }; + state.live2dBlink[index].blink = fullBlink; } }, setLive2dFocus: (state, action: PayloadAction) => { @@ -287,10 +290,12 @@ const stageSlice = createSlice({ const index = state.live2dFocus.findIndex((e) => e.target === target); if (index < 0) { // Add a new focus - state.live2dFocus.push({ target, focus }); + const fullFocus = { ...baseFocusParam, ...focus }; + state.live2dFocus.push({ target, focus: fullFocus }); } else { // Update the existing focus - state.live2dFocus[index].focus = focus; + const fullFocus = { ...state.live2dFocus[index].focus, ...focus }; + state.live2dFocus[index].focus = fullFocus; } }, replaceUIlable: (state, action: PayloadAction<[string, string]>) => {