Refactor canvas rendering and DPI handling for improved quality and performance

This commit is contained in:
Oleg Sh
2026-01-01 16:16:46 +01:00
parent ea61466fe0
commit e276350318
10 changed files with 133 additions and 32 deletions

View File

@@ -8,15 +8,17 @@ function resizeCanvas()
{
var adv = document.getElementById('bottom_info');
var canvas = document.getElementById('canvas');
canvas.width = document.getElementById('canvasSection').offsetWidth;
let width_float = document.getElementById('canvasSection').offsetWidth;
var mainContainer = document.getElementById('mainContainer');
var offset = (mainContainer.offsetTop + mainContainer.offsetHeight) - (canvas.offsetTop + canvas.offsetHeight) +
($("#footerContent").css("display") === 'block' ? 0 : 24);
canvas.height = $(window).height() - document.getElementById('canvas').offsetTop -
let height_float = $(window).height() - document.getElementById('canvas').offsetTop -
(adv && $("#bottom_info").css("display") === 'block' ? document.getElementById('bottom_info').offsetHeight : 0) -
($("#footer").css("display") === 'block' ? document.getElementById('footer').offsetHeight : 0) - offset;
setDPIForCanvas(canvas, width_float, height_float);
editor.redraw();
}