Add support for passing additional state properties into saveState

This commit is contained in:
kangax 2013-03-02 01:25:08 +01:00
parent 293227811f
commit 638876f3f8

View file

@ -792,13 +792,21 @@
/**
* Saves state of an object
* @method saveState
* @param {Object} [options] Object with additional `stateProperties` array to include when saving state
* @return {fabric.Object} thisArg
* @chainable
*/
saveState: function() {
saveState: function(options) {
this.stateProperties.forEach(function(prop) {
this.originalState[prop] = this.get(prop);
}, this);
if (options && options.stateProperties) {
options.stateProperties.forEach(function(prop) {
this.originalState[prop] = this.get(prop);
}, this);
}
return this;
},