canvas-editor.vue
2.31 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<template>
<div class="viewer-editor" id="viewer-editor" ref="viewer" />
<div class="viewer-editor-coordinate" id="viewer-editor-coordinate" ref="coordinate" />
<div
v-show="isSectionViewVisible"
class="viewer-editor-sectionview"
id="viewer-editor-sectionview"
ref="sectionview"
>
<span> {{ $t('sectionview') }}</span>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import Editor from '@/utility/jsm/canvas/editor';
import { useEditorStore } from '@/views/stores/useEditorStore';
import { useViewsAngleStore } from '@/views/stores/useViewsAngleStore';
import { storeToRefs } from 'pinia';
const store = useEditorStore();
const { setEditor, setCoordinate, setSectionViewEditor } = store;
const viewStore = useViewsAngleStore();
const { isSectionViewVisible } = storeToRefs(viewStore);
const viewer = ref(null);
const coordinate = ref(null);
const sectionview = ref(null);
onMounted(() => {
const editor = new Editor('viewer-editor');
if (editor) {
editor.initialize(viewer.value);
setEditor(editor);
}
const editorCoordinate = new Editor('viewer-editor-coordinate');
if (editorCoordinate) {
editorCoordinate.initialize(coordinate.value);
setCoordinate(editorCoordinate);
}
const sectionViewEditor = new Editor('viewer-editor-sectionview');
if (sectionViewEditor) {
sectionViewEditor.initialize(sectionview.value);
setSectionViewEditor(sectionViewEditor);
}
});
</script>
<style lang="less">
.viewer-editor {
background-color: @canvas-background-color;
width: 100%;
height: 100%;
}
.viewer-editor-coordinate {
width: 200px;
height: 200px;
position: absolute;
bottom: 80px;
left: 63.63px;
background-color: transparent;
pointer-events: none;
}
.viewer-editor-sectionview {
width: 500px;
height: 500px;
position: absolute;
border-radius: 10px;
box-shadow: rgba(145, 153, 163, 0.16) 0px 1px 1px;
border: 1px solid #cdd1d5;
background-color: #ffffff;
bottom: 25px;
right: 16px;
span {
position: absolute;
display: flex;
justify-content: space-around;
margin-top: 12px;
font-size: 16px;
line-height: 24px;
font-weight: 700;
width: 500px;
}
}
</style>