From 72cb438741465eeae7feedce7d9c488d3433b612 Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Fri, 16 Dec 2022 18:23:22 +0100 Subject: [PATCH] Improve responsiveness of grid --- Public/grid.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Public/grid.html b/Public/grid.html index 723cd62..e1ea8d1 100644 --- a/Public/grid.html +++ b/Public/grid.html @@ -1926,6 +1926,7 @@ const numberOfCaps = 1875; const numberOfRows = Math.ceil(1875 / 40); const effectiveHeight = 50 - 6; + const elements = imageCanvas.getElementsByTagName("img"); var capPositions = Array.from( {length: numberOfCaps}, @@ -1933,7 +1934,7 @@ ); function setCapImageAtPosition(capId, position) { - imageCanvas.getElementsByTagName("img")[position].src = "thumbnails/" + `${capId}.jpg`.padStart(8, '0'); + elements[position].src = "thumbnails/" + `${capId}.jpg`.padStart(8, '0'); capPositions[position] = capId; }