From afbb0b5f863e910ee41df81f4c152ca9998bb310 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Mon, 5 Jun 2023 10:31:15 +0300 Subject: [PATCH] Zoom and Pan: simplify getElements (it's not actually async) --- .../canvas-zoom-and-pan/javascript/zoom.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/extensions-builtin/canvas-zoom-and-pan/javascript/zoom.js b/extensions-builtin/canvas-zoom-and-pan/javascript/zoom.js index bf5ebc51..63de9140 100644 --- a/extensions-builtin/canvas-zoom-and-pan/javascript/zoom.js +++ b/extensions-builtin/canvas-zoom-and-pan/javascript/zoom.js @@ -143,16 +143,10 @@ onUiLoaded(async() => { let mouseX, mouseY; let activeElement; - async function getElements() { - const elements = await Promise.all( - Object.values(elementIDs).map(id => gradioApp().querySelector(id)) - ); - return Object.fromEntries( - Object.keys(elementIDs).map((key, index) => [key, elements[index]]) - ); - } - - const elements = await getElements(); + const elements = Object.fromEntries(Object.keys(elementIDs).map((id) => [ + id, + gradioApp().querySelector(elementIDs[id]), + ])); const elemData = {}; // Apply functionality to the range inputs. Restore redmask and correct for long images.