|
@ -281,8 +281,10 @@ import Label from './Label' |
|
|
var group=new THREE.Group() |
|
|
var group=new THREE.Group() |
|
|
var names=[] |
|
|
var names=[] |
|
|
var labels=[] |
|
|
var labels=[] |
|
|
|
|
|
window.the=labels |
|
|
var items={select:null,show:null,list:[]} |
|
|
var items={select:null,show:null,list:[]} |
|
|
var center=[101.863986 -0.02,25.776215 -0.01] |
|
|
var center=[101.863986 -0.02,25.776215 -0.01] |
|
|
|
|
|
var distance=0 |
|
|
var region=reactive([ |
|
|
var region=reactive([ |
|
|
{name:"羊街镇",lan:101.9301474,lng:26.0574059}, |
|
|
{name:"羊街镇",lan:101.9301474,lng:26.0574059}, |
|
|
{name:"老城乡",lan:101.8811474,lng:25.9254059}, |
|
|
{name:"老城乡",lan:101.8811474,lng:25.9254059}, |
|
@ -307,6 +309,7 @@ import Label from './Label' |
|
|
|
|
|
|
|
|
camera = new THREE.PerspectiveCamera(40, map.value.clientWidth / map.value.clientHeight, 10, 1000) |
|
|
camera = new THREE.PerspectiveCamera(40, map.value.clientWidth / map.value.clientHeight, 10, 1000) |
|
|
camera.position.set(0, 100, 90) |
|
|
camera.position.set(0, 100, 90) |
|
|
|
|
|
distance=Math.sqrt(Math.pow(100,2)+Math.pow(90,2)) |
|
|
|
|
|
|
|
|
var directionalLight = new THREE.DirectionalLight(0xffffff, 0.6); |
|
|
var directionalLight = new THREE.DirectionalLight(0xffffff, 0.6); |
|
|
directionalLight.position.set(0, 0, 10).normalize(); |
|
|
directionalLight.position.set(0, 0, 10).normalize(); |
|
@ -328,6 +331,7 @@ import Label from './Label' |
|
|
controls.maxPolarAngle=Math.PI/2 |
|
|
controls.maxPolarAngle=Math.PI/2 |
|
|
controls.minPolarAngle=0 |
|
|
controls.minPolarAngle=0 |
|
|
controls.dispatchEvent=e=>{ |
|
|
controls.dispatchEvent=e=>{ |
|
|
|
|
|
var distance_now=Math.sqrt(Math.pow(camera.position.x,2)+Math.pow(camera.position.y,2)+Math.pow(camera.position.z,2)) |
|
|
names.forEach(v=>{ |
|
|
names.forEach(v=>{ |
|
|
v.rotation.x=camera.rotation.x |
|
|
v.rotation.x=camera.rotation.x |
|
|
v.rotation.y=camera.rotation.y |
|
|
v.rotation.y=camera.rotation.y |
|
@ -335,6 +339,11 @@ import Label from './Label' |
|
|
}) |
|
|
}) |
|
|
labels.forEach(v=>{ |
|
|
labels.forEach(v=>{ |
|
|
v.rotate(camera.rotation) |
|
|
v.rotate(camera.rotation) |
|
|
|
|
|
if(distance_now<distance){ |
|
|
|
|
|
v.zoomOut(distance_now/distance) |
|
|
|
|
|
}else{ |
|
|
|
|
|
v.zoomOut(1) |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|