diff --git a/src/utils/common.js b/src/utils/common.js new file mode 100644 index 0000000..6b138f3 --- /dev/null +++ b/src/utils/common.js @@ -0,0 +1,19 @@ +export function modifyCesiumMouseWheel(viewer) { + // 地图缩放改为按下 Ctrl + 鼠标滚轮 + viewer.scene.screenSpaceCameraController.zoomEventTypes = [{ eventType: Cesium.CameraEventType.WHEEL, modifier: Cesium.KeyboardEventModifier.CTRL }]; + + // 改写 Cesium 原生鼠标滚轮事件 + const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); + handler.setInputAction((event) => { + if (event < 0) { + window.scrollBy({ left: 0, top: 15, behavior: 'auto' }); + } else { + window.scrollBy({ left: 0, top: -15, behavior: 'auto' }); + } + }, Cesium.ScreenSpaceEventType.WHEEL); + + // 鼠标移动时显示提示信息 + handler.setInputAction((event) => { + document.getElementById('mouseWheelTip').style.display = ''; + }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); +} diff --git a/src/views/home.vue b/src/views/home.vue index 132b7be..373d5db 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -72,18 +72,15 @@
  • clear
  • -
  • +
  • {{ item.voyage_name }}
  • -
    +
    +
    @@ -131,10 +128,7 @@
    - +
    @@ -145,11 +139,11 @@ {{ item.des }}
    -
    +
    -
    -
    +
    +
    @@ -174,8 +168,8 @@
    • -

      {{ item.voyage_end_date.slice(8,10) }}

      - {{ item.voyage_end_date.slice(0,7) }} +

      {{ item.voyage_end_date.slice(8, 10) }}

      + {{ item.voyage_end_date.slice(0, 7) }}

      {{ item.voyage_name }}

      @@ -186,8 +180,8 @@
      • -

        {{ item.create_time.slice(8,10) }}

        - {{ item.create_time.slice(0,7) }} +

        {{ item.create_time.slice(8, 10) }}

        + {{ item.create_time.slice(0, 7) }}

        {{ item.dataset_name }}

        @@ -204,19 +198,19 @@
          -
        • +
        • blast基因分析工具

        • -
        • +
        • 温盐深分析工具

        • -
        • +
        • 影像数据物种智能识别

        • -
        • +
        • 海洋物理生态耦合模式分析

        • @@ -234,6 +228,10 @@ import { getVoyage, getVoyageLine, getParamsList, statisticsNums } from '../api/ import { swiper, swiperSlide } from 'vue-awesome-swiper' import 'swiper/swiper-bundle.css' import { sampleDatasetList, voyageRegList } from '@/api/dataTransfer' +import { + modifyCesiumMouseWheel +} from '@/utils/common' + const Cesium = window.Cesium export default { @@ -371,6 +369,9 @@ export default { this.viewer.scene._sunBloom = false this.viewer.scene.globe.showGroundAtmosphere = false this.viewer.scene.postProcessStages.fxaa.enabled = true + + // 改写 Cesium 原生鼠标滚轮事件,地图缩放改为按下 Ctrl + 鼠标滚轮 + modifyCesiumMouseWheel(this.viewer); // 不显示底图 this.viewer.imageryLayers.get(0).show = false @@ -430,7 +431,7 @@ export default { zIndex: 1000, width: 2, // 设置线条的材质(颜色) - material: Cesium.Color.fromRandom({alpha: 0.5}) + material: Cesium.Color.fromRandom({ alpha: 0.5 }) } }) this.viewer.camera.setView({ @@ -456,7 +457,7 @@ export default { this.viewer.entities.removeAll() }, // 自动跳转到实体位置 - autoZoom(){ + autoZoom() { this.viewer.zoomTo(this.viewer.entities) }, // 全部轨迹 @@ -767,6 +768,7 @@ export default { height: 100%; } } + .cover { width: 100%; height: 800px; @@ -1257,6 +1259,14 @@ export default { z-index: 1000; } +#mouseWheelTip{ + position: absolute; + left: 5px; + bottom: 5px; + z-index: 100; + color: #fff; +} + .cesium-viewer-bottom { display: none !important; }