From cd9ae6e9a3ba786efad7798ed1e45a1aa59b13da Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Tue, 17 Nov 2015 21:28:50 +0100 Subject: [PATCH 1/2] Update static_canvas.class.js --- src/static_canvas.class.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/static_canvas.class.js b/src/static_canvas.class.js index 5b89bcf7e62..420d836a2b2 100644 --- a/src/static_canvas.class.js +++ b/src/static_canvas.class.js @@ -861,28 +861,26 @@ this.fire('before:render'); - canvasToDrawOn.save(); if (this.clipTo) { fabric.util.clipContext(this, canvasToDrawOn); } + this._renderBackground(canvasToDrawOn); + canvasToDrawOn.save(); objsToRender = this._chooseObjectsToRender(); - //apply viewport transform once for all rendering process canvasToDrawOn.transform.apply(canvasToDrawOn, this.viewportTransform); - this._renderBackground(canvasToDrawOn); this._renderObjects(canvasToDrawOn, objsToRender); this.preserveObjectStacking || this._renderObjects(canvasToDrawOn, [this.getActiveGroup()]); + canvasToDrawOn.restore(); + if (!this.controlsAboveOverlay && this.interactive) { this.drawControls(canvasToDrawOn); } - if (this.clipTo) { canvasToDrawOn.restore(); } - this._renderOverlay(canvasToDrawOn); - if (this.controlsAboveOverlay && this.interactive) { this.drawControls(canvasToDrawOn); } From cc8ed6bac82b2f9eed68ee4ca0d5c9ff1840abe7 Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Tue, 17 Nov 2015 21:29:39 +0100 Subject: [PATCH 2/2] Update canvas.class.js --- src/canvas.class.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/canvas.class.js b/src/canvas.class.js index 5fca33342f0..43219265203 100644 --- a/src/canvas.class.js +++ b/src/canvas.class.js @@ -1248,18 +1248,14 @@ * @param {CanvasRenderingContext2D} ctx Context to render controls on */ drawControls: function(ctx) { - var activeGroup = this.getActiveGroup(), - iVpt = fabric.util.invertTransform(this.viewportTransform); + var activeGroup = this.getActiveGroup(); - ctx.save(); - ctx.transform.apply(ctx, iVpt); if (activeGroup) { activeGroup._renderControls(ctx); } else { this._drawObjectsControls(ctx); } - ctx.restore(); }, /**