Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/scenario.js')
-rw-r--r--src/modules/scenario.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/modules/scenario.js b/src/modules/scenario.js
index 805d0fe..4f72168 100644
--- a/src/modules/scenario.js
+++ b/src/modules/scenario.js
@@ -97,7 +97,8 @@ export async function build(svg, request) {
const scenarioBuildings = scenario.querySelector('.gameboard .buildings');
if (scenarioGrid) {
- grid.replaceWith(svg.ownerDocument.importNode(scenarioGrid, true));
+ const frontmost = grid.querySelector('.frontmost');
+ [...scenarioGrid.children].forEach(child => frontmost.before(svg.ownerDocument.importNode(child, true)));
}
if (scenarioBuildings)