shuishen
2022-01-07 b41fcb58025473d83c41bca06f546d62fd8a908b
src/store/modules/mobile.js
@@ -45,6 +45,8 @@
    tilesetLayer: null, //2.5d模型
    usetowpointfive: null,
    tilesetLayer: null, //瀑布流
    audioData: null, //语音
  },
  mutations: {
    MSET_VIEWER(state, viewer) {
@@ -110,6 +112,8 @@
    // },
    //切换2D和2.5D
    MSET_DIMENSION(state, data) {
      //关闭弹窗
      //3d,2.5d转换事件
      state.dimension = data;
      if (data == "3D") {
@@ -132,13 +136,13 @@
        // state.mviewer.flyTo(state.tileset);
        //3D视角不限制
        state.mviewer.scene.screenSpaceCameraController.minimumZoomDistance = 100;
        state.mviewer.scene.screenSpaceCameraController.minimumZoomDistance = 80;
        // 最大
        state.mviewer.scene.screenSpaceCameraController.maximumZoomDistance = 999999999999;
        state.mviewer.scene.screenSpaceCameraController.maximumZoomDistance = 4000000;
        // 设置相机缩小时的速率
        state.mviewer.scene.screenSpaceCameraController._minimumZoomRate = 3000;
        state.mviewer.scene.screenSpaceCameraController._minimumZoomRate = 10000;
        // 设置相机放大时的速率
        state.mviewer.scene.screenSpaceCameraController._maximumZoomRate = 3000;
        state.mviewer.scene.screenSpaceCameraController._maximumZoomRate = 5906376272000;
        // 视角平移
        state.mviewer.scene.screenSpaceCameraController.enableRotate = true;
        // 视角缩放
@@ -154,7 +158,7 @@
        };
        state.tilesetLayer.show = false; //隐藏3d图形
        state.newLayer = state.usetowpointfive(); //添加2.5d图形贴片
        state.wallLayer.show = true; //打开瀑布
        state.wallLayer.show = false; //打开瀑布
        state.startPointFn(); //移动默认视角
        //2.5D视角限制
@@ -193,8 +197,6 @@
    },
    setMobileWindows({ state, commit, dispatch }, data) {
      // 打开随地图移动窗口
      // 关闭前一个弹窗?
      dispatch("closeMobileWindowsDom");
      let clas, Flys;
      const nowHeight = Math.ceil(
        state.mviewer.camera.positionCartographic.height
@@ -300,7 +302,11 @@
      if (!state.MobileWindowsHide && state.popupsDom) {
        state.popupsDom.closeOur();
        commit("MSET_MOBILEWINDOWSHIDE", true);
      }
        if (state.audioData) {
          state.audioData = null;
          window.speechSynthesis.cancel();
        }
      } //cancel
    },
    CHANGETOC3({ state, commit }, data) {
      // //转换经纬度坐标 成世界坐标cartesian3
@@ -440,6 +446,8 @@
      // console.log(global.DC.Namespace.Cesium.Matrix4.IDENTITY)
    },
    MSET_DIMENSIONS({ state, commit, dispatch }, val) {
      //关闭弹窗
      dispatch("closeMobileWindowsDom");
      //3d,2.5d转换事件
      commit("MSET_DIMENSION", val);
      //控制高度
@@ -481,6 +489,16 @@
        },
      });
    },
    MSET_GETAUDIO({ state, commit, dispatch }, val) {
      if (state.audioData) {
        state.audioData = null;
        window.speechSynthesis.cancel();
      } else {
        state.audioData = new window.SpeechSynthesisUtterance();
        state.audioData.text = val;
        window.speechSynthesis.speak(state.audioData);
      }
    },
  },
};