Web Dev Solutions

Catalin Mititiuc

From 2d30b5f842e957f93eaa95ce224faaffd312666e Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Wed, 12 Jun 2024 13:29:09 -0700 Subject: WIP: Fill in some of the 'load scenario' tests --- src/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/index.js b/src/index.js index ee9cea9..6b05c03 100644 --- a/src/index.js +++ b/src/index.js @@ -280,16 +280,21 @@ document.querySelector('#upload-save').addEventListener('click', () => { document.querySelector('input[type="file"]').addEventListener('change', e => { const [file] = fileInputEl.files; + const reader = new FileReader(); - - let reader = new FileReader(); reader.onload = function () { const parser = new DOMParser(); const doc = parser.parseFromString(reader.result, "image/svg+xml"); - buildScenario(doc); + mapResourceEl.addEventListener( + 'transitionend', + () => buildScenario(doc), + { once: true } + ); }; + mapPlaceholder.style.opacity = 1; + mapResourceEl.style.opacity = 0; reader.readAsText(file); }); -- cgit v1.2.3