Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Mititiuc <webdevcat@proton.me>2024-06-12 13:29:09 -0700
committerCatalin Mititiuc <webdevcat@proton.me>2024-06-12 13:29:09 -0700
commit2d30b5f842e957f93eaa95ce224faaffd312666e (patch)
treeadbc52c4df8cf12d77a00470ef694deb062aa8bc /src/index.js
parentac8eb25ac0b1d518beebe810e6430e375032028c (diff)
WIP: Fill in some of the 'load scenario' tests
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js11
1 files changed, 8 insertions, 3 deletions
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);
});