grid resizing and auto reset
This commit is contained in:
@@ -5,8 +5,7 @@ class Renderer {
|
||||
this.cell_size = cell_size;
|
||||
this.canvas = document.getElementById(canvas_id);
|
||||
this.ctx = this.canvas.getContext("2d");
|
||||
this.canvas.width = $('#'+container_id).width();
|
||||
this.canvas.height = $('#'+container_id).height();
|
||||
this.fillWindow(container_id)
|
||||
this.height = this.canvas.height;
|
||||
this.width = this.canvas.width;
|
||||
this.cells_to_render = new Set();
|
||||
@@ -14,6 +13,17 @@ class Renderer {
|
||||
this.highlighted_cells = new Set();
|
||||
}
|
||||
|
||||
fillWindow(container_id) {
|
||||
this.fillShape($('#'+container_id).height(), $('#'+container_id).width());
|
||||
}
|
||||
|
||||
fillShape(height, width) {
|
||||
this.canvas.width = width;
|
||||
this.canvas.height = height;
|
||||
this.height = this.canvas.height;
|
||||
this.width = this.canvas.width;
|
||||
}
|
||||
|
||||
clear() {
|
||||
this.ctx.fillStyle = 'white';
|
||||
this.ctx.fillRect(0, 0, this.height, this.width);
|
||||
|
||||
Reference in New Issue
Block a user