Merge pull request #2580 from asturur/retina-scaling

fix bug with retina scaling
This commit is contained in:
Juriy Zaytsev 2015-10-24 17:46:37 +02:00
commit 86bb0c773d
2 changed files with 7 additions and 4 deletions

View file

@ -1248,9 +1248,11 @@
* @param {CanvasRenderingContext2D} ctx Context to render controls on
*/
drawControls: function(ctx) {
var activeGroup = this.getActiveGroup(),
iVpt = fabric.util.invertTransform(this.viewportTransform);
ctx.save();
ctx.setTransform.apply(ctx, [1, 0, 0, 1, 0, 0]);
var activeGroup = this.getActiveGroup();
ctx.transform.apply(ctx, iVpt);
if (activeGroup) {
activeGroup._renderControls(ctx);
}

View file

@ -861,6 +861,7 @@
this.fire('before:render');
canvasToDrawOn.save();
if (this.clipTo) {
fabric.util.clipContext(this, canvasToDrawOn);
}
@ -868,7 +869,7 @@
objsToRender = this._chooseObjectsToRender();
//apply viewport transform once for all rendering process
canvasToDrawOn.setTransform.apply(canvasToDrawOn, this.viewportTransform);
canvasToDrawOn.transform.apply(canvasToDrawOn, this.viewportTransform);
this._renderBackground(canvasToDrawOn);
this._renderObjects(canvasToDrawOn, objsToRender);
this.preserveObjectStacking || this._renderObjects(canvasToDrawOn, [this.getActiveGroup()]);
@ -887,7 +888,7 @@
}
this.fire('after:render');
canvasToDrawOn.setTransform.apply(canvasToDrawOn, [1, 0, 0, 1, 0, 0]);
canvasToDrawOn.restore();
return this;
},