|
@@ -12,6 +12,12 @@ module BABYLON {
|
|
public angularSensibilityY = 1000.0;
|
|
public angularSensibilityY = 1000.0;
|
|
|
|
|
|
@serialize()
|
|
@serialize()
|
|
|
|
+ public angularTouchSensibilityX = this.angularSensibilityX;
|
|
|
|
+
|
|
|
|
+ @serialize()
|
|
|
|
+ public angularTouchSensibilityY = this.angularSensibilityY;
|
|
|
|
+
|
|
|
|
+ @serialize()
|
|
public pinchPrecision = 12.0;
|
|
public pinchPrecision = 12.0;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -33,6 +39,9 @@ module BABYLON {
|
|
private _isPanClick: boolean = false;
|
|
private _isPanClick: boolean = false;
|
|
public pinchInwards = true;
|
|
public pinchInwards = true;
|
|
|
|
|
|
|
|
+ private _angularSensibilityX = this.angularSensibilityX;
|
|
|
|
+ private _angularSensibilityY = this.angularSensibilityY;
|
|
|
|
+
|
|
private _pointerInput: (p: PointerInfo, s: EventState) => void;
|
|
private _pointerInput: (p: PointerInfo, s: EventState) => void;
|
|
private _observer: Nullable<Observer<PointerInfo>>;
|
|
private _observer: Nullable<Observer<PointerInfo>>;
|
|
private _onMouseMove: Nullable<(e: MouseEvent) => any>;
|
|
private _onMouseMove: Nullable<(e: MouseEvent) => any>;
|
|
@@ -54,7 +63,11 @@ module BABYLON {
|
|
|
|
|
|
this._pointerInput = (p, s) => {
|
|
this._pointerInput = (p, s) => {
|
|
var evt = <PointerEvent>p.event;
|
|
var evt = <PointerEvent>p.event;
|
|
-
|
|
|
|
|
|
+ let isTouch = (<any>p.event).pointerType === "touch";
|
|
|
|
+
|
|
|
|
+ this._angularSensibilityX = isTouch ? this.angularTouchSensibilityX : this.angularSensibilityX;
|
|
|
|
+ this._angularSensibilityY = isTouch ? this.angularTouchSensibilityY : this.angularSensibilityY;
|
|
|
|
+
|
|
if (engine.isInVRExclusivePointerMode) {
|
|
if (engine.isInVRExclusivePointerMode) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -105,7 +118,7 @@ module BABYLON {
|
|
twoFingerActivityCount = 0;
|
|
twoFingerActivityCount = 0;
|
|
initialDistance = 0;
|
|
initialDistance = 0;
|
|
|
|
|
|
- if ((<any>p.event).pointerType !== "touch") {
|
|
|
|
|
|
+ if (!isTouch) {
|
|
pointB = null; // Mouse and pen are mono pointer
|
|
pointB = null; // Mouse and pen are mono pointer
|
|
}
|
|
}
|
|
|
|
|
|
@@ -150,8 +163,8 @@ module BABYLON {
|
|
} else {
|
|
} else {
|
|
var offsetX = evt.clientX - cacheSoloPointer.x;
|
|
var offsetX = evt.clientX - cacheSoloPointer.x;
|
|
var offsetY = evt.clientY - cacheSoloPointer.y;
|
|
var offsetY = evt.clientY - cacheSoloPointer.y;
|
|
- this.camera.inertialAlphaOffset -= offsetX / this.angularSensibilityX;
|
|
|
|
- this.camera.inertialBetaOffset -= offsetY / this.angularSensibilityY;
|
|
|
|
|
|
+ this.camera.inertialAlphaOffset -= offsetX / this._angularSensibilityX;
|
|
|
|
+ this.camera.inertialBetaOffset -= offsetY / this._angularSensibilityY;
|
|
}
|
|
}
|
|
|
|
|
|
cacheSoloPointer.x = evt.clientX;
|
|
cacheSoloPointer.x = evt.clientX;
|
|
@@ -184,7 +197,7 @@ module BABYLON {
|
|
} else {
|
|
} else {
|
|
this.camera.inertialRadiusOffset += (pinchSquaredDistance - previousPinchSquaredDistance) /
|
|
this.camera.inertialRadiusOffset += (pinchSquaredDistance - previousPinchSquaredDistance) /
|
|
(this.pinchPrecision *
|
|
(this.pinchPrecision *
|
|
- ((this.angularSensibilityX + this.angularSensibilityY) / 2) *
|
|
|
|
|
|
+ ((this._angularSensibilityX + this._angularSensibilityY) / 2) *
|
|
direction);
|
|
direction);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -210,7 +223,7 @@ module BABYLON {
|
|
} else {
|
|
} else {
|
|
this.camera.inertialRadiusOffset += (pinchSquaredDistance - previousPinchSquaredDistance) /
|
|
this.camera.inertialRadiusOffset += (pinchSquaredDistance - previousPinchSquaredDistance) /
|
|
(this.pinchPrecision *
|
|
(this.pinchPrecision *
|
|
- ((this.angularSensibilityX + this.angularSensibilityY) / 2) *
|
|
|
|
|
|
+ ((this._angularSensibilityX + this._angularSensibilityY) / 2) *
|
|
direction);
|
|
direction);
|
|
}
|
|
}
|
|
previousMultiTouchPanPosition.isPaning = false;
|
|
previousMultiTouchPanPosition.isPaning = false;
|