Fix for polygon bounding box being offset (issue #147)

This commit is contained in:
Cat Sync 2012-08-05 16:58:27 -04:00
parent 04d770aa35
commit 2cfe384d57

View file

@ -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();