mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-02 11:04:43 +00:00
restored path restore from string
This commit is contained in:
parent
3987c962dd
commit
69f37b0a4f
1 changed files with 15 additions and 1 deletions
|
|
@ -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_ */
|
||||
|
|
|
|||
Loading…
Reference in a new issue