diff --git a/src/shapes/rect.class.js b/src/shapes/rect.class.js index 62177b0b..4806ba81 100644 --- a/src/shapes/rect.class.js +++ b/src/shapes/rect.class.js @@ -10,6 +10,9 @@ return; } + var stateProperties = fabric.Object.prototype.stateProperties.concat(); + stateProperties.push('rx', 'ry'); + /** * Rectangle class * @class fabric.Rect @@ -18,6 +21,13 @@ */ fabric.Rect = fabric.util.createClass(fabric.Object, /** @lends fabric.Rect.prototype */ { + /** + * List of properties to consider when checking if state of an object is changed ({@link fabric.Object#hasStateChanged}) + * as well as for history (undo/redo) purposes + * @type Array + */ + stateProperties: stateProperties, + /** * Type of an object * @type String @@ -53,7 +63,6 @@ initialize: function(options) { options = options || { }; - this._initStateProperties(); this.callSuper('initialize', options); this._initRxRy(); @@ -61,15 +70,6 @@ this.y = options.y || 0; }, - /** - * Creates `stateProperties` list on an instance, and adds `fabric.Rect` -specific ones to it - * (such as "rx", "ry", etc.) - * @private - */ - _initStateProperties: function() { - this.stateProperties = this.stateProperties.concat(['rx', 'ry']); - }, - /** * Initializes rx/ry attributes * @private