Debounce element parsing. Thanks @biovisualize. Closes #1052

This commit is contained in:
kangax 2013-12-14 12:19:36 +01:00
parent dbbd4b2fa7
commit dbd9193703
6 changed files with 24 additions and 10 deletions

6
dist/fabric.js vendored
View file

@ -3421,7 +3421,11 @@ fabric.ElementsParser = {
createObjects: function() {
for (var i = 0, len = this.elements.length; i < len; i++) {
this.createObject(this.elements[i], i);
(function(_this, i) {
setTimeout(function() {
_this.createObject(_this.elements[i], i);
}, 0);
})(this, i);
}
},

14
dist/fabric.min.js vendored

File diff suppressed because one or more lines are too long

BIN
dist/fabric.min.js.gz vendored

Binary file not shown.

View file

@ -3421,7 +3421,11 @@ fabric.ElementsParser = {
createObjects: function() {
for (var i = 0, len = this.elements.length; i < len; i++) {
this.createObject(this.elements[i], i);
(function(_this, i) {
setTimeout(function() {
_this.createObject(_this.elements[i], i);
}, 0);
})(this, i);
}
},

View file

@ -15,7 +15,11 @@ fabric.ElementsParser = {
createObjects: function() {
for (var i = 0, len = this.elements.length; i < len; i++) {
this.createObject(this.elements[i], i);
(function(_this, i) {
setTimeout(function() {
_this.createObject(_this.elements[i], i);
}, 0);
})(this, i);
}
},

View file

@ -476,6 +476,8 @@
asyncTest('fabric.util.groupSVGElements', function() {
ok(typeof fabric.util.groupSVGElements == 'function');
stop();
var group1, group2;
fabric.loadSVGFromString(SVG_WITH_1_ELEMENT, function(objects, options) {
group1 = fabric.util.groupSVGElements(objects, options);