Browse Source

fix: 1. 屏保水牌地图展示不全,参照三山街万象进行修改,展示全图

v1.0.1
jiannibang 3 years ago
parent
commit
f3abf932ec
  1. 79
      public/static/qm/MainMap_QM.js
  2. 2
      src/views/Billboard/Billboard.vue
  3. 2
      src/views/Guide/Guide.vue

79
public/static/qm/MainMap_QM.js

@ -1591,20 +1591,20 @@ MainMap_QM = function (callBack, backObj) {
hemiLight.name = 'light'
this.scene.add(hemiLight)
let directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.3)
directionalLight2.name = 'light'
directionalLight2.position.set(280, 400, -300)
this.light = new THREE.DirectionalLight(0xffffff, 0.3)
this.light.name = 'light'
this.light.position.set(280, 400, -300)
if (Config.cameraDist.state === '3D') {
directionalLight2.castShadow = true //阴影
directionalLight2.shadow.camera.top = 320
directionalLight2.shadow.camera.bottom = -320
directionalLight2.shadow.camera.right = 320
directionalLight2.shadow.camera.left = -320
directionalLight2.shadow.camera.far = 1200
directionalLight2.shadow.camera.near = 50
directionalLight2.shadow.mapSize.set(1024, 1024)
this.light.castShadow = true //阴影
}
this.scene.add(directionalLight2)
this.light.shadow.camera.top = 320
this.light.shadow.camera.bottom = -320
this.light.shadow.camera.right = 320
this.light.shadow.camera.left = -320
this.light.shadow.camera.far = 1200
this.light.shadow.camera.near = 50
this.light.shadow.mapSize.set(1024, 1024)
this.scene.add(this.light)
this.mixers = []
this.controls = new THREE.OrbitControls(this.camera, ele)
@ -1626,7 +1626,7 @@ MainMap_QM = function (callBack, backObj) {
} else {
document.getElementById('mapContainer').addEventListener('click', this.onMouseClickBox, false) //地图点击
}
document.addEventListener('rezise', this.changeWindowResize, false) //窗口变化
document.addEventListener('rezise', this.changeDocmentResize) //窗口变化
this.mapArr = []
this.selectShop
this.selectEle = null //当前使用的电梯
@ -1727,7 +1727,6 @@ MainMap_QM.prototype = {
},
initBuild: function (e) {
console.log('******')
elevator = null
straight = null
elevatorDown = null
@ -2230,15 +2229,7 @@ MainMap_QM.prototype = {
*
*/
onShowMeDir: function (zoom = 0) {
Config.setModelState('2d')
Map_QM.camera = cameraOrtho
Map_QM.controls.maxPolarAngle = 0
Map_QM.controls.minPolarAngle = 0
if (isPathState) {
Map_QM.dirIcon.visible = false
Map_QM.qiIcon.visible = true
}
Map_QM.controls.object = Map_QM.camera
Map_QM.changeMapTo2D()
if (Config.deviceObj.xaxis) {
Map_QM.controls.object.position.set(Config.deviceObj.xaxis * Config.sceneGap.scale, 100, Config.deviceObj.yaxis * Config.sceneGap.scale)
Map_QM.controls.target = new THREE.Vector3(Config.deviceObj.xaxis * Config.sceneGap.scale, 0, Config.deviceObj.yaxis * Config.sceneGap.scale)
@ -2251,6 +2242,18 @@ MainMap_QM.prototype = {
Map_QM.rotationAngle(Config.deviceObj.angle || 0)
Map_QM.controls.enableRotate = false
},
changeMapTo2D: function () {
Config.setModelState('2d')
Map_QM.light.castShadow = false //阴影
Map_QM.camera = cameraOrtho
Map_QM.controls.maxPolarAngle = 0
Map_QM.controls.minPolarAngle = 0
if (isPathState) {
Map_QM.dirIcon.visible = false
Map_QM.qiIcon.visible = true
}
Map_QM.controls.object = Map_QM.camera
},
changeMapModel: function (model) {
if (model == '2D') {
Config.setModelState('2d')
@ -2348,6 +2351,9 @@ MainMap_QM.prototype = {
Config.setModelState('3d')
Map_QM.camera = cameraPerspective
Map_QM.controls.setZoom(1)
if (Config.cameraDist.state === '3D') {
Map_QM.light.castShadow = true //阴影
}
Map_QM.controls.object = Map_QM.camera
Map_QM.controls.maxPolarAngle = Math.PI / 2 - 0.3
Map_QM.controls.minPolarAngle = 0.3
@ -2382,6 +2388,9 @@ MainMap_QM.prototype = {
Map_QM.camera = cameraPerspective
Map_QM.controls.object = Map_QM.camera
Map_QM.controls.setZoom(1)
if (Config.cameraDist.state === '3D') {
Map_QM.light.castShadow = true //阴影
}
Map_QM.controls.maxPolarAngle = Math.PI / 2 - 0.3
Map_QM.controls.minPolarAngle = 0.3
Map_QM.controls.minAzimuthAngle = -Infinity
@ -4586,6 +4595,13 @@ MainMap_QM.prototype = {
},
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
changeDocmentResize: function (e) {
let ele = document.getElementById(options.containerId || 'mapContainer')
let w = parseInt(ele.clientWidth) || parseInt(window.getComputedStyle(ele, null).getPropertyValue('width'))
let h = parseInt(ele.clientHeight) || parseInt(window.getComputedStyle(ele, null).getPropertyValue('height'))
console.log(w, h)
Map_QM.changeWindowResize(w, h)
},
/**
* @api {方法} changeWindowResize() 窗口变化
* @apiGroup 地图交互
@ -4602,15 +4618,14 @@ MainMap_QM.prototype = {
* Map_QM.changeWindowResize(1280,1080);
*/
changeWindowResize: function (width = -1, height = -1) {
aspect = width / height
cameraPerspective.aspect = aspect
cameraPerspective.updateProjectionMatrix()
cameraOrtho.left = (340 * aspect) / -2
cameraOrtho.right = (340 * aspect) / 2
cameraOrtho.top = 340 / 2
cameraOrtho.bottom = 340 / -2
cameraOrtho.updateProjectionMatrix()
Map_QM.aspect = width / height
Map_QM.cameraPerspective.aspect = Map_QM.aspect
Map_QM.cameraPerspective.updateProjectionMatrix()
Map_QM.cameraOrtho.left = (340 * Map_QM.aspect) / -2
Map_QM.cameraOrtho.right = (340 * Map_QM.aspect) / 2
Map_QM.cameraOrtho.top = 340 / 2
Map_QM.cameraOrtho.bottom = 340 / -2
Map_QM.cameraOrtho.updateProjectionMatrix()
Map_QM.renderer.setSize(width, height)
Map_QM.labelRenderer.setSize(width, height)
Map_QM.w = width

2
src/views/Billboard/Billboard.vue

@ -104,7 +104,7 @@ Promise.all([getBrandListByFormat()]).then(([{ data: brandListByFormat }]) => {
try {
window.Map_QM?.showFloor?.(currentFloor.value.floorOrder)
window.Map_QM.onShowMeDir()
window.Map_QM?.changeMapTo2D()
} catch (error) {
console.log('error:', error)
}

2
src/views/Guide/Guide.vue

@ -90,7 +90,7 @@
import { ref, watch, onBeforeUnmount, computed, nextTick } from 'vue'
import { storeToRefs } from 'pinia'
import { useStore } from '@/store/root'
import { RESET, DIRECTION, ACTIVITY_BRAND, list as buttonList } from './list'
import { RESET, DIRECTION, list as buttonList } from './list'
import View from '@/layouts/View.vue'
import { hideMapDialog, setShopActive, setShopInactive, showFacility } from '@/composables/useInitMap'
import { getBrandListByFormat, getBrandListByFloor } from '@/http/brand/api'

Loading…
Cancel
Save