You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
3.2 KiB

3 months ago
<template>
<div class="drawing-toolbar" v-if="drawDomClick">
<div class="toolbar-icons">
<div
v-for="item in toolbarItems"
:key="item.id"
class="toolbar-item"
:class="{ active: drawingMode === item.id }"
@click="handleItemClick(item)"
:title="item.name"
>
<i :class="item.icon"></i>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'DrawingToolbar',
props: {
drawDomClick: {
type: Boolean,
default: false
},
drawingMode: {
type: String,
default: null
},
hasEntities: {
type: Boolean,
default: false
}
},
data() {
return {
toolbarItems: [
{ id: 'point', name: '点', icon: 'el-icon-location' },
{ id: 'line', name: '线', icon: 'el-icon-edit-outline' },
{ id: 'polygon', name: '面', icon: 'el-icon-s-grid' },
{ id: 'rectangle', name: '矩形', icon: 'el-icon-s-data' },
{ id: 'circle', name: '圆形', icon: 'el-icon-circle-plus-outline' },
{ id: 'sector', name: '扇形', icon: 'el-icon-s-operation' },
{ id: 'arrow', name: '箭头', icon: 'el-icon-right' },
{ id: 'text', name: '文本', icon: 'el-icon-document' },
{ id: 'image', name: '图片', icon: 'el-icon-picture-outline' },
3 months ago
{ id: 'locate', name: '定位', icon: 'el-icon-aim' },
{ id: 'clear', name: '清除', icon: 'el-icon-delete' },
{ id: 'import', name: '导入', icon: 'el-icon-upload' },
{ id: 'export', name: '导出', icon: 'el-icon-download' }
]
}
},
methods: {
handleItemClick(item) {
if (item.id === 'clear') {
this.$emit('clear-all')
} else if (item.id === 'export') {
this.$emit('export-data')
} else if (item.id === 'import') {
this.$emit('import-data')
} else if (item.id === 'locate') {
this.$emit('locate')
} else {
this.$emit('toggle-drawing', item.id)
}
}
}
}
</script>
<style scoped>
.drawing-toolbar {
position: absolute;
top: 70px;
right: 20px;
width: 36px;
3 months ago
background: rgba(255, 255, 255, 0.3);
backdrop-filter: blur(10px);
border: 1px solid rgba(0, 138, 255, 0.1);
border-radius: 8px;
z-index: 90;
box-shadow: 0 4px 12px rgba(0, 138, 255, 0.2);
padding: 12px 2px;
3 months ago
transition: all 0.3s ease;
overflow: hidden;
opacity: 1;
transform: translateX(0);
}
.toolbar-icons {
display: flex;
flex-direction: column;
gap: 10px;
margin-top: 30px;
}
.toolbar-item {
display: flex;
justify-content: center;
align-items: center;
width: 32px;
height: 32px;
3 months ago
cursor: pointer;
color: #555;
font-size: 16px;
3 months ago
position: relative;
transition: all 0.3s;
border-radius: 4px;
padding: 0;
3 months ago
background: rgba(255, 255, 255, 0.8);
backdrop-filter: blur(5px);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.toolbar-item:hover {
background: rgba(0, 138, 255, 0.1);
color: #008aff;
transform: translateY(-2px);
box-shadow: 0 4px 10px rgba(0, 138, 255, 0.2);
}
.toolbar-item.active {
background: rgba(0, 138, 255, 0.15);
color: #008aff;
box-shadow: 0 2px 8px rgba(0, 138, 255, 0.3);
}
.toolbar-item:disabled {
opacity: 0.5;
cursor: not-allowed;
}
</style>