Skip to content

Commit

Permalink
restored path restore from string
Browse files Browse the repository at this point in the history
  • Loading branch information
asturur committed Jun 11, 2017
1 parent 3987c96 commit 69f37b0
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/shapes/path.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,21 @@
* @param {Boolean} [forceAsync] Force an async behaviour trying to create pattern first
*/
fabric.Path.fromObject = function(object, callback, forceAsync) {
return fabric.Object._fromObject('Path', object, callback, forceAsync, 'path');
if (typeof object.path === 'string') {
var pathUrl = object.path;
fabric.loadSVGFromURL(pathUrl, function (elements) {
var path = elements[0];
delete object.path;

path.setOptions(object);
path.setSourcePath(pathUrl);

callback && callback(path);
});
}
else {
return fabric.Object._fromObject('Path', object, callback, forceAsync, 'path');
}
};

/* _FROM_SVG_START_ */
Expand Down

0 comments on commit 69f37b0

Please sign in to comment.