Browse Source

修改3d地图事件监听

master
邓宏 2 years ago
parent
commit
5f93fa914f
  1. 23
      src/view/park/center.vue

23
src/view/park/center.vue

@ -327,6 +327,18 @@ import Point from './Point'
var controls = new MapControls(camera, map.value) var controls = new MapControls(camera, map.value)
controls.maxPolarAngle=Math.PI/2 controls.maxPolarAngle=Math.PI/2
controls.minPolarAngle=0 controls.minPolarAngle=0
controls.dispatchEvent=e=>{
names.forEach(v=>{
v.rotation.x=camera.rotation.x
v.rotation.y=camera.rotation.y
v.rotation.z=camera.rotation.z
})
labels.forEach(v=>{
v.rotation.x=camera.rotation.x
v.rotation.y=camera.rotation.y
v.rotation.z=camera.rotation.z
})
}
} }
function addMap(){ function addMap(){
var shape = new THREE.Shape() var shape = new THREE.Shape()
@ -660,17 +672,6 @@ import Point from './Point'
renderer.render(scene, camera); renderer.render(scene, camera);
modalRenderer.render(scene, camera); modalRenderer.render(scene, camera);
requestAnimationFrame(render) requestAnimationFrame(render)
names.forEach(v=>{
v.rotation.x=camera.rotation.x
v.rotation.y=camera.rotation.y
v.rotation.z=camera.rotation.z
})
labels.forEach(v=>{
v.rotation.x=camera.rotation.x
v.rotation.y=camera.rotation.y
v.rotation.z=camera.rotation.z
})
} }
function move({clientX, clientY}){ function move({clientX, clientY}){
raycaster.setFromCamera( raycaster.setFromCamera(

Loading…
Cancel
Save