diff --git a/public/static/qm/MainMap_QM.js b/public/static/qm/MainMap_QM.js index 1adb8bf..2bd8f60 100644 --- a/public/static/qm/MainMap_QM.js +++ b/public/static/qm/MainMap_QM.js @@ -155,7 +155,8 @@ QMUtil = function () { shopStyle: 'shopName', //设置box显示名称shopName或编号shopNum inArea: false, //点击后是否聚焦到店铺 camZoom: 3, //设置我的方向状态地图放大倍数 - boxShop: [] //设置box上显示的文字(过滤指),可点击触发onlyShop + boxShop: [], //设置box上显示的文字(过滤指),可点击触发onlyShop + deviceAng: false, //地图初始化方向是否使用设备角度 } this.lightOptions = { d_col: '#ffffff', @@ -198,7 +199,6 @@ QMUtil = function () { this.startObj = {} // 导航起点; this.overObj = {} //导航结束点 this.tubeMaterial = new THREE.MeshPhongMaterial({ color: this.options.pathColor, transparent: true, opacity: 0.6 }) //叠层的路径材质 - this.deviceAng = true //地图初始化方向是否使用设备角度 this.buildHeight = 5 this.shopHeight = 30 //店铺高度 控制店铺相关的其它第三方组件高度 //服务icon 英文配置 @@ -2033,13 +2033,15 @@ MainMap_QM.prototype = { this.buildObj.visible = false } Map_QM.changeBuild(Map_QM.util.deviceObj.build, Map_QM.util.deviceObj.floor) - Map_QM.controls.addEventListener('change', this.controlsChock, false) //控制器变化 Map_QM.controls.target.set(Map_QM.util.guiOptions.targatX, Map_QM.util.guiOptions.targatY, Map_QM.util.guiOptions.targatZ) //初始化方向为第一人称方向 - let angle = Map_QM.util.deviceAng ? Map_QM.util.deviceObj.angle : 0 - Map_QM.rotationAngle(angle) - Map_QM.startRender() - Map_QM.controls.saveState() + let angle = Map_QM.util.options.deviceAng ? Map_QM.util.deviceObj.angle : 0; + Map_QM.rotationAngle(angle); + Map_QM.startRender(); + setTimeout(() => { + Map_QM.controls.saveState(); + Map_QM.controls.addEventListener('change', this.controlsChock, false); //控制器变化 + }, 100) }, /** * 解析路径 @@ -2441,17 +2443,21 @@ MainMap_QM.prototype = { }, onInnerMeDir: function () { this.changeMapModel('2D') - this.shawLight.castShadow = false - if (Map_QM.util.pathStateObj.isPathState) { - this.dirIcon.visible = false - } - if (Map_QM.qiModel) Map_QM.qiModel.visible = false - let vat = Map_QM.mapBackToWorld(this.util.deviceObj.xaxis, this.util.deviceObj.yaxis, 0) - TweenMax.to(Map_QM.controls.object.position, 0.5, { x: vat.x }) - TweenMax.to(Map_QM.controls.target, 0.5, { x: vat.x, y: vat.y, z: vat.z }) - this.controls.setZoom(this.util.options.camZoom) - this.rotationAngle(this.util.deviceObj.angle || 0) - this.controls.enableRotate = false + Map_QM.controls.maxPolarAngle = 0 + Map_QM.controls.minPolarAngle = 0 + if (Map_QM.util.pathStateObj.isPathState) { + this.dirIcon.visible = false; + } + if (Map_QM.util.deviceObj.xaxis) { + Map_QM.controls.object.position.set(Map_QM.util.deviceObj.xaxis * Map_QM.util.sceneGap.scale, 50, Map_QM.util.deviceObj.yaxis * Map_QM.util.sceneGap.scale) + Map_QM.controls.target = new THREE.Vector3(Map_QM.util.deviceObj.xaxis * Map_QM.util.sceneGap.scale, 0, Map_QM.util.deviceObj.yaxis * Map_QM.util.sceneGap.scale) + } else { + Map_QM.controls.object.position.set(0, 51, 0) + Map_QM.controls.target = new THREE.Vector3(0, 0, 0) + } + Map_QM.controls.setZoom(Map_QM.util.options.camZoom) + Map_QM.rotationAngle(Map_QM.util.deviceObj.angle) + Map_QM.controls.enableRotate = false }, changeMapModel: function (model) { if (model == '2D') {