|
@@ -34,6 +34,7 @@ var BABYLON;
|
|
this.keysRight = [39];
|
|
this.keysRight = [39];
|
|
this.zoomOnFactor = 1;
|
|
this.zoomOnFactor = 1;
|
|
this.targetScreenOffset = BABYLON.Vector2.Zero();
|
|
this.targetScreenOffset = BABYLON.Vector2.Zero();
|
|
|
|
+ this.pinchInwards = true;
|
|
this._keys = [];
|
|
this._keys = [];
|
|
this._viewMatrix = new BABYLON.Matrix();
|
|
this._viewMatrix = new BABYLON.Matrix();
|
|
this.checkCollisions = false;
|
|
this.checkCollisions = false;
|
|
@@ -138,7 +139,7 @@ var BABYLON;
|
|
//if (noPreventDefault) { evt.preventDefault(); } //if pinch gesture, could be usefull to force preventDefault to avoid html page scroll/zoom in some mobile browsers
|
|
//if (noPreventDefault) { evt.preventDefault(); } //if pinch gesture, could be usefull to force preventDefault to avoid html page scroll/zoom in some mobile browsers
|
|
pointers.item(evt.pointerId).x = evt.clientX;
|
|
pointers.item(evt.pointerId).x = evt.clientX;
|
|
pointers.item(evt.pointerId).y = evt.clientY;
|
|
pointers.item(evt.pointerId).y = evt.clientY;
|
|
- var direction = 1;
|
|
|
|
|
|
+ var direction = _this.pinchInwards ? 1 : -1;
|
|
var distX = pointers.getItemByIndex(0).x - pointers.getItemByIndex(1).x;
|
|
var distX = pointers.getItemByIndex(0).x - pointers.getItemByIndex(1).x;
|
|
var distY = pointers.getItemByIndex(0).y - pointers.getItemByIndex(1).y;
|
|
var distY = pointers.getItemByIndex(0).y - pointers.getItemByIndex(1).y;
|
|
var pinchSquaredDistance = (distX * distX) + (distY * distY);
|
|
var pinchSquaredDistance = (distX * distX) + (distY * distY);
|
|
@@ -147,10 +148,7 @@ var BABYLON;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (pinchSquaredDistance !== previousPinchDistance) {
|
|
if (pinchSquaredDistance !== previousPinchDistance) {
|
|
- if (pinchSquaredDistance > previousPinchDistance) {
|
|
|
|
- direction = -1;
|
|
|
|
- }
|
|
|
|
- _this.inertialRadiusOffset += (pinchSquaredDistance - previousPinchDistance) / (_this.pinchPrecision * _this.wheelPrecision * _this.angularSensibility);
|
|
|
|
|
|
+ _this.inertialRadiusOffset += (pinchSquaredDistance - previousPinchDistance) / (_this.pinchPrecision * _this.wheelPrecision * _this.angularSensibility * direction);
|
|
previousPinchDistance = pinchSquaredDistance;
|
|
previousPinchDistance = pinchSquaredDistance;
|
|
}
|
|
}
|
|
break;
|
|
break;
|