var States = require("./States");
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
* @class qrenderer.graphic.Stateful
*
* Stateful mixin for graphic object
*
* @docauthor 大漠穷秋 <damoqiongqiu@126.com>
*/
var Stateful =
/*#__PURE__*/
function () {
function Stateful(opts) {
_classCallCheck(this, Stateful);
if (opts.states) {
this.initStates(opts.states);
}
}
_createClass(Stateful, [{
key: "initStates",
value: function initStates(states) {
this._states = new States({
el: this,
states: states
});
}
}, {
key: "setState",
value: function setState(name) {
this._states && this._states.setState(name);
}
}, {
key: "getState",
value: function getState() {
return this._states && this._states.getState();
}
}, {
key: "transitionState",
value: function transitionState(name, done) {
this._states && this._states.transitionState(name, done);
}
}]);
return Stateful;
}();
var _default = Stateful;
module.exports = _default;