WholeProcessPlatform/frontend/src/components/mapController/index.vue

115 lines
2.3 KiB
Vue
Raw Normal View History

2026-03-31 14:17:30 +08:00
<template>
2026-04-02 08:56:49 +08:00
<div class="map-controller" :style="{ right: drawerOpen ? '480px' : '12px' }">
2026-03-31 14:17:30 +08:00
<div class="map-controller-group">
<div class="map-controller-item" v-for="item in controllers" :key="item.key">
<a-tooltip :title="item.name" placement="left">
<i class="icon iconfont" :class="'icon-' + item.icon"></i>
</a-tooltip>
</div>
</div>
</div>
</template>
<script setup lang="ts">
2026-04-02 08:56:49 +08:00
import { ref, watch } from "vue";
import { useUiStore } from "@/store/modules/ui";
// 使用 Pinia store
const uiStore = useUiStore();
const drawerOpen = ref(uiStore.drawerOpen);
// 监听 store 中的 drawerOpen 变化
watch(() => uiStore.drawerOpen, (newVal) => {
drawerOpen.value = newVal;
});
2026-03-31 14:17:30 +08:00
const isFullScreen = ref(false);
const mapType = ref("2D");
2026-04-02 08:56:49 +08:00
// 响应式的控制器配置
2026-03-31 14:17:30 +08:00
const controllers = ref([
{
name: "全屏",
key: "fullScreen",
icon: isFullScreen.value ? "exitFullScreen" : "fullScreen",
},
{
name: "定位",
key: "positioning",
icon: "iconGlobal",
},
{
name: "放大",
key: "zoomIn",
icon: "zoomIn",
},
{
name: "缩小",
key: "zoomOut",
icon: "zoomOut",
},
{
name: "3D",
key: "dim",
icon: mapType.value === "2D" ? "a-3D" : "a-2D",
},
{
name: "图层",
key: "layerController",
2026-04-02 08:56:49 +08:00
icon: "layer",
2026-03-31 14:17:30 +08:00
},
{
name: "下载",
key: "screenShot",
icon: "downLoad",
},
{
name: "梯级",
key: "TJ",
icon: "tiji",
},
{
name: "倾斜摄影",
key: "OSBGController",
icon: "obliquePhotography",
},
{
name: "三维漫游",
key: "threedRoam",
icon: "roaming",
},
]);
2026-04-02 08:56:49 +08:00
2026-03-31 14:17:30 +08:00
</script>
<style lang="scss" scoped>
.map-controller {
position: absolute;
right: 480px;
bottom: 114px;
z-index: 10;
.map-controller-group {
box-shadow: 0 1px 2px #00000026;
background-color: #fff;
border: none;
.map-controller-item {
height: 40px;
width: 40px;
color: #000;
line-height: 40px;
text-align: center;
position: relative;
cursor: pointer;
.iconfont {
font-size: 20px;
}
&:hover {
background-color: #005292;
color: #ffffff;
}
}
.map-controller-group:not(:first-child) {
margin-top: 10px;
}
}
}
2026-04-02 08:56:49 +08:00
</style>