From 48a6c9c67ff6f1afe90c2b2495ff701547de205a Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Sun, 7 Aug 2016 22:30:05 +0200 Subject: [PATCH] fix insert at (#3146) --- src/mixins/canvas_serialization.mixin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mixins/canvas_serialization.mixin.js b/src/mixins/canvas_serialization.mixin.js index 9781f50b70e..514c8cf2e04 100644 --- a/src/mixins/canvas_serialization.mixin.js +++ b/src/mixins/canvas_serialization.mixin.js @@ -155,7 +155,9 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati fabric.util.enlivenObjects(objects, function(enlivenedObjects) { enlivenedObjects.forEach(function(obj, index) { - _this.insertAt(obj, index, true); + // we splice the array just in case some custom classes restored from JSON + // will add more object to canvas at canvas init. + _this.insertAt(obj, index); }); _this.renderOnAddRemove = renderOnAddRemove;