diff --git a/src/static_canvas.class.js b/src/static_canvas.class.js index 95e25b7f..324db5bc 100644 --- a/src/static_canvas.class.js +++ b/src/static_canvas.class.js @@ -959,14 +959,22 @@ * @return {Object} removed object */ remove: function (object) { - removeFromArray(this._objects, object); + // removing active object should fire "selection:cleared" events if (this.getActiveObject() === object) { - - // removing active object should fire "selection:cleared" events this.fire('before:selection:cleared', { target: object }); this.discardActiveObject(); this.fire('selection:cleared'); } + + var objects = this._objects; + var index = objects.indexOf(object); + + // removing any object should fire "objct:removed" events + if (index !== -1) { + objects.splice(index,1); + this.fire('object:removed', { target: object }); + } + this.renderAll(); return object; },