v1.6.16 - allow to set pattern opacity

This commit is contained in:
Azgaar 2021-03-06 20:00:25 +03:00
parent b27a597bd2
commit 8455df796a
4 changed files with 41 additions and 40 deletions

View file

@ -84,7 +84,10 @@ async function getMapURL(type, subtype) {
const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
if (isFirefox && type === "mesh") clone.select("#oceanPattern").remove();
if (subtype === "globe") clone.select("#scaleBar").remove();
if (subtype === "noWater") {clone.select("#oceanBase").attr("opacity", 0); clone.select("#oceanPattern").attr("opacity", 0);}
if (subtype === "noWater") {
clone.select("#oceanBase").attr("opacity", 0);
clone.select("#oceanPattern").attr("opacity", 0);
}
if (type !== "png") {
// reset transform to show the whole map
clone.attr("width", graphWidth).attr("height", graphHeight);
@ -1177,7 +1180,8 @@ function parseLoadedData(data) {
const pattern = document.getElementById("oceanic");
const filter = pattern.firstElementChild.getAttribute("filter");
const href = filter ? "./images/" + filter.replace("url(#", "").replace(")", "") + ".png" : "";
pattern.innerHTML = `<image id="oceanicPattern" href=${href} width="100" height="100" opacity=".2"></image>`;
pattern.innerHTML = `<image id="oceanicPattern" href=${href} width="100" height="100"></image>`;
document.getElementById("oceanPattern").setAttribute("opacity", .2);
}
}()

File diff suppressed because one or more lines are too long