igniteui-react-core
Version:
Ignite UI React Core.
204 lines (203 loc) • 6.18 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { __extends } from "tslib";
import { Base, INotifyPropertyChanged_$type, PropertyChangedEventArgs, runOn, markType } from "./type";
import { GlobalAnimationState } from "./GlobalAnimationState";
import { DOMExecutionContext } from "./DOMExecutionContext";
import { dateNow } from "./date";
/**
* @hidden
*/
var DoubleAnimator = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(DoubleAnimator, _super);
function DoubleAnimator(a, b, c) {
var _this = _super.call(this) || this;
_this.k = 0;
_this.p = 0;
_this.a = null;
_this.i = 0;
_this.j = 0;
_this._requestAnimationFrame = null;
_this.d = false;
_this.h = new Date();
_this.q = 0;
_this.propertyChanged = null;
_this.i = a;
_this.j = b;
_this.p = c;
_this.s();
return _this;
}
DoubleAnimator.prototype.get_g = function () {
return this.o == 0;
};
Object.defineProperty(DoubleAnimator.prototype, "g", {
get: function () {
return this.get_g();
},
enumerable: false,
configurable: true
});
DoubleAnimator.prototype.u = function (a) {
if (a == null) {
this.s();
}
else if (a.supportsAnimation()) {
this.requestAnimationFrame = a.getRequestAnimationFrame();
}
if (a != null) {
GlobalAnimationState.d.p(new DOMExecutionContext(a));
}
};
DoubleAnimator.prototype.t = function () {
this.y(true);
};
Object.defineProperty(DoubleAnimator.prototype, "o", {
get: function () {
return this.k;
},
set: function (a) {
this.k = a;
if (this.propertyChanged != null) {
this.propertyChanged(this, new PropertyChangedEventArgs("TransitionProgress"));
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(DoubleAnimator.prototype, "r", {
get: function () {
return this.p;
},
set: function (a) {
this.p = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DoubleAnimator.prototype, "b", {
get: function () {
return this.a;
},
set: function (a) {
this.a = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DoubleAnimator.prototype, "l", {
get: function () {
return this.i;
},
set: function (a) {
this.i = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DoubleAnimator.prototype, "n", {
get: function () {
return this.j;
},
set: function (a) {
this.j = a;
},
enumerable: false,
configurable: true
});
DoubleAnimator.prototype.s = function () {
this.requestAnimationFrame = (window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function (callback) {
window.setTimeout(callback, 1000 / 60);
});
};
Object.defineProperty(DoubleAnimator.prototype, "requestAnimationFrame", {
get: function () {
return this._requestAnimationFrame;
},
set: function (a) {
this._requestAnimationFrame = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DoubleAnimator.prototype, "e", {
get: function () {
return this.d;
},
set: function (a) {
this.d = a;
},
enumerable: false,
configurable: true
});
DoubleAnimator.prototype.v = function () {
this.k = 0;
this.q = 0;
this.h = dateNow();
if (!this.d) {
this.d = true;
this.requestAnimationFrame(runOn(this, this.x));
GlobalAnimationState.d.l();
}
};
DoubleAnimator.prototype.w = function () {
var a = this.d;
this.d = false;
this.k = 0;
this.q = 0;
if (a) {
GlobalAnimationState.d.k();
}
};
DoubleAnimator.prototype.x = function () {
this.y(false);
};
DoubleAnimator.prototype.y = function (a) {
if (!this.d) {
this.w();
return;
}
var b = dateNow();
var c = b.getTime() - this.h.getTime();
if (c > this.p) {
c = this.p;
}
if ((c - this.q < 16 && c != this.p) && !a) {
this.requestAnimationFrame(runOn(this, this.x));
return;
}
this.q = c;
var d = (c / this.p);
if (this.a != null) {
d = this.a(d);
}
var e = this.i + ((this.j - this.i) * d);
if (!a) {
if (c == this.p) {
this.w();
}
else {
this.requestAnimationFrame(runOn(this, this.x));
}
}
this.o = e;
};
DoubleAnimator.prototype.m = function () {
return this.d ? dateNow().getTime() - this.h.getTime() : 0;
};
DoubleAnimator.prototype.f = function () {
return this.d;
};
DoubleAnimator.$t = markType(DoubleAnimator, 'DoubleAnimator', Base.$, [INotifyPropertyChanged_$type]);
return DoubleAnimator;
}(Base));
export { DoubleAnimator };