useMeasureStore.js
1.02 KB
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
30
31
32
33
34
35
36
37
38
39
40
import { defineStore } from 'pinia';
import { reactive, ref } from 'vue';
import DISTANCEIMAGE from '@/views/assets/images/functional-toolbar/measure/distance.png';
import THICKNESSIMAGE from '@/views/assets/images/functional-toolbar/measure/thickness.png';
import { useEditorStore } from '@/views/stores/useEditorStore';
export const useMeasureStore = defineStore('measure', () => {
const editorStore = useEditorStore();
const { removeMeasuresObjects, setMeasuresMode } = editorStore;
const items = reactive([
{
key: 'distance',
image: DISTANCEIMAGE
},
{
key: 'thickness',
image: THICKNESSIMAGE
}
]);
const selecteditem = ref('distance');
const setSelectedItem = (val) => {
selecteditem.value = val;
setMeasuresMode(val);
};
const removeMeasures = () => {
removeMeasuresObjects();
};
return {
items,
selecteditem,
setSelectedItem,
removeMeasures
};
});