diff --git a/src/assets/icons/toolbar_sunny.png b/src/assets/icons/toolbar_sunny.png deleted file mode 100644 index b05f08b..0000000 Binary files a/src/assets/icons/toolbar_sunny.png and /dev/null differ diff --git a/src/views/systemTemplate/forestFire/Toolbar/Toolbar.vue b/src/views/systemTemplate/forestFire/Toolbar/Toolbar.vue index c192993..b1005b9 100644 --- a/src/views/systemTemplate/forestFire/Toolbar/Toolbar.vue +++ b/src/views/systemTemplate/forestFire/Toolbar/Toolbar.vue @@ -26,6 +26,7 @@ v-for="subtool in tool.subtools" :key="subtool.id" class="tool-wrapper" + :class="{'active': subtool.active}" >
@@ -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); } diff --git a/src/views/systemTemplate/forestFire/index.vue b/src/views/systemTemplate/forestFire/index.vue index 6344c7d..9817da1 100644 --- a/src/views/systemTemplate/forestFire/index.vue +++ b/src/views/systemTemplate/forestFire/index.vue @@ -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) {