diff --git a/src/views/Editor/Canvas/index.vue b/src/views/Editor/Canvas/index.vue index 699eb423..d94dd06d 100644 --- a/src/views/Editor/Canvas/index.vue +++ b/src/views/Editor/Canvas/index.vue @@ -202,12 +202,13 @@ export default defineComponent({ handler: selectAllElement, }, { - text: '重置当前页', - handler: deleteAllElements, + text: '网格线', + subText: showGridLines.value ? '√' : '', + handler: toggleGridLines, }, { - text: showGridLines.value ? '关闭网格线' : '打开网格线', - handler: toggleGridLines, + text: '重置当前页', + handler: deleteAllElements, }, { divider: true }, { diff --git a/src/views/Editor/Toolbar/ElementAnimationPanel.vue b/src/views/Editor/Toolbar/ElementAnimationPanel.vue index 6df4e141..6cfdafe4 100644 --- a/src/views/Editor/Toolbar/ElementAnimationPanel.vue +++ b/src/views/Editor/Toolbar/ElementAnimationPanel.vue @@ -127,32 +127,6 @@ export default defineComponent({ return animationTypes[animation.type] }) - const updateElementAnimation = (type: string) => { - const animations = (currentSlideAnimations.value as PPTAnimation[]).map(item => { - if (item.elId === handleElement.value.id) return { ...item, type } - return item - }) - store.commit(MutationTypes.UPDATE_SLIDE, { animations }) - animationPoolVisible.value = false - addHistorySnapshot() - } - - const addAnimation = (type: string) => { - if (handleElementAnimation.value) { - updateElementAnimation(type) - return - } - const animations: PPTAnimation[] = currentSlideAnimations.value ? JSON.parse(JSON.stringify(currentSlideAnimations.value)) : [] - animations.push({ - elId: handleElement.value.id, - type, - duration: 1000, - }) - store.commit(MutationTypes.UPDATE_SLIDE, { animations }) - animationPoolVisible.value = false - addHistorySnapshot() - } - const deleteAnimation = (elId: string) => { const animations = (currentSlideAnimations.value as PPTAnimation[]).filter(item => item.elId !== elId) store.commit(MutationTypes.UPDATE_SLIDE, { animations }) @@ -186,6 +160,36 @@ export default defineComponent({ } } + const updateElementAnimation = (type: string) => { + const animations = (currentSlideAnimations.value as PPTAnimation[]).map(item => { + if (item.elId === handleElement.value.id) return { ...item, type } + return item + }) + store.commit(MutationTypes.UPDATE_SLIDE, { animations }) + animationPoolVisible.value = false + addHistorySnapshot() + + runAnimation(handleElement.value.id, type) + } + + const addAnimation = (type: string) => { + if (handleElementAnimation.value) { + updateElementAnimation(type) + return + } + const animations: PPTAnimation[] = currentSlideAnimations.value ? JSON.parse(JSON.stringify(currentSlideAnimations.value)) : [] + animations.push({ + elId: handleElement.value.id, + type, + duration: 1000, + }) + store.commit(MutationTypes.UPDATE_SLIDE, { animations }) + animationPoolVisible.value = false + addHistorySnapshot() + + runAnimation(handleElement.value.id, type) + } + return { handleElement, animationPoolVisible, @@ -238,9 +242,11 @@ export default defineComponent({ height: 40px; line-height: 40px; text-align: center; - background-color: $lightGray; cursor: pointer; } +.animation-box { + background-color: $lightGray; +} .sequence-item { height: 36px; diff --git a/src/views/Editor/Toolbar/SlideStylePanel.vue b/src/views/Editor/Toolbar/SlideStylePanel.vue index a39cab76..5904e9e7 100644 --- a/src/views/Editor/Toolbar/SlideStylePanel.vue +++ b/src/views/Editor/Toolbar/SlideStylePanel.vue @@ -155,7 +155,7 @@ -