mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-22 04:11:52 +00:00
Add support for passing additional state properties into saveState
This commit is contained in:
parent
293227811f
commit
638876f3f8
1 changed files with 9 additions and 1 deletions
|
|
@ -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;
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue