vs_utils.defineClassProperty (Canvas, "size", { /** * Getter|Setter for size. Gives access to the size of the vs.ui.Canvas * @name vs.ui.Canvas#size * * @type {Array.<number>} */ set : function (v) { if (!v) { return; } if (!vs_utils.isArray (v) || v.length !== 2) { return; } if (!vs_utils.isNumber (v[0]) || !vs_utils.isNumber(v[1])) { return; } this._size [0] = v [0]; this._size [1] = v [1]; if (!this.view) { return; } this._updateSizeAndPos (); if (!this.canvas_node) { this.canvas_node = this.view.firstChild; if (!this.canvas_node) { console.error ('Uncompatible canvas view'); return; } this.canvas_ctx = this.canvas_node.getContext ('2d'); } this.canvas_node.width = this._size [0]; this.canvas_node.height = this._size [1]; this.draw (0, 0, this._size [0], this._size [1]); }, /** * @ignore * @type {Array.<number>} */ get : function () { if (this.view && this.view.parentNode) { this._size [0] = this.view.offsetWidth; this._size [1] = this.view.offsetHeight; } return this._size.slice (); } });
defineClassProperty (Fsm, "initialState", { /** * Define the initiale state * Generate a exception if the state was not already defined * * @name vs.core.Fsm#initialState * @param {string} state_id the state */ set : function (state_id) { if (!state_id) { this._initial_state = undefined; return; } if (!this.existState (state_id)) { return; } // set initial state and go to it this._initial_state = state_id; }, /** * @ignore */ get : function () { return this._initial_state; } });