mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-08 22:04:44 +00:00
Add custom object properties to clone function.
This commit is contained in:
parent
5608e17b1a
commit
5bf42c099f
1 changed files with 3 additions and 2 deletions
|
|
@ -170,9 +170,10 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
|
|||
/**
|
||||
* Clones canvas instance
|
||||
* @param {Object} [callback] Receives cloned instance as a first argument
|
||||
* @param {Array} [properties] Array of properties to include in the cloned canvas and children
|
||||
*/
|
||||
clone: function (callback) {
|
||||
var data = JSON.stringify(this);
|
||||
clone: function (callback, properties) {
|
||||
var data = JSON.stringify(this.toJSON(properties));
|
||||
this.cloneWithoutData(function(clone) {
|
||||
clone.loadFromJSON(data, function() {
|
||||
callback && callback(clone);
|
||||
|
|
|
|||
Loading…
Reference in a new issue