|
|
@ -13,6 +13,7 @@ var Map_QM, |
|
|
intTimer, |
|
|
intTimer, |
|
|
shopTime, |
|
|
shopTime, |
|
|
allTime, |
|
|
allTime, |
|
|
|
|
|
pathScale=1, |
|
|
language = "zh"; |
|
|
language = "zh"; |
|
|
|
|
|
|
|
|
//basePath 基础路径 graphPath最佳路径 ftPath 扶梯路径 dtPath 电梯路径
|
|
|
//basePath 基础路径 graphPath最佳路径 ftPath 扶梯路径 dtPath 电梯路径
|
|
|
@ -2108,7 +2109,7 @@ MainMap_QM.prototype = { |
|
|
); |
|
|
); |
|
|
}, |
|
|
}, |
|
|
initFloor: function () { |
|
|
initFloor: function () { |
|
|
this.controls.saveState(); |
|
|
|
|
|
|
|
|
|
|
|
this.changeBuild(this.util.deviceObj.build, this.util.deviceObj.floor); |
|
|
this.changeBuild(this.util.deviceObj.build, this.util.deviceObj.floor); |
|
|
//初始化方向为第一人称方向
|
|
|
//初始化方向为第一人称方向
|
|
|
this.util.options.deviceAng && this.rotationAngle(this.util.deviceObj.angle); |
|
|
this.util.options.deviceAng && this.rotationAngle(this.util.deviceObj.angle); |
|
|
@ -2137,6 +2138,7 @@ MainMap_QM.prototype = { |
|
|
Map_QM.toOutModelInner(); |
|
|
Map_QM.toOutModelInner(); |
|
|
}, 1000); |
|
|
}, 1000); |
|
|
} |
|
|
} |
|
|
|
|
|
Map_QM.controls.saveState(); |
|
|
}, 200); |
|
|
}, 200); |
|
|
}, |
|
|
}, |
|
|
calcFov: function (d, w, r) { |
|
|
calcFov: function (d, w, r) { |
|
|
@ -2332,6 +2334,7 @@ MainMap_QM.prototype = { |
|
|
if (Map_QM.qiIcon) { |
|
|
if (Map_QM.qiIcon) { |
|
|
Map_QM.qiIcon.visible = state == "2d" && Map_QM.util.pathStateObj.isPathState ? true : false; |
|
|
Map_QM.qiIcon.visible = state == "2d" && Map_QM.util.pathStateObj.isPathState ? true : false; |
|
|
} |
|
|
} |
|
|
|
|
|
Map_QM.controls.reset(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -2403,6 +2406,7 @@ MainMap_QM.prototype = { |
|
|
if (!Map_QM.buildObj.visible) { |
|
|
if (!Map_QM.buildObj.visible) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
Map_QM.controls.setZoom(1); |
|
|
Map_QM.util.isMorePath = false; |
|
|
Map_QM.util.isMorePath = false; |
|
|
Map_QM.util.pathStateObj.isPathState = false; |
|
|
Map_QM.util.pathStateObj.isPathState = false; |
|
|
Map_QM.changeStartPoint(); |
|
|
Map_QM.changeStartPoint(); |
|
|
@ -3204,7 +3208,7 @@ MainMap_QM.prototype = { |
|
|
* Map_QM.setCameraDist(150); |
|
|
* Map_QM.setCameraDist(150); |
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
setCameraDist: function (cDist, updateFun, callBack) { |
|
|
|
|
|
|
|
|
setCameraDist: function (cDist, disc, updateFun, callBack) { |
|
|
cDist = Map_QM.util.options.minDis > parseInt(cDist) ? Map_QM.util.options.minDis : parseInt(cDist); |
|
|
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); |
|
|
cDist = parseInt(cDist) > Map_QM.util.options.maxDis ? Map_QM.util.options.minDis : parseInt(cDist); |
|
|
let oldObj = { dis: Map_QM.controls.getDistance() }; |
|
|
let oldObj = { dis: Map_QM.controls.getDistance() }; |
|
|
@ -3212,12 +3216,12 @@ MainMap_QM.prototype = { |
|
|
TweenMax.to(oldObj, 0.5, { |
|
|
TweenMax.to(oldObj, 0.5, { |
|
|
dis: cDist, |
|
|
dis: cDist, |
|
|
onUpdate: function () { |
|
|
onUpdate: function () { |
|
|
updateFun && updateFun(); //实时更新地图位置
|
|
|
|
|
|
|
|
|
updateFun && updateFun(disc); //实时更新地图位置
|
|
|
Map_QM.controls.setDistance(oldObj.dis); |
|
|
Map_QM.controls.setDistance(oldObj.dis); |
|
|
Map_QM.controlsChock(); |
|
|
Map_QM.controlsChock(); |
|
|
}, |
|
|
}, |
|
|
onComplete:function(){ |
|
|
onComplete:function(){ |
|
|
updateFun && updateFun(); |
|
|
|
|
|
|
|
|
updateFun && updateFun(disc); |
|
|
callBack && callBack(); |
|
|
callBack && callBack(); |
|
|
Map_QM.collLabel(); |
|
|
Map_QM.collLabel(); |
|
|
} |
|
|
} |
|
|
@ -5675,9 +5679,9 @@ getObjectAngle:function(objArr){ |
|
|
let vh = bottomY-topY; |
|
|
let vh = bottomY-topY; |
|
|
let disc = Map_QM.controls.getDistance(); |
|
|
let disc = Map_QM.controls.getDistance(); |
|
|
if(vh==0 || vw/vh < Map_QM.w/Map_QM.h){ //按高度计算
|
|
|
if(vh==0 || vw/vh < Map_QM.w/Map_QM.h){ //按高度计算
|
|
|
Map_QM.setCameraDist((disc*vh/Map_QM.h)+20, Map_QM.moveMapPosition, Map_QM.drawPathStart); |
|
|
|
|
|
|
|
|
Map_QM.setCameraDist((disc*vh/Map_QM.h)+20,disc, Map_QM.moveMapPosition, Map_QM.drawPathStart); |
|
|
}else{ //按宽度计算
|
|
|
}else{ //按宽度计算
|
|
|
Map_QM.setCameraDist((disc*vw/Map_QM.w)+20, Map_QM.moveMapPosition, Map_QM.drawPathStart); |
|
|
|
|
|
|
|
|
Map_QM.setCameraDist((disc*vw/Map_QM.w)+20,disc, Map_QM.moveMapPosition, Map_QM.drawPathStart); |
|
|
} |
|
|
} |
|
|
}else{ |
|
|
}else{ |
|
|
Map_QM.drawPathStart(); |
|
|
Map_QM.drawPathStart(); |
|
|
@ -5686,6 +5690,9 @@ getObjectAngle:function(objArr){ |
|
|
}, |
|
|
}, |
|
|
drawPathStart:function(){ |
|
|
drawPathStart:function(){ |
|
|
document.addEventListener("pathOver", Map_QM.onFindPathFloor, true); |
|
|
document.addEventListener("pathOver", Map_QM.onFindPathFloor, true); |
|
|
|
|
|
Map_QM.qiModel.scale.x = Map_QM.qiModel.scale.y = Map_QM.qiModel.scale.z = 300*pathScale; |
|
|
|
|
|
Map_QM.endModel.scale.x = Map_QM.endModel.scale.y = Map_QM.endModel.scale.z = 300*0.07*pathScale; |
|
|
|
|
|
Map_QM.guide.scale.x = Map_QM.guide.scale.y = Map_QM.guide.scale.z = 50*pathScale; |
|
|
if (Map_QM.util.isMorePath) { |
|
|
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); //传入数组
|
|
|
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 { |
|
|
} else { |
|
|
@ -5696,7 +5703,7 @@ getObjectAngle:function(objArr){ |
|
|
Map_QM.controlsChock(); |
|
|
Map_QM.controlsChock(); |
|
|
}, |
|
|
}, |
|
|
//根据屏幕坐标平移地图
|
|
|
//根据屏幕坐标平移地图
|
|
|
moveMapPosition:function(){ |
|
|
|
|
|
|
|
|
moveMapPosition:function(disc){ |
|
|
const postArr = Map_QM.forShopArr[Map_QM.util._indexPathFloor].PathPoint; |
|
|
const postArr = Map_QM.forShopArr[Map_QM.util._indexPathFloor].PathPoint; |
|
|
const len = postArr.length; |
|
|
const len = postArr.length; |
|
|
let leftX = 50000, rightX=-50000, topY=50000, bottomY = -50000; |
|
|
let leftX = 50000, rightX=-50000, topY=50000, bottomY = -50000; |
|
|
@ -5708,6 +5715,13 @@ getObjectAngle:function(objArr){ |
|
|
bottomY = Math.max(screen.y,bottomY); |
|
|
bottomY = Math.max(screen.y,bottomY); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let dis = Map_QM.controls.getDistance(); |
|
|
|
|
|
|
|
|
|
|
|
pathScale = dis/disc; |
|
|
|
|
|
|
|
|
|
|
|
Map_QM.qiModel.scale.x = Map_QM.qiModel.scale.y = Map_QM.qiModel.scale.z = 300*pathScale; |
|
|
|
|
|
Map_QM.endModel.scale.x = Map_QM.endModel.scale.y = Map_QM.endModel.scale.z = 300*0.07*pathScale; |
|
|
|
|
|
Map_QM.guide.scale.x = Map_QM.guide.scale.y = Map_QM.guide.scale.z = 50*pathScale; |
|
|
let panStart = new THREE.Vector2((leftX+rightX)/2, (bottomY+topY)/2); //映射的屏幕中心点
|
|
|
let panStart = new THREE.Vector2((leftX+rightX)/2, (bottomY+topY)/2); //映射的屏幕中心点
|
|
|
let panEnd = new THREE.Vector2(Map_QM.w/2, Map_QM.h/2); |
|
|
let panEnd = new THREE.Vector2(Map_QM.w/2, Map_QM.h/2); |
|
|
let panDelta = new THREE.Vector2(); |
|
|
let panDelta = new THREE.Vector2(); |
|
|
@ -5922,9 +5936,13 @@ getObjectAngle:function(objArr){ |
|
|
if (Map_QM.selectShop) { |
|
|
if (Map_QM.selectShop) { |
|
|
Map_QM.selectShop.scale.z = 1; |
|
|
Map_QM.selectShop.scale.z = 1; |
|
|
} |
|
|
} |
|
|
if (Map_QM.endModel && Map_QM.endModel.visible) { |
|
|
|
|
|
|
|
|
pathScale = 1; |
|
|
|
|
|
if (Map_QM.endModel) { |
|
|
Map_QM.endModel.visible = false; |
|
|
Map_QM.endModel.visible = false; |
|
|
} |
|
|
} |
|
|
|
|
|
if (Map_QM.qiModel) { |
|
|
|
|
|
Map_QM.qiModel.scale.x = Map_QM.qiModel.scale.y = Map_QM.qiModel.scale.z = 150; |
|
|
|
|
|
} |
|
|
if (Map_QM.endIcon && Map_QM.endIcon.visible) { |
|
|
if (Map_QM.endIcon && Map_QM.endIcon.visible) { |
|
|
Map_QM.endIcon.visible = false; |
|
|
Map_QM.endIcon.visible = false; |
|
|
} |
|
|
} |
|
|
@ -6879,7 +6897,7 @@ FloorMap_QM.prototype = { |
|
|
setOverSite: function (shopX, shopY, shopZ) { |
|
|
setOverSite: function (shopX, shopY, shopZ) { |
|
|
if (Map_QM.endModel) { |
|
|
if (Map_QM.endModel) { |
|
|
Map_QM.endModel.visible = pathCameraState == "2D" ? false : true; |
|
|
Map_QM.endModel.visible = pathCameraState == "2D" ? false : true; |
|
|
Map_QM.endModel.scale.x = Map_QM.endModel.scale.y = Map_QM.endModel.scale.z = 100; |
|
|
|
|
|
|
|
|
Map_QM.endModel.scale.x = Map_QM.endModel.scale.y = Map_QM.endModel.scale.z = 150; |
|
|
Map_QM.endModel.position.set(shopX, shopZ, shopY); //x,z,y
|
|
|
Map_QM.endModel.position.set(shopX, shopZ, shopY); //x,z,y
|
|
|
Map_QM.endModel.applyMatrix4(Map_QM.sceneGap.matrix); |
|
|
Map_QM.endModel.applyMatrix4(Map_QM.sceneGap.matrix); |
|
|
if (Map_QM.endIcon) { |
|
|
if (Map_QM.endIcon) { |
|
|
@ -6905,7 +6923,7 @@ FloorMap_QM.prototype = { |
|
|
loader2.load( |
|
|
loader2.load( |
|
|
Map_QM.util.beforPath + "static/img/zhong.glb", |
|
|
Map_QM.util.beforPath + "static/img/zhong.glb", |
|
|
function (collada2) { |
|
|
function (collada2) { |
|
|
collada2.scene.scale.x = collada2.scene.scale.y = collada2.scene.scale.z = 100; |
|
|
|
|
|
|
|
|
collada2.scene.scale.x = collada2.scene.scale.y = collada2.scene.scale.z = 150; |
|
|
if (shopX != 0 && shopY != 0) { |
|
|
if (shopX != 0 && shopY != 0) { |
|
|
collada2.scene.position.set(shopX, shopZ, shopY); //x,z,y
|
|
|
collada2.scene.position.set(shopX, shopZ, shopY); //x,z,y
|
|
|
} |
|
|
} |
|
|
@ -6968,7 +6986,7 @@ FloorMap_QM.prototype = { |
|
|
new THREE.GLTFLoader().load( |
|
|
new THREE.GLTFLoader().load( |
|
|
Map_QM.util.beforPath + "static/img/guide.glb", |
|
|
Map_QM.util.beforPath + "static/img/guide.glb", |
|
|
function (obj) { |
|
|
function (obj) { |
|
|
obj.scene.scale.x = obj.scene.scale.y = obj.scene.scale.z = 100; |
|
|
|
|
|
|
|
|
obj.scene.scale.x = obj.scene.scale.y = obj.scene.scale.z = 150; |
|
|
obj.scene.rotation.x = Math.PI / 2; |
|
|
obj.scene.rotation.x = Math.PI / 2; |
|
|
obj.scene.rotation.y = (Map_QM.util.deviceObj.angle * Math.PI) / -180; |
|
|
obj.scene.rotation.y = (Map_QM.util.deviceObj.angle * Math.PI) / -180; |
|
|
obj.scene.traverse(function (child) { |
|
|
obj.scene.traverse(function (child) { |
|
|
@ -6997,7 +7015,7 @@ FloorMap_QM.prototype = { |
|
|
new THREE.GLTFLoader().load( |
|
|
new THREE.GLTFLoader().load( |
|
|
Map_QM.util.beforPath + "static/img/qi.glb", |
|
|
Map_QM.util.beforPath + "static/img/qi.glb", |
|
|
function (collada) { |
|
|
function (collada) { |
|
|
collada.scene.scale.x = collada.scene.scale.y = collada.scene.scale.z = 100; |
|
|
|
|
|
|
|
|
collada.scene.scale.x = collada.scene.scale.y = collada.scene.scale.z = 150; |
|
|
collada.scene.rotateX(Math.PI / 2); |
|
|
collada.scene.rotateX(Math.PI / 2); |
|
|
collada.scene.traverse(function (child) { |
|
|
collada.scene.traverse(function (child) { |
|
|
if (child.type === "Mesh") { |
|
|
if (child.type === "Mesh") { |
|
|
@ -7762,9 +7780,9 @@ FindPath_QM.prototype.drawPath = function (floorOrder, pathArr = null, height = |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (this.morePath) { |
|
|
if (this.morePath) { |
|
|
this.lineDashed_old = new PathLine(12,linePath,height,Map_QM.util.options.pathColor,Map_QM.util.options.pathColor2,true); |
|
|
|
|
|
|
|
|
this.lineDashed_old = new PathLine(24*pathScale,linePath,height,Map_QM.util.options.pathColor,Map_QM.util.options.pathColor2,true); |
|
|
} else { |
|
|
} else { |
|
|
this.lineDashed_old = new PathLine(12,linePath,parseInt(Map_QM.util.buildHeight) + 1,Map_QM.util.options.pathColor,Map_QM.util.options.pathColor2,true); |
|
|
|
|
|
|
|
|
this.lineDashed_old = new PathLine(24*pathScale,linePath,parseInt(Map_QM.util.buildHeight) + 1,Map_QM.util.options.pathColor,Map_QM.util.options.pathColor2,true); |
|
|
} |
|
|
} |
|
|
this.lineDashed_old.name = "lineDash"; |
|
|
this.lineDashed_old.name = "lineDash"; |
|
|
this.lineDashed_old.renderOrder = 128; |
|
|
this.lineDashed_old.renderOrder = 128; |
|
|
@ -7803,8 +7821,8 @@ FindPath_QM.prototype.playMoveGuide = function () { |
|
|
let targetY = -1 * _selfFindPath.pathArr[_selfFindPath._index].y - py; |
|
|
let targetY = -1 * _selfFindPath.pathArr[_selfFindPath._index].y - py; |
|
|
let dist = Math.sqrt(targetX * targetX + targetY * targetY); |
|
|
let dist = Math.sqrt(targetX * targetX + targetY * targetY); |
|
|
let df = Math.ceil(dist / (Map_QM.util.options.playSpeed * Map_QM.util.options.speedMult)); |
|
|
let df = Math.ceil(dist / (Map_QM.util.options.playSpeed * Map_QM.util.options.speedMult)); |
|
|
let dx = (_selfFindPath.pathArr[_selfFindPath._index].x - px) / df; |
|
|
|
|
|
let dy = (-1 * _selfFindPath.pathArr[_selfFindPath._index].y - py) / df; |
|
|
|
|
|
|
|
|
let dx = (_selfFindPath.pathArr[_selfFindPath._index].x - px) / df * pathScale; |
|
|
|
|
|
let dy = (-1 * _selfFindPath.pathArr[_selfFindPath._index].y - py) / df * pathScale; |
|
|
let ang = 0; |
|
|
let ang = 0; |
|
|
if (df < 2) { |
|
|
if (df < 2) { |
|
|
Map_QM.guide.position.x = _selfFindPath.pathArr[_selfFindPath._index].x; |
|
|
Map_QM.guide.position.x = _selfFindPath.pathArr[_selfFindPath._index].x; |
|
|
|