perf: 样式、交互优化

This commit is contained in:
pipipi-pikachu 2021-02-10 18:48:31 +08:00
parent 9993936b59
commit 1d25d85621
3 changed files with 39 additions and 32 deletions

View File

@ -202,12 +202,13 @@ export default defineComponent({
handler: selectAllElement, handler: selectAllElement,
}, },
{ {
text: '重置当前页', text: '网格线',
handler: deleteAllElements, subText: showGridLines.value ? '√' : '',
handler: toggleGridLines,
}, },
{ {
text: showGridLines.value ? '关闭网格线' : '打开网格线', text: '重置当前页',
handler: toggleGridLines, handler: deleteAllElements,
}, },
{ divider: true }, { divider: true },
{ {

View File

@ -127,32 +127,6 @@ export default defineComponent({
return animationTypes[animation.type] 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 deleteAnimation = (elId: string) => {
const animations = (currentSlideAnimations.value as PPTAnimation[]).filter(item => item.elId !== elId) const animations = (currentSlideAnimations.value as PPTAnimation[]).filter(item => item.elId !== elId)
store.commit(MutationTypes.UPDATE_SLIDE, { animations }) 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 { return {
handleElement, handleElement,
animationPoolVisible, animationPoolVisible,
@ -238,9 +242,11 @@ export default defineComponent({
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
text-align: center; text-align: center;
background-color: $lightGray;
cursor: pointer; cursor: pointer;
} }
.animation-box {
background-color: $lightGray;
}
.sequence-item { .sequence-item {
height: 36px; height: 36px;

View File

@ -155,7 +155,7 @@
</Popover> </Popover>
</div> </div>
<div class="title" style="margin-top: 20px;">应用预置主题</div> <div class="title" style="margin-top: 20px;">预置主题</div>
<div class="theme-list"> <div class="theme-list">
<div <div
class="theme-item" class="theme-item"