|
@@ -73,13 +73,14 @@ class SplitScreen extends THREE.EventDispatcher{
|
|
|
viewportFitBound(viewport, bound, center, duration=0, margin){
|
|
|
let view = viewport.view
|
|
|
let info = {bound}
|
|
|
- let {boundSize, boundCenter} = this.getViewBound(viewport)
|
|
|
+
|
|
|
+ let {boundSize, boundCenter} = this.getViewBound(viewport, bound )
|
|
|
|
|
|
- this.setShiftTarget(viewport, boundCenter)
|
|
|
- /*
|
|
|
+ //this.setShiftTarget(viewport, boundCenter)
|
|
|
+
|
|
|
viewport.targetPlane.setFromNormalAndCoplanarPoint( view.direction.clone(), boundCenter )
|
|
|
viewport.targetPlane.projectPoint(center, viewport.shiftTarget) //target转换到过模型中心的平面,以保证镜头一定在模型外 this.shiftTarget是得到的
|
|
|
- */
|
|
|
+
|
|
|
info.endPosition = this.getPosOutOfModel(viewport, boundSize)
|
|
|
|
|
|
//if(viewport.name == 'mapViewport')info.endPosition.z = Math.max(Potree.config.map.cameraHeight, info.endPosition.z)
|
|
@@ -89,10 +90,17 @@ class SplitScreen extends THREE.EventDispatcher{
|
|
|
}
|
|
|
|
|
|
|
|
|
- getViewBound(viewport){
|
|
|
- let {boundSize, center} = viewer.bound
|
|
|
+ getViewBound(viewport, boundingBox){
|
|
|
+ if(boundingBox){
|
|
|
+ boundSize = boundingBox.getSize(new THREE.Vector3)
|
|
|
+ center = boundingBox.getCenter(new THREE.Vector3)
|
|
|
+ }else{
|
|
|
+ var {boundSize, center, boundingBox} = viewer.bound
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
if(viewport.viewContainsPoints){//视野范围内必须要包含的点,直接算入模型区域。这时候得到的boundCenter和模型中心不重合
|
|
|
- let boundingBox = viewer.bound.boundingBox.clone()
|
|
|
+ boundingBox = boundingBox.clone()
|
|
|
viewport.viewContainsPoints.forEach(point=>{
|
|
|
boundingBox.expandByPoint(point)
|
|
|
})
|
|
@@ -121,9 +129,9 @@ class SplitScreen extends THREE.EventDispatcher{
|
|
|
viewport.targetPlane.projectPoint(viewport.view.position, viewport.shiftTarget) //target转换到过模型中心的平面,以保证镜头一定在模型外 this.shiftTarget是得到的
|
|
|
*/
|
|
|
this.setShiftTarget(viewport, boundCenter)
|
|
|
- let endPosition = this.getPosOutOfModel(viewport, boundSize)
|
|
|
+ let endPosition = this.getPosOutOfModel(viewport, boundSize)
|
|
|
//if(viewport.name == 'mapViewport')endPosition.z = Math.max(Potree.config.map.cameraHeight, endPosition.z)
|
|
|
- viewport.view.position.copy(endPosition)
|
|
|
+ viewport.view.position.copy(endPosition)
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -187,7 +195,7 @@ class SplitScreen extends THREE.EventDispatcher{
|
|
|
|
|
|
viewer.updateScreenSize({forceUpdateSize:true})
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
unfocusViewport(){
|
|
|
if(!this.focusInfo)return
|
|
|
viewer.viewports.forEach((viewport, i )=>{
|