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.
 
 
 
 

84 lines
2.0 KiB

<template>
<div class="bottom-panel">
<div
v-for="item in layerData"
:class="['tool-item', { active: selectedKeys.includes(item.id) }]"
@click="handleChangeLayer(item)"
>
{{ item.nameCn }}
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed } from "vue";
import { useProjectStore } from "@/store/modules/project";
const projectStore = useProjectStore();
defineOptions({
name: "bottom-panel",
});
const activeLayers = ref<any[]>([]);
const listName = ref(["水库点", "堤防", "水闸"]);
const layerData: any = computed(() => {
const list: any[] = [];
listName.value.forEach((item, index) => {
const layer = projectStore.getLayerByName(item);
if (layer) {
list.push(layer);
}
});
return list;
});
const selectedKeys = computed(() => projectStore.selectedLayerKeys);
function handleChangeLayer(item: any) {
if (activeLayers.value.includes(item.id)) {
activeLayers.value = activeLayers.value.filter((id: any) => id !== item.id);
// projectStore.setLayerVisibility(item.id, false);
} else {
activeLayers.value.push(item.id);
// projectStore.setLayerVisibility(item.id, true);
}
}
</script>
<style scoped lang="less">
.bottom-panel {
position: fixed;
bottom: 24px;
left: 50%;
transform: translateX(-50%);
height: auto;
display: flex;
justify-content: center;
align-items: center;
gap: 12px;
.tool-item {
width: 152px;
height: 48px;
border-radius: 4px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
background: url("@/assets/bottom/btn-bg.png") no-repeat;
backdrop-filter: blur(10px);
font-family: Source Han Sans;
font-size: 20px;
font-weight: 500;
line-height: 23.4px;
text-align: right;
letter-spacing: 0px;
color: #ffffff;
cursor: pointer;
&:hover,
&.active {
background: url("@/assets/bottom/btn-bg-active.png") no-repeat;
}
}
}
</style>