1.气象效果按钮改为切换状态,点击一次显示对应天气,再点击一次取消;
This commit is contained in:
parent
ed8b76fe5f
commit
2817417d19
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
|
@ -26,6 +26,7 @@
|
|||
v-for="subtool in tool.subtools"
|
||||
:key="subtool.id"
|
||||
class="tool-wrapper"
|
||||
:class="{'active': subtool.active}"
|
||||
>
|
||||
<!-- 二级工具按钮 -->
|
||||
<div class="tool-button" @click="subtool.name && bus.emit(`toolbar_${subtool.name}`, params)">
|
||||
|
@ -310,6 +311,7 @@ const toolbarClear = () => {
|
|||
}
|
||||
};
|
||||
|
||||
// 点击主工具,控制子工具栏的事件
|
||||
const mainToolClick = (tool) => {
|
||||
// 触发工具事件
|
||||
tool.name && bus.emit(`toolbar_${tool.name}`, params)
|
||||
|
@ -327,7 +329,36 @@ const mainToolClick = (tool) => {
|
|||
}
|
||||
}
|
||||
|
||||
// 天气效果按钮点击事件
|
||||
const weatherSwitchClick = (name) => {
|
||||
const list = options.value[2].subtools
|
||||
const option = list.find(item => item.name === name)
|
||||
|
||||
if(option.active) {
|
||||
option.active = false;
|
||||
weatherParticle.destroy();
|
||||
} else {
|
||||
// 取消其它天气按钮的激活状态
|
||||
list.forEach(item => {
|
||||
if(item.name !== name) {
|
||||
item.active = false;
|
||||
}
|
||||
});
|
||||
|
||||
option.active = true;
|
||||
switch(name) {
|
||||
case 'rain':
|
||||
weatherParticle && weatherParticle.rain()
|
||||
break
|
||||
case 'snow':
|
||||
weatherParticle && weatherParticle.snow()
|
||||
break
|
||||
case 'fog':
|
||||
weatherParticle && weatherParticle.fog()
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
watch(() => props.viewer, (v) => {
|
||||
if (v) {
|
||||
|
@ -377,10 +408,9 @@ watch(() => props.viewer, (v) => {
|
|||
bus.on('toolbar_road', drawRoad);
|
||||
bus.on('toolbar_keyarea', drawKeyarea);
|
||||
// 气象效果部分
|
||||
bus.on('toolbar_sunny', () => weatherParticle && weatherParticle.destroy())
|
||||
bus.on('toolbar_rain', () => weatherParticle && weatherParticle.rain())
|
||||
bus.on('toolbar_snow', () => weatherParticle && weatherParticle.snow())
|
||||
bus.on('toolbar_fog', () => weatherParticle && weatherParticle.fog())
|
||||
bus.on('toolbar_rain', () => weatherSwitchClick('rain'))
|
||||
bus.on('toolbar_snow', () => weatherSwitchClick('snow'))
|
||||
bus.on('toolbar_fog', () => weatherSwitchClick('fog'))
|
||||
// 清空
|
||||
bus.on('toolbar_clear', toolbarClear);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ const initMap = (v) => {
|
|||
const bus = useEventBus(viewerRef.value)
|
||||
// view 模式下,点击地图要素显示属性编辑弹窗
|
||||
bus.onScreen(Cesium.ScreenSpaceEventType.LEFT_CLICK, ({ position }) => {
|
||||
console.log('左键点击屏幕位置:', position);
|
||||
// 如果点击的是实体,则获取该实体的属性数据
|
||||
const pickedObjectList = viewerRef.value.scene.drillPick(position);
|
||||
if (pickedObjectList.length > 0) {
|
||||
|
|
Loading…
Reference in New Issue