| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /**
- * DevExtreme (ui/scroll_view/animator.js)
- * Version: 19.1.16
- * Build date: Tue Oct 18 2022
- *
- * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
- * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
- */
- "use strict";
- var noop = require("../../core/utils/common").noop;
- var Class = require("../../core/class");
- var abstract = Class.abstract;
- var animationFrame = require("../../animation/frame");
- var Animator = Class.inherit({
- ctor: function() {
- this._finished = true;
- this._stopped = false;
- this._proxiedStepCore = this._stepCore.bind(this)
- },
- start: function() {
- this._stopped = false;
- this._finished = false;
- this._stepCore()
- },
- stop: function() {
- this._stopped = true;
- animationFrame.cancelAnimationFrame(this._stepAnimationFrame)
- },
- _stepCore: function() {
- if (this._isStopped()) {
- this._stop();
- return
- }
- if (this._isFinished()) {
- this._finished = true;
- this._complete();
- return
- }
- this._step();
- this._stepAnimationFrame = animationFrame.requestAnimationFrame(this._proxiedStepCore)
- },
- _step: abstract,
- _isFinished: noop,
- _stop: noop,
- _complete: noop,
- _isStopped: function() {
- return this._stopped
- },
- inProgress: function() {
- return !(this._stopped || this._finished)
- }
- });
- module.exports = Animator;
|