shuishen
2022-01-07 0b3c77332ac4ce524ad4d8b8c3d8959a0f0cc14e
src/store/modules/mobile.js
@@ -30,7 +30,7 @@
    },
    // 默认起始点函数
    startPointFn: "",
    dimension: "3D", // 维度
    dimension: "2.5D", // 维度
    dimensionData: {
      // 维度镜头数据
      heading: 0,
@@ -47,6 +47,7 @@
    tilesetLayer: null, //瀑布流
    audioData: null, //语音
    audioState: false, //语音状态
  },
  mutations: {
    MSET_VIEWER(state, viewer) {
@@ -113,7 +114,6 @@
    //切换2D和2.5D
    MSET_DIMENSION(state, data) {
      //关闭弹窗
      //3d,2.5d转换事件
      state.dimension = data;
      if (data == "3D") {
@@ -162,7 +162,7 @@
        state.startPointFn(); //移动默认视角
        //2.5D视角限制
        state.mviewer.scene.screenSpaceCameraController.minimumZoomDistance = 500;
        state.mviewer.scene.screenSpaceCameraController.minimumZoomDistance = 200;
        // 最大
        state.mviewer.scene.screenSpaceCameraController.maximumZoomDistance = 6000;
        // 设置相机缩小时的速率
@@ -220,7 +220,7 @@
      } else if (state.dimension == "2.5D") {
        Flys = [
          +data.lntLat[0] + 0.01197,
          +data.lntLat[1] - 0.0001,
          +data.lntLat[1] - 0.00055,
          // +data.lntLat[1] - 0.0022,
          nowHeight,
        ];
@@ -298,13 +298,12 @@
      // })
      commit("MSET_POPUPDOM", popupsDom);
    },
    closeMobileWindowsDom({ state, commit }) {
    closeMobileWindowsDom({ state, commit, dispatch }) {
      if (!state.MobileWindowsHide && state.popupsDom) {
        state.popupsDom.closeOur();
        commit("MSET_MOBILEWINDOWSHIDE", true);
        if (state.audioData) {
          state.audioData = null;
          window.speechSynthesis.cancel();
          dispatch("MSET_GETAUDIOBEGIN", "notOpen");
        }
      } //cancel
    },
@@ -490,13 +489,23 @@
      });
    },
    MSET_GETAUDIO({ state, commit, dispatch }, val) {
      if (state.audioData) {
        state.audioData = null;
      state.audioData = new window.SpeechSynthesisUtterance();
      state.audioData.text = val;
      state.audioData.onstart = function (e) {
        state.audioState = true;
      };
      state.audioData.onend = function (event) {
        state.audioState = false;
      };
    },
    MSET_GETAUDIOBEGIN({ state, commit, dispatch }, val) {
      if (state.audioState) {
        window.speechSynthesis.cancel();
        state.audioState = false;
      } else {
        state.audioData = new window.SpeechSynthesisUtterance();
        state.audioData.text = val;
        window.speechSynthesis.speak(state.audioData);
        if (val != "notOpen") {
          window.speechSynthesis.speak(state.audioData);
        }
      }
    },
  },