diff --git a/index.css b/index.css
index 0758a0c5..558728b7 100644
--- a/index.css
+++ b/index.css
@@ -169,6 +169,7 @@ t,
#temperature,
#texture,
#landmass,
+#vignette,
#fogging {
pointer-events: none;
}
diff --git a/index.html b/index.html
index 330b931b..2cecd05a 100644
--- a/index.html
+++ b/index.html
@@ -362,7 +362,18 @@
-
+
@@ -793,6 +804,7 @@
+
@@ -917,6 +929,44 @@
+
+
+ | Position |
+
+
+ x
+
+ width
+
+
+
+ y
+
+ height
+
+
+ |
+
+
+
+ | Radius |
+
+ x
+
+ y
+
+ |
+
+
+
+ | Blur |
+
+
+ px
+ |
+
+
+
| Pattern |
@@ -998,16 +1048,6 @@
-
-
- | Shift by axes |
-
-
-
- |
-
-
-
| Size |
diff --git a/modules/ui/style.js b/modules/ui/style.js
index f9e0189e..d561887c 100644
--- a/modules/ui/style.js
+++ b/modules/ui/style.js
@@ -100,7 +100,7 @@ function selectStyleElement() {
}
// fill
- if (["rivers", "lakes", "landmass", "prec", "ice", "fogging"].includes(styleElement)) {
+ if (["rivers", "lakes", "landmass", "prec", "ice", "fogging", "vignette"].includes(styleElement)) {
styleFill.style.display = "block";
styleFillInput.value = styleFillOutput.value = el.attr("fill");
}
@@ -355,6 +355,22 @@ function selectStyleElement() {
const auto = (styleCoastlineAuto.checked = coastline.select("#sea_island").attr("auto-filter"));
if (auto) styleFilter.style.display = "none";
}
+
+ if (styleElement === "vignette") {
+ styleVignette.style.display = "block";
+
+ const maskRect = byId("vignette-rect");
+ if (maskRect) {
+ const digit = str => str.replace(/[^\d.]/g, "");
+ styleVignetteX.value = digit(maskRect.getAttribute("x"));
+ styleVignetteY.value = digit(maskRect.getAttribute("y"));
+ styleVignetteWidth.value = digit(maskRect.getAttribute("width"));
+ styleVignetteHeight.value = digit(maskRect.getAttribute("height"));
+ styleVignetteRx.value = digit(maskRect.getAttribute("rx"));
+ styleVignetteRy.value = digit(maskRect.getAttribute("ry"));
+ styleVignetteBlur.value = styleVignetteBlurOutput.value = digit(maskRect.getAttribute("filter"));
+ }
+ }
}
// Handle style inputs change
@@ -471,15 +487,6 @@ styleGridShiftY.addEventListener("input", function () {
if (layerIsOn("toggleGrid")) drawGrid();
});
-styleShiftX.addEventListener("input", shiftElement);
-styleShiftY.addEventListener("input", shiftElement);
-
-function shiftElement() {
- const x = styleShiftX.value || 0;
- const y = styleShiftY.value || 0;
- getEl().attr("transform", `translate(${x},${y})`);
-}
-
styleRescaleMarkers.addEventListener("change", function () {
markers.attr("rescale", +this.checked);
invokeActiveZooming();
@@ -961,6 +968,35 @@ function fetchTextureURL(url) {
img.src = url;
}
+styleVignetteX.addEventListener("input", function () {
+ byId("vignette-rect")?.setAttribute("x", `${this.value}%`);
+});
+
+styleVignetteWidth.addEventListener("input", function () {
+ byId("vignette-rect")?.setAttribute("width", `${this.value}%`);
+});
+
+styleVignetteY.addEventListener("input", function () {
+ byId("vignette-rect")?.setAttribute("y", `${this.value}%`);
+});
+
+styleVignetteHeight.addEventListener("input", function () {
+ byId("vignette-rect")?.setAttribute("height", `${this.value}%`);
+});
+
+styleVignetteRx.addEventListener("input", function () {
+ byId("vignette-rect")?.setAttribute("rx", `${this.value}%`);
+});
+
+styleVignetteRy.addEventListener("input", function () {
+ byId("vignette-rect")?.setAttribute("ry", `${this.value}%`);
+});
+
+styleVignetteBlur.addEventListener("input", function () {
+ styleVignetteBlurOutput.value = this.value;
+ byId("vignette-rect")?.setAttribute("filter", `blur(${this.value}px)`);
+});
+
function updateElements() {
// burgIcons to desired size
burgIcons.selectAll("g").each(function () {
diff --git a/styles/default.json b/styles/default.json
index 7905324f..8731b44c 100644
--- a/styles/default.json
+++ b/styles/default.json
@@ -384,5 +384,19 @@
"opacity": 0.98,
"fill": "#30426f",
"filter": null
+ },
+ "#vignette": {
+ "opacity": 0.5,
+ "fill": "#000000",
+ "filter": null
+ },
+ "#vignette-rect": {
+ "x": "1%",
+ "y": "2%",
+ "width": "98%",
+ "height": "96%",
+ "rx": "10%",
+ "ry": "10%",
+ "filter": "blur(20px)"
}
}