Skip to content

Commit d0301b1

Browse files
committed
fixed bug
1 parent 0e97692 commit d0301b1

File tree

1 file changed

+23
-33
lines changed

1 file changed

+23
-33
lines changed

src/widgets/basic/manage-layers/index.vue

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import MarsDialog from "@mars/components/mars-work/mars-dialog.vue"
2626
import { onUnmounted, nextTick, reactive, ref } from "vue"
2727
import useLifecycle from "@mars/common/uses/use-lifecycle"
28-
import useClock from "@mars/common/uses/use-clock"
2928
import * as mapWork from "./map"
3029
import { useWidget } from "@mars/common/store/widget"
3130
@@ -36,7 +35,6 @@ onUnmounted(() => {
3635
})
3736
3837
useLifecycle(mapWork)
39-
const clock = useClock()
4038
4139
const treeData = ref<any[]>([])
4240
@@ -56,6 +54,7 @@ let lastWidget: any
5654
const checkedChange = (keys: string[], e: any) => {
5755
const layer = layersObj[e.node.id]
5856
// console.log("点击的矢量图层", layer)
57+
5958
if (layer) {
6059
if (!layer.isAdded) {
6160
mapWork.addLayer(layer)
@@ -95,48 +94,39 @@ const checkedChange = (keys: string[], e: any) => {
9594
initLayerTree(layer)
9695
}
9796
98-
// 处理图层的关联事件 TODO: show-clock 封装为widget
97+
// 处理图层的关联事件
9998
if (layer.options.onWidget) {
10099
if (e.checked) {
101-
if (lastWidget === "show-clock") {
102-
clock.closeClock()
103-
} else if (lastWidget) {
100+
if (lastWidget) {
104101
disable(lastWidget)
105102
}
106-
if (layer.options.onWidget === "show-clock") {
107-
clock.showClock()
108-
} else {
109-
activate({
110-
name: layer.options.onWidget
111-
})
112-
}
103+
activate({
104+
name: layer.options.onWidget
105+
})
113106
lastWidget = layer.options.onWidget
114107
} else {
115-
if (layer.options.onWidget === "show-clock") {
116-
// clock.closeClock()
117-
} else {
118-
disable(layer.options.onWidget)
119-
}
108+
disable(layer.options.onWidget)
120109
}
121110
}
122111
}
123-
124-
// let show = true
125-
// keys.forEach((id: string) => {
126-
// const item = layersObj[id]
127-
// if (item && item.options.onWidget === "show-clock") {
128-
// clock.showClock()
129-
// show = true
130-
// } else {
131-
// show = false
132-
// }
133-
// })
134-
// // console.log(show)
135-
// if (!show) {
136-
// clock.closeClock()
137-
// }
138112
}
139113
114+
// let show = true
115+
// keys.forEach((id: string) => {
116+
// const item = layersObj[id]
117+
// if (item && item.options.onWidget === "show-clock") {
118+
// clock.showClock()
119+
// show = true
120+
// } else {
121+
// show = false
122+
// }
123+
// })
124+
// // console.log(show)
125+
// if (!show) {
126+
// clock.closeClock()
127+
// }
128+
// }
129+
140130
function renderChildNode(keys: string[], children: any[]) {
141131
children.forEach((child) => {
142132
const layer = layersObj[child.id]

0 commit comments

Comments
 (0)