From dfc97d21bc0c26f73b3a6a331c62c237f874a423 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Tue, 18 Jul 2023 07:48:11 +0000 Subject: [PATCH] more resizing --- src/components/dashboard/DashboardIndexedScreen.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/dashboard/DashboardIndexedScreen.tsx b/src/components/dashboard/DashboardIndexedScreen.tsx index f65e31d0c711..c9056017d9a8 100644 --- a/src/components/dashboard/DashboardIndexedScreen.tsx +++ b/src/components/dashboard/DashboardIndexedScreen.tsx @@ -70,10 +70,13 @@ export default function DashboardLEDStrip(props: DashboardServiceProps) { (contextRef.current = canvas.getContext("2d")) if (!context) return - console.log("RENDER") - // paint image - context.fillStyle = "#222" - context.fillRect(0, 0, canvas.width, canvas.height) + const pixels = server?.pixels + context.clearRect(0, 0, canvas.width, canvas.height) + + if (!pixels) { + context.fillStyle = "#222" + context.fillRect(0, 0, canvas.width, canvas.height) + } } paint() @@ -99,7 +102,7 @@ export default function DashboardLEDStrip(props: DashboardServiceProps) { } if (rotation) canvasStyle.transform = `rotate(${rotation}deg)` const parentStyle: CSSProperties = { - width: "clamp(5rem, 90vw, 20rem)" + width: "clamp(5rem, 90vw, 20rem)", } return (