From 65b112892c142e8f8d76d3f061254bb8476d2720 Mon Sep 17 00:00:00 2001 From: gaozl Date: Tue, 23 May 2023 10:28:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9C=B0=E5=9B=BE=E5=8F=AF=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/qm/MainMap_QM.js | 86 +++++++++++++++++++++------------- public/static/qm/three.js | 8 ++-- 2 files changed, 57 insertions(+), 37 deletions(-) diff --git a/public/static/qm/MainMap_QM.js b/public/static/qm/MainMap_QM.js index 7fd9455..0130780 100644 --- a/public/static/qm/MainMap_QM.js +++ b/public/static/qm/MainMap_QM.js @@ -33,7 +33,7 @@ QMUtil = function () { this.beforPath = "./"; this.options = { playSpeed: 6, //动画播放速度 - collision: false, //是否支持名称的碰撞检测 + collision: true, //是否支持名称的碰撞检测 showStyle: false, //是否4K modelIcon: true, //是否使用模型 true 模型 false 图标 otherPath: [], //人为干预的路线 [{f:"0_5_10",s:"1_5_47",d:500},{f:"1_5_47",s:"0_5_10",d:500}]; @@ -77,7 +77,7 @@ QMUtil = function () { //debug 参数 相机坐标/ 镜头方向 this.guiOptions = { cameraX: 0, cameraY: 220, cameraZ: 220, targatX: 0, targatY: 0, targatZ: 0 }; //this.button = function() {}; - this.sceneGap = { x: 0, y: 0, z: 0, scale: dir ? 0.15 : 0.08 }; //改变地图位置,大小 + this.sceneGap = { x: 0, y: 0, z: 0, scale: dir ? 0.15 : 0.09 }; //改变地图位置,大小 this.selectBuild = 0; this.selectFloor = 0; @@ -1440,7 +1440,6 @@ MainMap_QM.prototype = { this.util.options.pathColor = pathColor != 0xb47834 ? pathColor : this.util.options.pathColor; this.util.options.pathStyle = pathStyle != "3D" ? pathStyle : this.util.options.pathStyle; this.util.iconUrl = iconUrl; - if (!isNaN(Number(options.floor))) { this.util.startObj.floor = this.util.deviceObj.floor = parseInt(options.floor) || 0; } else { @@ -1457,11 +1456,13 @@ MainMap_QM.prototype = { for(let k=0; k { Map_QM.controls.saveState(); @@ -2088,7 +2104,7 @@ MainMap_QM.prototype = { Map_QM.controls.enabled = true; Map_QM.controls.enableRotate = true; Map_QM.util.pathStateObj.forShopArr = { direction: "", wayList: [] }; - Map_QM.resetMeDir(); + this.controls.reset(); if (Map_QM.guide && Map_QM.guide.visible) { Map_QM.guide.visible = false } @@ -2217,7 +2233,7 @@ MainMap_QM.prototype = { Map_QM.util.selectBuild = build; Map_QM.util.selectFloor = fIndex; if (Map_QM.util.options.shadow) { - TweenMax.fromTo(Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.position, 0.3, { z: Map_QM.util.options.fSpace }, { + TweenMax.fromTo(Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.position, 0.2, { z: Map_QM.util.options.fSpace }, { z: 0, ease: Cubic.easeIn, onComplete: function () { Map_QM.timeOutInit(); if (callBack) callBack(); @@ -2839,8 +2855,10 @@ MainMap_QM.prototype = { Map_QM.controls.update(); Map_QM.renderer.render(Map_QM.scene, Map_QM.camera); Map_QM.labelRenderer.render(Map_QM.scene, Map_QM.camera); - Map_QM.labelRenderer.renderObject( Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj, Map_QM.camera ); - Map_QM.labelRenderer.renderObject( Map_QM.CSSObject, Map_QM.camera ); + if(Map_QM.mapArr[Map_QM.util.selectBuild]){ + Map_QM.labelRenderer.renderObject( Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj, Map_QM.camera ); + Map_QM.labelRenderer.renderObject( Map_QM.CSSObject, Map_QM.camera ); + } for (let item of Map_QM.mixers) { item.update(T); } @@ -3066,7 +3084,7 @@ MainMap_QM.prototype = { } }, onCallTouchORMouse: function (mouse) { - if (!Map_QM.mapArr[Map_QM.util.selectBuild] && !Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor] || Map_QM.util.pathStateObj.isPathState) { + if (!Map_QM.mapArr[Map_QM.util.selectBuild] && !Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor] ) { return; } let raycaster = new THREE.Raycaster(); @@ -3405,14 +3423,12 @@ MainMap_QM.prototype = { if (!Map_QM) { return; } + if (!Map_QM.util.options.collision) { + return; + } clearTimeout(Map_QM.util.timeObj.collTime); Map_QM.util.timeObj.collTime = setTimeout(() => { clearTimeout(Map_QM.util.timeObj.collTime); - Map_QM.labelRenderer.zOrder( Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj ); - if (!Map_QM.util.options.collision) { - return; - } - let checkList = []; if (Map_QM.util.options.overlap) { for (let i = 0; i < Map_QM.mapArr[Map_QM.util.selectBuild].length; i++) { @@ -3483,7 +3499,7 @@ MainMap_QM.prototype = { } } } - }, 500); + }, 300); }, /** @@ -5091,6 +5107,10 @@ MainMap_QM.prototype = { * MainMap_QM.init(callBackLoadOver,{build : 0, floor : 3, navPoint : 7, angle : 0, perc_H : "-50%",containerId : "mapContainer"}); */ MainMap_QM.init = function (callBack, options) { + if(Map_QM){ + Map_QM.cancelRender(); + Map_QM.beforeDestroy(options); + } Map_QM = new MainMap_QM(callBack, options); return Map_QM; } diff --git a/public/static/qm/three.js b/public/static/qm/three.js index f7cecb2..5e36b93 100644 --- a/public/static/qm/three.js +++ b/public/static/qm/three.js @@ -39018,7 +39018,7 @@ var uniforms = { u_time: { value: 0.0 } }; // 着色器设置 -const vertexShader = ` +var vertexShader1 = ` varying vec2 vUv; attribute float percent; uniform float u_time; @@ -39037,7 +39037,7 @@ const vertexShader = ` gl_Position = projectionMatrix * mvPosition; } ` -const fragmentShader = ` +var fragmentShader1 = ` #ifdef GL_ES precision mediump float; #endif @@ -39093,8 +39093,8 @@ function initFlyLine( curve, matSetting, pointsNumber ) { }; const lineMaterial = new THREE.ShaderMaterial( { uniforms: singleUniforms, - vertexShader: vertexShader, - fragmentShader: fragmentShader, + vertexShader: vertexShader1, + fragmentShader: fragmentShader1, transparent: true } ); return lineMaterial;