mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-14 03:10:59 +00:00
Fix for polygon bounding box being offset (issue #147)
This commit is contained in:
parent
04d770aa35
commit
2cfe384d57
1 changed files with 4 additions and 2 deletions
|
|
@ -98,11 +98,13 @@
|
|||
*/
|
||||
_render: function(ctx) {
|
||||
var point;
|
||||
var offsetX = this.minX + this.width / 2,
|
||||
offsetY = this.minY + this.height / 2;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(this.points[0].x, this.points[0].y);
|
||||
ctx.moveTo(this.points[0].x - offsetX, this.points[0].y - offsetY);
|
||||
for (var i = 0, len = this.points.length; i < len; i++) {
|
||||
point = this.points[i];
|
||||
ctx.lineTo(point.x, point.y);
|
||||
ctx.lineTo(point.x - offsetX, point.y - offsetY);
|
||||
}
|
||||
if (this.fill) {
|
||||
ctx.fill();
|
||||
|
|
|
|||
Loading…
Reference in a new issue