index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
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); }); |