remove old canvases from the dom to reduce memory footprint

This commit is contained in:
Jakob Ketterl 2016-10-29 19:43:18 +00:00
parent fba07c521a
commit 49e3bd3b80
1 changed files with 5 additions and 0 deletions

View File

@ -1724,6 +1724,11 @@ function add_canvas()
new_canvas.addEventListener("mousedown", canvas_mousedown, false);
new_canvas.addEventListener("wheel",canvas_mousewheel, false);
canvases.push(new_canvas);
while (canvas_container && canvas_container.clientHeight + canvas_default_height * 2 < canvases.length * canvas_default_height) {
var c = canvases.shift();
if (!c) break;
canvas_container.removeChild(c);
}
}
function init_canvas_container()