{"action":"opened","issue":{"url":"https://api.github.com/repos/kangax/fabric.js/issues/2662","labels_url":"https://api.github.com/repos/kangax/fabric.js/issues/2662/labels{/name}","comments_url":"https://api.github.com/repos/kangax/fabric.js/issues/2662/comments","events_url":"https://api.github.com/repos/kangax/fabric.js/issues/2662/events","html_url":"https://github.com/kangax/fabric.js/issues/2662","id":119664889,"number":2662,"title":"Missing callback calls when cloning objects","user":{"login":"Kitanotori","id":36138,"avatar_url":"https://avatars.githubusercontent.com/u/36138?v=3","gravatar_id":"","url":"https://api.github.com/users/Kitanotori","html_url":"https://github.com/Kitanotori","followers_url":"https://api.github.com/users/Kitanotori/followers","following_url":"https://api.github.com/users/Kitanotori/following{/other_user}","gists_url":"https://api.github.com/users/Kitanotori/gists{/gist_id}","starred_url":"https://api.github.com/users/Kitanotori/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kitanotori/subscriptions","organizations_url":"https://api.github.com/users/Kitanotori/orgs","repos_url":"https://api.github.com/users/Kitanotori/repos","events_url":"https://api.github.com/users/Kitanotori/events{/privacy}","received_events_url":"https://api.github.com/users/Kitanotori/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-01T08:17:11Z","updated_at":"2015-12-01T08:17:11Z","closed_at":null,"body":"When cloning canvas shapes (i.e. non-images), most of the respective 'fromObject' methods are missing calls to the callback function. I made a simple patch to the 'clone' method which fixed the issue in my case:\r\n\r\n    /**\r\n     * Clones an instance\r\n     * @param {Function} callback Callback is invoked with a clone as a first argument\r\n     * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output\r\n     * @return {fabric.Object} clone of an instance\r\n     */\r\n    clone: function(callback, propertiesToInclude) {\r\n      if (this.constructor.fromObject) {\r\n        var clone = this.constructor.fromObject(this.toObject(propertiesToInclude), callback);\r\n        clone && callback && callback(clone); // Most of the 'fromObject' methods fail to call the callback, so call it here instead\r\n        return clone;\r\n      }\r\n      return new fabric.Object(this.toObject(propertiesToInclude));\r\n    },"}}