|
@@ -34314,16 +34314,25 @@ var BABYLON;
|
|
|
this._onLostFocus = function () {
|
|
|
_this._keys = [];
|
|
|
};
|
|
|
- element.addEventListener("keydown", this._onKeyDown, false);
|
|
|
- element.addEventListener("keyup", this._onKeyUp, false);
|
|
|
+ this._onFocus = function () {
|
|
|
+ element.addEventListener("keydown", _this._onKeyDown, false);
|
|
|
+ element.addEventListener("keyup", _this._onKeyUp, false);
|
|
|
+ };
|
|
|
+ this._onBlur = function () {
|
|
|
+ element.removeEventListener("keydown", _this._onKeyDown);
|
|
|
+ element.removeEventListener("keyup", _this._onKeyUp);
|
|
|
+ };
|
|
|
+ element.addEventListener("focus", this._onFocus);
|
|
|
+ element.addEventListener("blur", this._onBlur);
|
|
|
BABYLON.Tools.RegisterTopRootEvents([
|
|
|
{ name: "blur", handler: this._onLostFocus }
|
|
|
]);
|
|
|
};
|
|
|
ArcRotateCameraKeyboardMoveInput.prototype.detachControl = function (element) {
|
|
|
- if (element) {
|
|
|
- element.removeEventListener("keydown", this._onKeyDown);
|
|
|
- element.removeEventListener("keyup", this._onKeyUp);
|
|
|
+ if (element && this._onBlur) {
|
|
|
+ this._onBlur();
|
|
|
+ element.removeEventListener("focus", this._onFocus);
|
|
|
+ element.removeEventListener("blur", this._onBlur);
|
|
|
}
|
|
|
BABYLON.Tools.UnregisterTopRootEvents([
|
|
|
{ name: "blur", handler: this._onLostFocus }
|
|
@@ -34332,6 +34341,8 @@ var BABYLON;
|
|
|
this._onKeyDown = null;
|
|
|
this._onKeyUp = null;
|
|
|
this._onLostFocus = null;
|
|
|
+ this._onBlur = null;
|
|
|
+ this._onFocus = null;
|
|
|
};
|
|
|
ArcRotateCameraKeyboardMoveInput.prototype.checkInputs = function () {
|
|
|
if (this._onKeyDown) {
|
|
@@ -70189,7 +70200,7 @@ var BABYLON;
|
|
|
* Applies any current user interaction to the camera. Takes into account maximum alpha rotation.
|
|
|
*/
|
|
|
FramingBehavior.prototype._applyUserInteraction = function () {
|
|
|
- if (this._userIsMoving()) {
|
|
|
+ if (this.isUserIsMoving) {
|
|
|
this._lastInteractionTime = BABYLON.Tools.Now;
|
|
|
this.stopAllAnimations();
|
|
|
this._clearAnimationLocks();
|
|
@@ -70208,15 +70219,21 @@ var BABYLON;
|
|
|
this._animatables.shift();
|
|
|
}
|
|
|
};
|
|
|
- // Tools
|
|
|
- FramingBehavior.prototype._userIsMoving = function () {
|
|
|
- return this._attachedCamera.inertialAlphaOffset !== 0 ||
|
|
|
- this._attachedCamera.inertialBetaOffset !== 0 ||
|
|
|
- this._attachedCamera.inertialRadiusOffset !== 0 ||
|
|
|
- this._attachedCamera.inertialPanningX !== 0 ||
|
|
|
- this._attachedCamera.inertialPanningY !== 0 ||
|
|
|
- this._isPointerDown;
|
|
|
- };
|
|
|
+ Object.defineProperty(FramingBehavior.prototype, "isUserIsMoving", {
|
|
|
+ /**
|
|
|
+ * Gets a value indicating if the user is moving the camera
|
|
|
+ */
|
|
|
+ get: function () {
|
|
|
+ return this._attachedCamera.inertialAlphaOffset !== 0 ||
|
|
|
+ this._attachedCamera.inertialBetaOffset !== 0 ||
|
|
|
+ this._attachedCamera.inertialRadiusOffset !== 0 ||
|
|
|
+ this._attachedCamera.inertialPanningX !== 0 ||
|
|
|
+ this._attachedCamera.inertialPanningY !== 0 ||
|
|
|
+ this._isPointerDown;
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
/**
|
|
|
* The easing function used by animations
|
|
|
*/
|
|
@@ -70403,6 +70420,7 @@ var BABYLON;
|
|
|
this._isPointerDown = false;
|
|
|
this._lastFrameTime = null;
|
|
|
this._lastInteractionTime = -Infinity;
|
|
|
+ this._cameraRotationSpeed = 0;
|
|
|
this._lastFrameRadius = 0;
|
|
|
}
|
|
|
Object.defineProperty(AutoRotationBehavior.prototype, "name", {
|
|
@@ -70476,6 +70494,16 @@ var BABYLON;
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
+ Object.defineProperty(AutoRotationBehavior.prototype, "rotationInProgress", {
|
|
|
+ /**
|
|
|
+ * Gets a value indicating if the camera is currently rotating because of this behavior
|
|
|
+ */
|
|
|
+ get: function () {
|
|
|
+ return this._cameraRotationSpeed > 0;
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
AutoRotationBehavior.prototype.attach = function (camera) {
|
|
|
var _this = this;
|
|
|
this._attachedCamera = camera;
|
|
@@ -70500,9 +70528,9 @@ var BABYLON;
|
|
|
_this._applyUserInteraction();
|
|
|
var timeToRotation = now - _this._lastInteractionTime - _this._idleRotationWaitTime;
|
|
|
var scale = Math.max(Math.min(timeToRotation / (_this._idleRotationSpinupTime), 1), 0);
|
|
|
- var cameraRotationSpeed = _this._idleRotationSpeed * scale;
|
|
|
+ _this._cameraRotationSpeed = _this._idleRotationSpeed * scale;
|
|
|
// Step camera rotation by rotation speed
|
|
|
- _this._attachedCamera.alpha -= cameraRotationSpeed * (dt / 1000);
|
|
|
+ _this._attachedCamera.alpha -= _this._cameraRotationSpeed * (dt / 1000);
|
|
|
});
|
|
|
};
|
|
|
AutoRotationBehavior.prototype.detach = function (camera) {
|