|
@@ -63766,7 +63766,7 @@ void main() {
|
|
|
modelEditing.updateMatrixWorld()
|
|
|
let boundCenter = modelEditing.boundingBox.getCenter(new THREE.Vector3).applyMatrix4(modelEditing.matrixWorld);
|
|
|
*/
|
|
|
- MergeEditor.moveBoundCenterTo(new Vector2$1(x,y)); //使模型中心在鼠标所在位置
|
|
|
+ MergeEditor.moveBoundCenter(new Vector2$1(x,y, model.boundCenter.z)); //使模型中心的xy在鼠标所在位置
|
|
|
|
|
|
|
|
|
model.dispatchEvent("position_changed");
|
|
@@ -63814,7 +63814,7 @@ void main() {
|
|
|
updateBound();
|
|
|
};
|
|
|
model.addEventListener('position_changed', ()=>{
|
|
|
- MergeEditor.getBoundCenterXY(model);//更新boundcenter
|
|
|
+ MergeEditor.getBoundCenter(model);//更新boundcenter
|
|
|
updateBound();
|
|
|
});
|
|
|
model.addEventListener("orientation_changed", maintainBtmZAndCenter );
|
|
@@ -63825,7 +63825,7 @@ void main() {
|
|
|
model.updateMatrixWorld();
|
|
|
viewer.updateModelBound();
|
|
|
|
|
|
- MergeEditor.getBoundCenterXY(model); //初始化
|
|
|
+ MergeEditor.getBoundCenter(model); //初始化
|
|
|
|
|
|
done(model);
|
|
|
};
|
|
@@ -103278,8 +103278,8 @@ ENDSEC
|
|
|
let panDistance = progression * view.radius * 3; */
|
|
|
let camera = this.scene.getActiveCamera();
|
|
|
let panDistance = 2 * view.radius * Math.tan(MathUtils.degToRad(camera.fov / 2));//参照4dkk。 平移target(也就是平移镜头位置),但还是难以保证跟手(navvis也不一定跟手,但是很奇怪在居中时中心点居然是跟手的,可能计算方式不同)
|
|
|
+ //计算了下确实是这么算的。 平移pivot。
|
|
|
|
|
|
-
|
|
|
let px = -this.panDelta.x * panDistance;
|
|
|
let py = this.panDelta.y * panDistance;
|
|
|
|
|
@@ -114959,11 +114959,11 @@ ENDSEC
|
|
|
init(){
|
|
|
|
|
|
{
|
|
|
- let ground = this.ground = new InfiniteGridHelper(1, 1000, new Color('#fff'), 1000, 0.2, 0.3);
|
|
|
+ let ground = this.ground = new InfiniteGridHelper(1, 10000, new Color('#fff'), 10000, 0.2, 0.3);
|
|
|
viewer.scene.scene.add(ground);
|
|
|
//再加两条线否则在正侧边看不到
|
|
|
- let line1 = LineDraw.createLine([new Vector3(-1000, 0, 0),new Vector3(1000, 0, 0) ], {color:'#666'});
|
|
|
- let line2 = LineDraw.createLine([new Vector3(0, -1000, 0),new Vector3(0, 1000, 0) ], {color:'#666'});
|
|
|
+ let line1 = LineDraw.createLine([new Vector3(-10000, 0, 0),new Vector3(10000, 0, 0) ], {color:'#666'});
|
|
|
+ let line2 = LineDraw.createLine([new Vector3(0, -10000, 0),new Vector3(0, 10000, 0) ], {color:'#666'});
|
|
|
ground.renderOrder = line1.renderOrder + 1;
|
|
|
ground.add(line1);
|
|
|
ground.add(line2);
|
|
@@ -115105,26 +115105,24 @@ ENDSEC
|
|
|
maintainBoundXY(model){ //在旋转和缩放后,立即执行这个函数,使boundCenter保持原位
|
|
|
|
|
|
model.updateMatrixWorld();
|
|
|
- let center1 = model.boundCenterXY.clone();//还未更新的
|
|
|
- this.getBoundCenterXY(model);//更新
|
|
|
- let center2 = model.boundCenterXY.clone();
|
|
|
+ let center1 = model.boundCenter.clone();//还未更新的
|
|
|
+ this.getBoundCenter(model);//更新
|
|
|
+ let center2 = model.boundCenter.clone();
|
|
|
let diff = new Vector2$1().subVectors(center1,center2);
|
|
|
model.position.x += diff.x;
|
|
|
model.position.y += diff.y;
|
|
|
/* model.updateMatrixWorld()
|
|
|
this.getBoundCenterXY(model)//再次更新,它需要和center1相同 */
|
|
|
- model.boundCenterXY = center1;
|
|
|
+ model.boundCenter = center1;
|
|
|
},
|
|
|
|
|
|
- moveBoundCenterTo(model,pos){ //水平移动,使boundCenter在所要的位置
|
|
|
- let diff = new Vector2$1().subVectors(pos, model.boundCenterXY);
|
|
|
- model.position.x += diff.x;
|
|
|
- model.position.y += diff.y;
|
|
|
+ moveBoundCenterTo(model,pos){ //使boundCenter在所要的位置
|
|
|
+ let diff = new Vector3().subVectors(pos, model.boundCenter);
|
|
|
+ model.position.add(diff);
|
|
|
},
|
|
|
|
|
|
- getBoundCenterXY(model){
|
|
|
- let boundCenter = model.boundingBox.getCenter(new Vector3).applyMatrix4(model.matrixWorld);
|
|
|
- model.boundCenterXY = new Vector2$1().copy(boundCenter);
|
|
|
+ getBoundCenter(model){
|
|
|
+ model.boundCenter = model.boundingBox.getCenter(new Vector3).applyMatrix4(model.matrixWorld);
|
|
|
}
|
|
|
|
|
|
};
|