|
|
@ -116,6 +116,7 @@ export class CameraControls
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//触屏开始事件(点击操作区和点击虚拟鼠标中间时可触发)
|
|
|
|
//触屏开始事件(点击操作区和点击虚拟鼠标中间时可触发)
|
|
|
|
|
|
|
|
private _TouchScaleCenter = new Vector3;
|
|
|
|
onTouchStart = (event: Touch_Event) =>
|
|
|
|
onTouchStart = (event: Touch_Event) =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.Viewer.UpdateLockTarget();
|
|
|
|
this.Viewer.UpdateLockTarget();
|
|
|
@ -128,6 +129,10 @@ export class CameraControls
|
|
|
|
let dy = event.touches[0].pageY - event.touches[1].pageY;
|
|
|
|
let dy = event.touches[0].pageY - event.touches[1].pageY;
|
|
|
|
let distance = Math.sqrt(dx * dx + dy * dy);
|
|
|
|
let distance = Math.sqrt(dx * dx + dy * dy);
|
|
|
|
this.DollyStart.set(0, distance);
|
|
|
|
this.DollyStart.set(0, distance);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let rect = (event.target as HTMLElement).getBoundingClientRect();
|
|
|
|
|
|
|
|
this._TouchScaleCenter.set((event.touches[0].clientX + event.touches[1].clientX) * 0.5 - rect.left, (event.touches[0].clientY + event.touches[1].clientY) * 0.5 - rect.top, 0);
|
|
|
|
|
|
|
|
this.Viewer.ScreenToWorld(this._TouchScaleCenter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.State_Touch = this.TouchTypeList[event.touches.length - 1];
|
|
|
|
this.State_Touch = this.TouchTypeList[event.touches.length - 1];
|
|
|
@ -166,13 +171,9 @@ export class CameraControls
|
|
|
|
let distance = Math.sqrt(dx * dx + dy * dy);
|
|
|
|
let distance = Math.sqrt(dx * dx + dy * dy);
|
|
|
|
this.DollyEnd.set(0, distance);
|
|
|
|
this.DollyEnd.set(0, distance);
|
|
|
|
if (distance > this.DollyStart.y)
|
|
|
|
if (distance > this.DollyStart.y)
|
|
|
|
{
|
|
|
|
this.Viewer.Zoom(0.95, this._TouchScaleCenter);
|
|
|
|
this.Viewer.Zoom(0.95);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this.Viewer.Zoom(1.05, this._TouchScaleCenter);
|
|
|
|
this.Viewer.Zoom(1.05);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.DollyStart.copy(this.DollyEnd);
|
|
|
|
this.DollyStart.copy(this.DollyEnd);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|