Reuse mt coordinate values in mtr coordinates. Closes #592

This commit is contained in:
kangax 2013-05-01 03:06:04 -04:00
parent eeecde62a8
commit 17974a55be
4 changed files with 25 additions and 13 deletions

18
dist/all.js vendored
View file

@ -10288,8 +10288,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
if (this.fill.toLive) {
ctx.save();
ctx.translate(
-this.width / 2 + this.fill.offsetX,
-this.height / 2 + this.fill.offsetY);
-this.width / 2 + this.fill.offsetX || 0,
-this.height / 2 + this.fill.offsetY || 0);
}
ctx.fill();
if (this.fill.toLive) {
@ -11209,8 +11209,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
y: bl.y + (this.currentWidth/2 * sinTh)
};
var mtr = {
x: tl.x + (this.currentWidth/2 * cosTh),
y: tl.y + (this.currentWidth/2 * sinTh)
x: mt.x,
y: mt.y
};
// debugging
@ -11227,8 +11227,14 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
// canvas.contextTop.fillRect(mt.x, mt.y, 3, 3);
// }, 50);
// clockwise
this.oCoords = { tl: tl, tr: tr, br: br, bl: bl, ml: ml, mt: mt, mr: mr, mb: mb, mtr: mtr };
this.oCoords = {
// corners
tl: tl, tr: tr, br: br, bl: bl,
// middle
ml: ml, mt: mt, mr: mr, mb: mb,
// rotating point
mtr: mtr
};
// set coordinates of the draggable boxes in the corners used to scale/rotate the image
this._setCornerCoords();

6
dist/all.min.js vendored

File diff suppressed because one or more lines are too long

BIN
dist/all.min.js.gz vendored

Binary file not shown.

View file

@ -264,8 +264,8 @@
y: bl.y + (this.currentWidth/2 * sinTh)
};
var mtr = {
x: tl.x + (this.currentWidth/2 * cosTh),
y: tl.y + (this.currentWidth/2 * sinTh)
x: mt.x,
y: mt.y
};
// debugging
@ -282,8 +282,14 @@
// canvas.contextTop.fillRect(mt.x, mt.y, 3, 3);
// }, 50);
// clockwise
this.oCoords = { tl: tl, tr: tr, br: br, bl: bl, ml: ml, mt: mt, mr: mr, mb: mb, mtr: mtr };
this.oCoords = {
// corners
tl: tl, tr: tr, br: br, bl: bl,
// middle
ml: ml, mt: mt, mr: mr, mb: mb,
// rotating point
mtr: mtr
};
// set coordinates of the draggable boxes in the corners used to scale/rotate the image
this._setCornerCoords();