model-info.vue
2.74 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
85
86
87
88
89
90
91
92
93
<template>
<section class="model-info">
<el-icon :size="20" @click="onClickBoundingBoxVisible">
<View v-if="isBoundingBoxVisible" />
<Hide v-else />
</el-icon>
<div class="content">
<div class="item-name">
<span v-for="(value, key, index) in modelInfo" v-text="$t(key)" :key="index" />
</div>
<div class="item-info">
<span v-for="(value, key, index) in modelInfo" v-text="value ? `${value}` : '-'" :key="index" />
</div>
<div class="item-unit">
<span v-text="modelInfo.length ? 'mm' : ''" />
<span v-text="modelInfo.width ? 'mm' : ''" />
<span v-text="modelInfo.height ? 'mm' : ''" />
<span v-text="modelInfo.volume ? 'ml' : ''" />
<span v-text="modelInfo.triangles ? '' : ''" />
</div>
</div>
</section>
</template>
<script setup>
import { useModelInfoStore } from '@/views//stores/useModelInfoStore';
import { View, Hide } from '@element-plus/icons-vue';
import { storeToRefs } from 'pinia';
const store = useModelInfoStore();
const { modelInfo, setBoundingBoxVisible } = store;
const { isBoundingBoxVisible } = storeToRefs(store);
const onClickBoundingBoxVisible = () => {
setBoundingBoxVisible(!isBoundingBoxVisible.value);
};
</script>
<style lang="less">
.model-info {
position: absolute;
bottom: 160px;
margin-left: 24px;
display: flex;
align-items: flex-start;
width: fit-content;
pointer-events: none;
z-index: 10;
background-color: @canvas-background-color;
padding: 10px;
.el-icon {
cursor: pointer;
pointer-events: initial !important;
&:hover {
background-color: lightgray;
}
}
.content {
width: 100%;
display: flex;
-webkit-box-pack: start;
justify-content: flex-start;
align-items: flex-start;
visibility: initial;
pointer-events: none;
color: rgb(50, 50, 50);
.item-name {
display: flex;
flex-direction: column;
gap: 10px;
-webkit-box-align: center;
align-items: flex-end;
margin-right: 20px;
pointer-events: none;
width: 80px;
font-weight: 550;
}
.item-info,
.item-unit {
display: flex;
flex-direction: column;
width: 60px;
pointer-events: initial;
align-items: center;
gap: 10px;
pointer-events: none;
}
.item-unit {
width: 50px;
align-items: center;
pointer-events: none;
}
}
}
</style>