From 5c17c8908dfd4d5d193b9e0e9cde91c9a2b15b47 Mon Sep 17 00:00:00 2001 From: MeexReay Date: Fri, 23 May 2025 19:15:31 +0300 Subject: [PATCH] add resizing graphics canvas on onresize event --- sys/graphics.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/graphics.js b/sys/graphics.js index 4a2989e..3bfe1d2 100644 --- a/sys/graphics.js +++ b/sys/graphics.js @@ -41,6 +41,12 @@ function enableGraphics(options={}) { graphics_context = graphics_canvas.getContext("2d") graphics_context.fillStyle = "black"; graphics_context.fillRect(0, 0, graphics_canvas.width, graphics_canvas.height); + + window.addEventListener("resize", (event) => { + graphics_canvas.width = window.innerWidth.toString() + graphics_canvas.height = window.innerHeight.toString() + }) + document.body.appendChild(graphics_canvas) } @@ -87,4 +93,4 @@ function getWindow(wid) { function listWindows() { writeStdout("НА ВАШЕМ устройстве не найдена ни одна имплементация ZCOM. Установите чонить такое, по типу mxwm да есть же броу\n") throw new Error("There is no zcom implementation") -} \ No newline at end of file +}