From c9ee38090390e60cef653aa48c2faada584baf55 Mon Sep 17 00:00:00 2001 From: Scott Seaward Date: Wed, 1 Jun 2016 14:54:29 -0400 Subject: [PATCH] Remove reference to lastRenderedWithControls when that object is deleted --- src/canvas.class.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/canvas.class.js b/src/canvas.class.js index 4785e26045f..8a0a33a2242 100644 --- a/src/canvas.class.js +++ b/src/canvas.class.js @@ -1361,6 +1361,17 @@ this._objects[i]._renderControls(ctx); this.lastRenderedWithControls = this._objects[i]; } + }, + + /** + * @private + * @param {fabric.Object} obj Object that was removed + */ + _onObjectRemoved: function(obj) { + if (obj === this.lastRenderedWithControls) { + delete this.lastRenderedWithControls; + } + this.callSuper('_onObjectRemoved', obj); } });