markers rework - optional pin shapes

This commit is contained in:
Azgaar 2021-09-19 02:13:40 +03:00 committed by Peter
parent f15c9d7c62
commit b0d0b8924e
2 changed files with 27 additions and 29 deletions

View file

@ -275,7 +275,6 @@ async function getMapURL(type, options = {}) {
});
}
// TODO: add dataURL for all used fonts
const usedFonts = getUsedFonts(cloneEl);
const fontsToLoad = usedFonts.filter(font => font.src);
if (fontsToLoad.length) {
@ -305,7 +304,6 @@ async function getMapURL(type, options = {}) {
// remove hidden g elements and g elements without children to make downloaded svg smaller in size
function removeUnusedElements(clone) {
if (!terrain.selectAll("use").size()) clone.select("#defs-relief")?.remove();
if (markers.style("display") === "none") clone.select("#defs-markers")?.remove();
for (let empty = 1; empty; ) {
empty = 0;

View file

@ -383,33 +383,33 @@ function parseLoadedData(data) {
.forEach((el) => el.classList.add('buttonoff'));
// turn on active layers
if (notHidden(texture) && hasChild(texture, 'image')) turnOn('toggleTexture');
if (hasChildren(terrs)) turnOn('toggleHeight');
if (hasChildren(biomes)) turnOn('toggleBiomes');
if (hasChildren(cells)) turnOn('toggleCells');
if (hasChildren(gridOverlay)) turnOn('toggleGrid');
if (hasChildren(coordinates)) turnOn('toggleCoordinates');
if (notHidden(compass) && hasChild(compass, 'use')) turnOn('toggleCompass');
if (hasChildren(rivers)) turnOn('toggleRivers');
if (notHidden(terrain) && hasChildren(terrain)) turnOn('toggleRelief');
if (hasChildren(relig)) turnOn('toggleReligions');
if (hasChildren(cults)) turnOn('toggleCultures');
if (hasChildren(statesBody)) turnOn('toggleStates');
if (hasChildren(provs)) turnOn('toggleProvinces');
if (hasChildren(zones) && notHidden(zones)) turnOn('toggleZones');
if (notHidden(borders) && hasChild(compass, 'use')) turnOn('toggleBorders');
if (notHidden(routes) && hasChild(routes, 'path')) turnOn('toggleRoutes');
if (hasChildren(temperature)) turnOn('toggleTemp');
if (hasChild(population, 'line')) turnOn('togglePopulation');
if (hasChildren(ice)) turnOn('toggleIce');
if (hasChild(prec, 'circle')) turnOn('togglePrec');
if (notHidden(emblems) && hasChild(emblems, 'use')) turnOn('toggleEmblems');
if (notHidden(labels)) turnOn('toggleLabels');
if (notHidden(icons)) turnOn('toggleIcons');
if (hasChildren(armies) && notHidden(armies)) turnOn('toggleMilitary');
if (hasChildren(markers) && notHidden(markers)) turnOn('toggleMarkers');
if (notHidden(ruler)) turnOn('toggleRulers');
if (notHidden(scaleBar)) turnOn('toggleScaleBar');
if (notHidden(texture) && hasChild(texture, "image")) turnOn("toggleTexture");
if (hasChildren(terrs)) turnOn("toggleHeight");
if (hasChildren(biomes)) turnOn("toggleBiomes");
if (hasChildren(cells)) turnOn("toggleCells");
if (hasChildren(gridOverlay)) turnOn("toggleGrid");
if (hasChildren(coordinates)) turnOn("toggleCoordinates");
if (notHidden(compass) && hasChild(compass, "use")) turnOn("toggleCompass");
if (hasChildren(rivers)) turnOn("toggleRivers");
if (notHidden(terrain) && hasChildren(terrain)) turnOn("toggleRelief");
if (hasChildren(relig)) turnOn("toggleReligions");
if (hasChildren(cults)) turnOn("toggleCultures");
if (hasChildren(statesBody)) turnOn("toggleStates");
if (hasChildren(provs)) turnOn("toggleProvinces");
if (hasChildren(zones) && notHidden(zones)) turnOn("toggleZones");
if (notHidden(borders) && hasChild(compass, "use")) turnOn("toggleBorders");
if (notHidden(routes) && hasChild(routes, "path")) turnOn("toggleRoutes");
if (hasChildren(temperature)) turnOn("toggleTemp");
if (hasChild(population, "line")) turnOn("togglePopulation");
if (hasChildren(ice)) turnOn("toggleIce");
if (hasChild(prec, "circle")) turnOn("togglePrec");
if (notHidden(emblems) && hasChild(emblems, "use")) turnOn("toggleEmblems");
if (notHidden(labels)) turnOn("toggleLabels");
if (notHidden(icons)) turnOn("toggleIcons");
if (hasChildren(armies) && notHidden(armies)) turnOn("toggleMilitary");
if (hasChildren(markers)) turnOn("toggleMarkers");
if (notHidden(ruler)) turnOn("toggleRulers");
if (notHidden(scaleBar)) turnOn("toggleScaleBar");
getCurrentPreset();
})();