From 016ad2e8f6eb4ed750c61cd17898d4a5393929e3 Mon Sep 17 00:00:00 2001
From: Catalin Mititiuc
Date: Thu, 27 Jun 2024 15:03:35 -0700
Subject: Fix elevation view styles
---
src/index.js | 12 +++++-------
src/modules/scenario.js | 3 +--
2 files changed, 6 insertions(+), 9 deletions(-)
(limited to 'src')
diff --git a/src/index.js b/src/index.js
index 6e98028..bc4fd8f 100644
--- a/src/index.js
+++ b/src/index.js
@@ -208,13 +208,11 @@ document.querySelector('#roll-dice').addEventListener('click', () => {
});
});
-// document.querySelectorAll('[name="select-elevation"]').forEach(el => {
-// const gameboard = document.querySelector('.gameboard');
-
-// el.addEventListener('change', function (e) {
-// gameboard.dataset.viewElevation = this.value
-// });
-// });
+document.querySelectorAll('[name="select-elevation"]').forEach(el => {
+ el.addEventListener('change', function (e) {
+ document.querySelector('object').contentDocument.querySelector('.grid').dataset.viewElevation = this.value;
+ });
+});
contentVisToggleEl.addEventListener('input', toggleContentVis);
contentVisToggleEl.checked = (localStorage.getItem('content-visibility') !== 'false');
diff --git a/src/modules/scenario.js b/src/modules/scenario.js
index 8b466cb..bde8cf3 100644
--- a/src/modules/scenario.js
+++ b/src/modules/scenario.js
@@ -3,7 +3,7 @@ async function loadScript(scenario, svg, script) {
const scriptEl = document.createElementNS("http://www.w3.org/2000/svg", 'script');
scriptEl.onload = () => {
- console.log('map.js loaded');
+ console.log(`${script}.js loaded`);
resolve();
};
@@ -18,7 +18,6 @@ async function loadScript(scenario, svg, script) {
scriptEl.dataset.cols = dataset.cols;
}
- // scriptEl.setAttributeNS(null, 'href', '../../map.js');
scriptEl.setAttributeNS(null, 'href', `../../${script}.js`);
svg.append(scriptEl);
});
--
cgit v1.2.3