Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixcontrols #2632

Merged
merged 2 commits into from
Nov 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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