index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
author | Catalin Mititiuc <webdevcat@proton.me> | 2024-06-12 13:29:09 -0700 |
---|---|---|
committer | Catalin Mititiuc <webdevcat@proton.me> | 2024-06-12 13:29:09 -0700 |
commit | 2d30b5f842e957f93eaa95ce224faaffd312666e (patch) | |
tree | adbc52c4df8cf12d77a00470ef694deb062aa8bc /src/index.js | |
parent | ac8eb25ac0b1d518beebe810e6430e375032028c (diff) |
WIP: Fill in some of the 'load scenario' tests
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 11 |
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); }); |