mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-22 15:04:41 +00:00
Update elements_parser.js
This commit is contained in:
parent
066eb54d30
commit
a70321f9a8
1 changed files with 4 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ fabric.ElementsParser = function(elements, callback, options, reviver) {
|
|||
this.callback = callback;
|
||||
this.options = options;
|
||||
this.reviver = reviver;
|
||||
this.svgUid = (options && options.svgUid) || 0;
|
||||
};
|
||||
|
||||
fabric.ElementsParser.prototype.parse = function() {
|
||||
|
|
@ -14,6 +15,7 @@ fabric.ElementsParser.prototype.parse = function() {
|
|||
|
||||
fabric.ElementsParser.prototype.createObjects = function() {
|
||||
for (var i = 0, len = this.elements.length; i < len; i++) {
|
||||
this.elements[i].setAttribute('svgUid', this.svgUid);
|
||||
(function(_this, i) {
|
||||
setTimeout(function() {
|
||||
_this.createObject(_this.elements[i], i);
|
||||
|
|
@ -69,9 +71,9 @@ fabric.ElementsParser.prototype.resolveGradient = function(obj, property) {
|
|||
return;
|
||||
}
|
||||
var gradientId = instanceFillValue.slice(5, instanceFillValue.length - 1);
|
||||
if (fabric.gradientDefs[gradientId]) {
|
||||
if (fabric.gradientDefs[this.svgUid][gradientId]) {
|
||||
obj.set(property,
|
||||
fabric.Gradient.fromElement(fabric.gradientDefs[gradientId], obj));
|
||||
fabric.Gradient.fromElement(fabric.gradientDefs[this.svgUid][gradientId], obj));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue