From 234b97f5c040f364880dd52087ca9a2a4558578b Mon Sep 17 00:00:00 2001 From: gaozl Date: Tue, 18 Jun 2024 15:36:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=E8=B7=AF=E7=BA=BF=E5=8A=A8=E6=80=81=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/qm/MainMap_QM_go.js | 106 +++++++++++++++++++++++------- 1 file changed, 83 insertions(+), 23 deletions(-) diff --git a/public/static/qm/MainMap_QM_go.js b/public/static/qm/MainMap_QM_go.js index e443b56..c078a1f 100644 --- a/public/static/qm/MainMap_QM_go.js +++ b/public/static/qm/MainMap_QM_go.js @@ -158,8 +158,8 @@ var QMUtil = function () { otherPath: [], //人为干预的路线 [{f:"0_5_10",s:"1_5_47",d:500},{f:"1_5_47",s:"0_5_10",d:500}]; bSpace: 5000, fSpace: 500, //双叠层状态下楼层的间距 - maxDis: 1000, - minDis: 60, + maxDis: 700, + minDis: 100, shadow: true, //是否显示阴影 navColor: 0xee6a50, //途径店铺颜色 aRadius: 2, //圆角半径 大于2 则店铺box显示圆角 @@ -3215,18 +3215,25 @@ MainMap_QM.prototype = { * Map_QM.setCameraDist(150); * */ - setCameraDist: function (cDist) { - if (Map_QM.util.options.minDis < parseInt(cDist) && parseInt(cDist) < Map_QM.util.options.maxDis) { - let oldObj = { dis: Map_QM.controls.getDistance() }; - TweenMax.killAll(true); - TweenMax.to(oldObj, 0.5, { - dis: cDist, - onUpdate: function () { - Map_QM.controls.setDistance(oldObj.dis); - Map_QM.controlsChock(); - }, - }); - } + setCameraDist: function (cDist, updateFun, callBack) { + cDist = Map_QM.util.options.minDis > parseInt(cDist) ? Map_QM.util.options.minDis : parseInt(cDist); + cDist = parseInt(cDist) > Map_QM.util.options.maxDis ? Map_QM.util.options.minDis : parseInt(cDist); + let oldObj = { dis: Map_QM.controls.getDistance() }; + TweenMax.killAll(true); + TweenMax.to(oldObj, 0.5, { + dis: cDist, + onUpdate: function () { + updateFun && updateFun(); //实时更新地图位置 + Map_QM.controls.setDistance(oldObj.dis); + Map_QM.controlsChock(); + }, + onComplete:function(){ + updateFun && updateFun(); + callBack && callBack(); + Map_QM.collLabel(); + } + }); + }, /** * @api {方法} startRender() 启动地图渲染 @@ -3872,6 +3879,17 @@ MainMap_QM.prototype = { }, 300); } }, + getlocaleToScreen:function(object,vect){ + let standardVec; + if(vect){ + standardVec = object.localToWorld(vect).project(Map_QM.camera); + }else{ + standardVec = object.localToWorld(new THREE.Vector3()).project(Map_QM.camera); + } + const screenX = Math.round(Map_QM.w/2 * standardVec.x + Map_QM.w/2); + const screenY = Math.round(Map_QM.h/-2 * standardVec.y + Map_QM.h/2); + return {x:screenX, y:screenY}; + }, runTaskQueue: function (){ if (Map_QM.mapArr[Map_QM.util.selectBuild] && Map_QM.buildObj.visible && Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor]) { if (Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.visible && (!Map_QM.buildObj.userData.hasOwnProperty("visible") || Map_QM.buildObj.userData.visible)) { @@ -5501,6 +5519,7 @@ MainMap_QM.prototype = { * @param {Object} endN */ onFindPath: function () { + console.log(Map_QM.forShopArr); TweenMax.killAll(true); if (Map_QM.util.overObj.floor == Map_QM.util.selectFloor && Map_QM.util.overObj.xaxis) { Map_QM.mapArr[Map_QM.util.overObj.build][Map_QM.util.overObj.floor].setOverSite(Map_QM.util.overObj.xaxis, Map_QM.util.overObj.yaxis,parseInt(Map_QM.util.shopHeight)); @@ -5509,16 +5528,57 @@ MainMap_QM.prototype = { Map_QM.endIcon && (Map_QM.endIcon.visible = false); } if (Map_QM.forShopArr.length > 0) { - document.addEventListener("pathOver", Map_QM.onFindPathFloor, true); - if (Map_QM.util.isMorePath) { - Map_QM.mapArr[Map_QM.forShopArr[Map_QM.util._indexPathFloor].build][Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor].findPath.onFindPathAnimation(pathNodes[Map_QM.util._indexPathFloor].pathNode, Map_QM.util.isMorePath,pathNodes[Map_QM.util._indexPathFloor].floor); //传入数组 - } else { - Map_QM.mapArr[Map_QM.forShopArr[Map_QM.util._indexPathFloor].build][Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor].findPath.clearPath(); - Map_QM.mapArr[Map_QM.forShopArr[Map_QM.util._indexPathFloor].build][Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor].findPath.onFindPathAnimation(Map_QM.forShopArr[Map_QM.util._indexPathFloor].PathPoint,false ); //传入数组 - } - Map_QM.mapArr[Map_QM.forShopArr[Map_QM.util._indexPathFloor].build][Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor].findPath.guidePathPlay(Map_QM.forShopArr[Map_QM.util._indexPathFloor]); - Map_QM.controlsChock(); + const postArr = Map_QM.forShopArr[Map_QM.util._indexPathFloor].PathPoint; + const len = postArr.length; + let leftX = 50000, rightX=-50000, topY=50000, bottomY = -50000; + for(let i=0; i