Skip to content

Commit

Permalink
Correctly zoom on bounds object
Browse files Browse the repository at this point in the history
  • Loading branch information
copy committed Apr 7, 2014
1 parent 232a567 commit f1ab544
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions draw.js
Expand Up @@ -288,19 +288,20 @@ function LifeCanvasDrawer()
canvas_width / width, // relative width
canvas_height / height // relative height
);
zoom_to(relative_size);

x = Math.round(canvas_width / 2 - (bounds.left + width / 2) * drawer.cell_width);
y = Math.round(canvas_height / 2 - (bounds.top + height / 2) * drawer.cell_width);
}
else
{
// can happen if the pattern is empty or very large
relative_size = 16;
zoom_to(16);

x = canvas_width >> 1;
y = canvas_height >> 1;
}

zoom_to(relative_size);

canvas_offset_x = x;
canvas_offset_y = y;
}
Expand Down

0 comments on commit f1ab544

Please sign in to comment.