Blame view

node_modules/zrender/src/graphic/mixin/Stateful.js 679 Bytes
aaac7fed   liuqimichale   add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  /**
   * Stateful mixin for graphic object
   */
  
  import States from '../States';
  
  var Stateful = function (opts) {
  
      if (opts.states) {
          this.initStates(opts.states);
      }
  };
  
  Stateful.prototype = {
  
      initStates: function (states) {
          this._states = new States({
              el: this,
              states: states
          });
      },
  
      setState: function (name) {
          this._states && this._states.setState(name);
      },
  
      getState: function () {
          return this._states && this._states.getState();
      },
  
      transitionState: function (name, done) {
          this._states && this._states.transitionState(name, done);
      }
  };
  
  export default Stateful;