|
@@ -103063,7 +103063,7 @@ ENDSEC
|
|
let scroll = (e) => {
|
|
let scroll = (e) => {
|
|
if(!this.enabled)return
|
|
if(!this.enabled)return
|
|
let resolvedRadius = this.scene.view.radius + this.radiusDelta;
|
|
let resolvedRadius = this.scene.view.radius + this.radiusDelta;
|
|
-
|
|
|
|
|
|
+ if(resolvedRadius < 0.1 && e.delta>0)return; //防止缩放太小,导致很慢
|
|
this.radiusDelta += -e.delta * resolvedRadius * 0.1;
|
|
this.radiusDelta += -e.delta * resolvedRadius * 0.1;
|
|
|
|
|
|
this.stopTweens();
|
|
this.stopTweens();
|
|
@@ -103180,7 +103180,7 @@ ENDSEC
|
|
this.panDelta.set(0, 0);
|
|
this.panDelta.set(0, 0);
|
|
}
|
|
}
|
|
|
|
|
|
- zoomToLocation(mouse){
|
|
|
|
|
|
+ /* zoomToLocation(mouse){
|
|
if(!this.enabled)return
|
|
if(!this.enabled)return
|
|
let camera = this.scene.getActiveCamera();
|
|
let camera = this.scene.getActiveCamera();
|
|
|
|
|
|
@@ -103190,27 +103190,27 @@ ENDSEC
|
|
this.viewer,
|
|
this.viewer,
|
|
this.scene.pointclouds,
|
|
this.scene.pointclouds,
|
|
{pickClipped: true});
|
|
{pickClipped: true});
|
|
-
|
|
|
|
|
|
+
|
|
if (I === null) {
|
|
if (I === null) {
|
|
return;
|
|
return;
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
let targetRadius = 0;
|
|
let targetRadius = 0;
|
|
{
|
|
{
|
|
let minimumJumpDistance = 0.2;
|
|
let minimumJumpDistance = 0.2;
|
|
|
|
|
|
let domElement = this.renderer.domElement;
|
|
let domElement = this.renderer.domElement;
|
|
- let ray = Utils.mouseToRay(this.viewer.inputHandler.pointer/* mouse */, camera, domElement.clientWidth, domElement.clientHeight);
|
|
|
|
|
|
+ let ray = Utils.mouseToRay(this.viewer.inputHandler.pointer , camera, domElement.clientWidth, domElement.clientHeight);
|
|
|
|
|
|
let nodes = I.pointcloud.nodesOnRay(I.pointcloud.visibleNodes, ray);
|
|
let nodes = I.pointcloud.nodesOnRay(I.pointcloud.visibleNodes, ray);
|
|
let lastNode = nodes[nodes.length - 1];
|
|
let lastNode = nodes[nodes.length - 1];
|
|
- let radius = lastNode.getBoundingSphere(new Sphere()).radius;
|
|
|
|
|
|
+ let radius = lastNode.getBoundingSphere(new THREE.Sphere()).radius;
|
|
targetRadius = Math.min(this.scene.view.radius, radius);
|
|
targetRadius = Math.min(this.scene.view.radius, radius);
|
|
targetRadius = Math.max(minimumJumpDistance, targetRadius);
|
|
targetRadius = Math.max(minimumJumpDistance, targetRadius);
|
|
}
|
|
}
|
|
|
|
|
|
let d = this.scene.view.direction.multiplyScalar(-1);
|
|
let d = this.scene.view.direction.multiplyScalar(-1);
|
|
- let cameraTargetPosition = new Vector3().addVectors(I.location, d.multiplyScalar(targetRadius));
|
|
|
|
|
|
+ let cameraTargetPosition = new THREE.Vector3().addVectors(I.location, d.multiplyScalar(targetRadius));
|
|
// TODO Unused: let controlsTargetPosition = I.location;
|
|
// TODO Unused: let controlsTargetPosition = I.location;
|
|
|
|
|
|
let animationDuration = 600;
|
|
let animationDuration = 600;
|
|
@@ -103243,7 +103243,23 @@ ENDSEC
|
|
|
|
|
|
tween.start();
|
|
tween.start();
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ } */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ zoomToLocation(mouse){
|
|
|
|
+ let I = viewer.inputHandler.intersect;
|
|
|
|
+ if(I){
|
|
|
|
+ I = I.location;
|
|
|
|
+ }
|
|
|
|
+ if(!I)return;
|
|
|
|
+
|
|
|
|
+ viewer.setView({position:I, duration:1000});
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
stopTweens () {
|
|
stopTweens () {
|
|
this.tweens.forEach(e => e.stop());
|
|
this.tweens.forEach(e => e.stop());
|