File size: 785 Bytes
89ce340
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { storeToRefs } from 'pinia'
import { useMainStore } from '@/store'
import type { PPTShapeElement } from '@/types/slides'

export default () => {
  const mainStore = useMainStore()
  const { shapeFormatPainter, handleElement } = storeToRefs(mainStore)

  const toggleShapeFormatPainter = (keep = false) => {
    const _handleElement = handleElement.value as PPTShapeElement

    if (shapeFormatPainter.value) mainStore.setShapeFormatPainter(null)
    else {
      mainStore.setShapeFormatPainter({
        keep,
        fill: _handleElement.fill,
        gradient: _handleElement.gradient,
        outline: _handleElement.outline,
        opacity: _handleElement.opacity,
        shadow: _handleElement.shadow,
      })
    }
  }

  return {
    toggleShapeFormatPainter,
  }
}