liuyg
2022-01-07 de0df0227b6de9dd8de31cda71731a81b7da1a49
src/store/modules/mobile.js
@@ -30,7 +30,7 @@
    },
    // 默认起始点函数
    startPointFn: "",
    dimension: "3D", // 维度
    dimension: "2.5D", // 维度
    dimensionData: {
      // 维度镜头数据
      heading: 0,
@@ -45,6 +45,9 @@
    tilesetLayer: null, //2.5d模型
    usetowpointfive: null,
    tilesetLayer: null, //瀑布流
    audioData: null, //语音
    audioState: false, //语音状态
  },
  mutations: {
    MSET_VIEWER(state, viewer) {
@@ -111,7 +114,6 @@
    //切换2D和2.5D
    MSET_DIMENSION(state, data) {
      //关闭弹窗
      //3d,2.5d转换事件
      state.dimension = data;
      if (data == "3D") {
@@ -134,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 = 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;
        // 视角缩放
@@ -156,11 +158,11 @@
        };
        state.tilesetLayer.show = false; //隐藏3d图形
        state.newLayer = state.usetowpointfive(); //添加2.5d图形贴片
        state.wallLayer.show = true; //打开瀑布
        state.wallLayer.show = false; //打开瀑布
        state.startPointFn(); //移动默认视角
        //2.5D视角限制
        state.mviewer.scene.screenSpaceCameraController.minimumZoomDistance = 500;
        state.mviewer.scene.screenSpaceCameraController.minimumZoomDistance = 200;
        // 最大
        state.mviewer.scene.screenSpaceCameraController.maximumZoomDistance = 6000;
        // 设置相机缩小时的速率
@@ -218,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,
        ];
@@ -296,11 +298,14 @@
      // })
      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) {
          dispatch("MSET_GETAUDIOBEGIN", "notOpen");
        }
      } //cancel
    },
    CHANGETOC3({ state, commit }, data) {
      // //转换经纬度坐标 成世界坐标cartesian3
@@ -483,6 +488,26 @@
        },
      });
    },
    MSET_GETAUDIO({ state, commit, dispatch }, val) {
      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 {
        if (val != "notOpen") {
          window.speechSynthesis.speak(state.audioData);
        }
      }
    },
  },
};