EDIT style text label stroke color

This commit is contained in:
Ángel Montero Lamas 2024-09-14 21:55:40 +02:00
parent a2e1004734
commit 7ff5d1053f
3 changed files with 26 additions and 4 deletions

View file

@ -201,6 +201,8 @@ function selectStyleElement() {
if (gridCellNumbers) {
gridCellNumbers.checked = el.attr("cell-numbers") === "true";
styleStroke.style.display = "block";
styleStrokeInput.value = styleStrokeOutput.value = gridOverlay.attr("data-label-style")?.match(/stroke: ([^;]+)/)?.[1] || "#000000";
gridCellNumbers.addEventListener("change", function() {
el.attr("cell-numbers", this.checked);
drawGrid();
@ -208,6 +210,7 @@ function selectStyleElement() {
} else {
console.warn("gridCellNumbers element not found");
}
}
if (styleElement === "compass") {
@ -542,10 +545,21 @@ styleGridNumbers.on("change", function () {
byId("gridCellNumbers")?.addEventListener("change", function() {
gridOverlay.attr("cell-numbers", this.checked);
// drawGrid(); // without condition of if layerIsOn.
updateGridCellNumbersStyle();
if (layerIsOn("toggleGrid")) drawGrid();
});
document.getElementById("gridCellNumbersColor").addEventListener("input", updateGridCellNumbersStyle);
function updateGridCellNumbersStyle() {
const color = document.getElementById("gridCellNumbersColor").value;
const style = `stroke: ${color};`;
gridOverlay.attr("data-label-style", style);
if (layerIsOn("toggleGrid")) drawGrid();
}
styleRescaleMarkers.on("change", function () {
markers.attr("rescale", +this.checked);
invokeActiveZooming();