Skip to content

Commit

Permalink
Merge pull request #2632 from asturur/fixcontrols
Browse files Browse the repository at this point in the history
Fixcontrols
  • Loading branch information
kangax committed Nov 18, 2015
2 parents ae1ee00 + cc8ed6b commit 540ecc6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
6 changes: 1 addition & 5 deletions src/canvas.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
},

/**
Expand Down
10 changes: 4 additions & 6 deletions src/static_canvas.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 540ecc6

Please sign in to comment.