优化:双指移动时轻微防抖

pull/2045/MERGE
ChenX 2 years ago
parent eac024e5f2
commit 56c03c18bd

@ -1,5 +1,6 @@
import { Vector3 } from 'three';
import { KeyBoard, MouseKey } from '../Common/KeyEnum';
import { equaln } from '../Geometry/GeUtils';
import { CameraType } from '../GraphicsSystem/CameraUpdate';
import { Viewer } from '../GraphicsSystem/Viewer';
import { CommandStore } from '../UI/Store/CommandStore';
@ -170,8 +171,11 @@ export class CameraControls
let dy = event.touches[0].pageY - event.touches[1].pageY;
let distance = Math.sqrt(dx * dx + dy * dy);
this.Viewer.Zoom(this.DollyStart / distance, this._TouchScaleCenterWCS);
this.DollyStart = distance;
if (!equaln(this.DollyStart / distance, 1, 0.05))//轻微防抖
{
this.Viewer.Zoom(this.DollyStart / distance, this._TouchScaleCenterWCS);
this.DollyStart = distance;
}
//move
let nowCenter = new Vector3((event.touches[0].clientX + event.touches[1].clientX) * 0.5, (event.touches[0].clientY + event.touches[1].clientY) * 0.5, 0);

Loading…
Cancel
Save