Fix elevation view styles

This commit is contained in:
Catalin Constantin Mititiuc 2024-06-27 15:03:35 -07:00
parent 4986357f34
commit 016ad2e8f6
5 changed files with 32 additions and 77 deletions

View File

@ -15,7 +15,7 @@ text {
} }
use[href="#hex"] { use[href="#hex"] {
opacity: 0.5; opacity: 0;
fill: transparent; fill: transparent;
fill-opacity: 0.5; fill-opacity: 0.5;
stroke-width: 0.5px; stroke-width: 0.5px;
@ -392,11 +392,7 @@ g[data-y="76"] { --i: 76; }
/* fill: inherit; */ /* fill: inherit; */
} }
.building path { .furniture, .stairs {
fill: none;
}
.furniture {
fill: rgb(104, 185, 181); fill: rgb(104, 185, 181);
} }

View File

@ -67,20 +67,6 @@ use[href="#hex"] {
stroke-linecap: square; stroke-linecap: square;
} }
.view-elevation-roof .doors,
.view-elevation-roof .inner-wall,
.view-elevation-roof .outer-wall {
display: none;
}
/* [class^="elevation"] {
display: none;
}
[class="elevation-0"] {
display: inline;
} */
.elevation-basement { .elevation-basement {
fill: lightgray; fill: lightgray;
display: none; display: none;
@ -157,7 +143,8 @@ use[href="#hex"] {
[data-view-elevation="-1"] .building > .elevation-basement ~ .structure [class*="wall"], [data-view-elevation="-1"] .building > .elevation-basement ~ .structure [class*="wall"],
[data-view-elevation="-1"] .building > .elevation-basement ~ .structure .floor, [data-view-elevation="-1"] .building > .elevation-basement ~ .structure .floor,
[data-view-elevation="-1"] .building > .elevation-basement ~ .structure .doors:not(.exits), [data-view-elevation="-1"] .building > .elevation-basement ~ .structure .doors:not(.exits),
[data-view-elevation="-1"] .building > .elevation-basement ~ .structure .door-edges:not(.exits) { [data-view-elevation="-1"] .building > .elevation-basement ~ .structure .door-edges:not(.exits),
[data-view-elevation="-1"] .building > .elevation-basement ~ .structure .furniture {
display: inline; display: inline;
} }
@ -171,7 +158,12 @@ use[href="#hex"] {
display: inline; display: inline;
} }
[data-view-elevation="1"] .building .elevation-1 + .structure [class*='wall'] { [data-view-elevation="1"] .building .elevation-1 + .structure [class*='wall'],
[data-view-elevation="1"] .building .elevation-1 + .structure .doors,
[data-view-elevation="1"] .building .elevation-1 + .structure .door-edges,
[data-view-elevation="1"] .building .elevation-1 + .structure .windows,
[data-view-elevation="1"] .building .elevation-1 + .structure .furniture,
[data-view-elevation="1"] .building .elevation-1 ~ .structure .exits {
display: none; display: none;
} }
@ -184,7 +176,12 @@ use[href="#hex"] {
display: inline; display: inline;
} }
[data-view-elevation="2"] .building .elevation-2 + .structure [class*='wall'] { [data-view-elevation="2"] .building .elevation-2 + .structure [class*='wall'],
[data-view-elevation="2"] .building .elevation-2 + .structure .doors,
[data-view-elevation="2"] .building .elevation-2 + .structure .door-edges,
[data-view-elevation="2"] .building .elevation-2 + .structure .windows,
[data-view-elevation="2"] .building .elevation-2 + .structure .furniture,
[data-view-elevation="2"] .building .elevation-2 ~ .structure .exits {
display: none; display: none;
} }
@ -197,7 +194,12 @@ use[href="#hex"] {
display: inline; display: inline;
} }
[data-view-elevation="3"] .building .elevation-3 + .structure [class*='wall'] { [data-view-elevation="3"] .building .elevation-3 + .structure [class*='wall'],
[data-view-elevation="3"] .building .elevation-3 + .structure .doors,
[data-view-elevation="3"] .building .elevation-3 + .structure .door-edges,
[data-view-elevation="3"] .building .elevation-3 + .structure .windows,
[data-view-elevation="3"] .building .elevation-3 + .structure .furniture,
[data-view-elevation="3"] .building .elevation-3 ~ .structure .exits {
display: none; display: none;
} }
@ -218,52 +220,11 @@ use[href="#hex"] {
display: inline; display: inline;
} }
.view-elevation-0 .elevation-0 {
display: inline;
}
.view-elevation-1 .elevation-0 {
display: inline;
}
.view-elevation-1 .elevation-1 {
display: inline;
}
.view-elevation-1 .building .elevation-0 {
display: none;
}
.view-elevation-1 .building .elevation-1 {
/* display: none; */
}
.view-elevation-roof .elevation-roof {
display: inline;
}
.view-elevation-basement [class^="elevation"] {
display: none;
}
.view-elevation-basement .elevation-basement {
display: inline;
}
.view-elevation-basement .doors {
display: none;
}
.building [class*="elevation"] use { .building [class*="elevation"] use {
/* fill-opacity: 0.33; */ /* fill-opacity: 0.33; */
stroke: black; stroke: black;
} }
.building {
/* display: none; */
/* opacity: 0.2 */
}
#tree .trunk { #tree .trunk {
fill: brown; fill: brown;
} }

View File

@ -1,5 +1,6 @@
<?xml version="1.0" standalone="no"?> <?xml version="1.0" standalone="no"?>
<svg viewBox="-10 -10 200 300" xmlns="http://www.w3.org/2000/svg"> <svg viewBox="-10 -10 200 300"
xmlns="http://www.w3.org/2000/svg">
<link xmlns="http://www.w3.org/1999/xhtml" rel="stylesheet" href="../css/map.css" type="text/css" /> <link xmlns="http://www.w3.org/1999/xhtml" rel="stylesheet" href="../css/map.css" type="text/css" />
<link xmlns="http://www.w3.org/1999/xhtml" rel="stylesheet" href="../css/radial.css" type="text/css" /> <link xmlns="http://www.w3.org/1999/xhtml" rel="stylesheet" href="../css/radial.css" type="text/css" />
<style> <style>
@ -46,7 +47,7 @@
<image id="counter-grenade" href="counter_grenade.jpg" width="10"/> <image id="counter-grenade" href="counter_grenade.jpg" width="10"/>
</defs> </defs>
<g class="gameboard" data-view-elevation="0"> <g class="gameboard">
<rect id="background"/> <rect id="background"/>
<rect id="dots" fill="url(#asterisk)"/> <rect id="dots" fill="url(#asterisk)"/>
@ -56,6 +57,6 @@
<g id="lines"/> <g id="lines"/>
</g> </g>
<g class="grid"/> <g class="grid" data-view-elevation="0"/>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -208,13 +208,11 @@ document.querySelector('#roll-dice').addEventListener('click', () => {
}); });
}); });
// document.querySelectorAll('[name="select-elevation"]').forEach(el => { document.querySelectorAll('[name="select-elevation"]').forEach(el => {
// const gameboard = document.querySelector('.gameboard'); el.addEventListener('change', function (e) {
document.querySelector('object').contentDocument.querySelector('.grid').dataset.viewElevation = this.value;
// el.addEventListener('change', function (e) { });
// gameboard.dataset.viewElevation = this.value });
// });
// });
contentVisToggleEl.addEventListener('input', toggleContentVis); contentVisToggleEl.addEventListener('input', toggleContentVis);
contentVisToggleEl.checked = (localStorage.getItem('content-visibility') !== 'false'); contentVisToggleEl.checked = (localStorage.getItem('content-visibility') !== 'false');

View File

@ -3,7 +3,7 @@ async function loadScript(scenario, svg, script) {
const scriptEl = document.createElementNS("http://www.w3.org/2000/svg", 'script'); const scriptEl = document.createElementNS("http://www.w3.org/2000/svg", 'script');
scriptEl.onload = () => { scriptEl.onload = () => {
console.log('map.js loaded'); console.log(`${script}.js loaded`);
resolve(); resolve();
}; };
@ -18,7 +18,6 @@ async function loadScript(scenario, svg, script) {
scriptEl.dataset.cols = dataset.cols; scriptEl.dataset.cols = dataset.cols;
} }
// scriptEl.setAttributeNS(null, 'href', '../../map.js');
scriptEl.setAttributeNS(null, 'href', `../../${script}.js`); scriptEl.setAttributeNS(null, 'href', `../../${script}.js`);
svg.append(scriptEl); svg.append(scriptEl);
}); });