|
@@ -59,6 +59,15 @@ export class ArcRotateCameraPointersInput extends BaseCameraPointersInput {
|
|
|
public pinchDeltaPercentage = 0;
|
|
|
|
|
|
/**
|
|
|
+ * When useNaturalPinchZoom is true, multi touch zoom will zoom in such
|
|
|
+ * that any object in the plane at the camera's target point will scale
|
|
|
+ * perfectly with finger motion.
|
|
|
+ * Overrides pinchDeltaPercentage and pinchPrecision.
|
|
|
+ */
|
|
|
+ @serialize()
|
|
|
+ public useNaturalPinchZoom: boolean = false;
|
|
|
+
|
|
|
+ /**
|
|
|
* Defines the pointer panning sensibility or how fast is the camera moving.
|
|
|
*/
|
|
|
@serialize()
|
|
@@ -135,11 +144,15 @@ export class ArcRotateCameraPointersInput extends BaseCameraPointersInput {
|
|
|
var direction = this.pinchInwards ? 1 : -1;
|
|
|
|
|
|
if (this.multiTouchPanAndZoom) {
|
|
|
- if (this.pinchDeltaPercentage) {
|
|
|
+ if (this.useNaturalPinchZoom) {
|
|
|
+ this.camera.radius = this.camera.radius *
|
|
|
+ Math.sqrt(previousPinchSquaredDistance) / Math.sqrt(pinchSquaredDistance);
|
|
|
+ } else if (this.pinchDeltaPercentage) {
|
|
|
this.camera.inertialRadiusOffset +=
|
|
|
(pinchSquaredDistance - previousPinchSquaredDistance) * 0.001 *
|
|
|
this.camera.radius * this.pinchDeltaPercentage;
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
this.camera.inertialRadiusOffset +=
|
|
|
(pinchSquaredDistance - previousPinchSquaredDistance) /
|
|
|
(this.pinchPrecision * direction *
|