mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-19 02:21:24 +01:00
EDIT style text label stroke color
This commit is contained in:
parent
a2e1004734
commit
7ff5d1053f
3 changed files with 26 additions and 4 deletions
|
|
@ -1447,14 +1447,11 @@ function drawGrid() {
|
|||
.attr("fill", "url(" + pattern + ")")
|
||||
.attr("stroke", "none");
|
||||
|
||||
// Check both the attribute and the checkbox state
|
||||
if (gridOverlay.attr("cell-numbers") === "true" || document.getElementById("gridCellNumbers").checked) {
|
||||
drawCellNumbers();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function drawCellNumbers() {
|
||||
const pattern = gridOverlay.attr("type") || "pointyHex";
|
||||
const scale = +gridOverlay.attr("scale") || 1;
|
||||
|
|
@ -1471,6 +1468,8 @@ function drawCellNumbers() {
|
|||
const columns = Math.ceil(maxWidth / patternWidth);
|
||||
const rows = Math.ceil(maxHeight / patternHeight);
|
||||
|
||||
const labelStyle = gridOverlay.attr("data-label-style") || "stroke: #000000;";
|
||||
|
||||
for (let row = 0; row < rows; row++) {
|
||||
for (let col = 0; col < columns; col++) {
|
||||
const x = col * patternWidth + dx;
|
||||
|
|
@ -1484,6 +1483,8 @@ function drawCellNumbers() {
|
|||
.attr("text-anchor", "middle")
|
||||
.attr("dominant-baseline", "central")
|
||||
.attr("font-size", Math.min(patternWidth, patternHeight) / 4)
|
||||
.attr("fill", "none") // Set fill to none so only stroke is visible
|
||||
.attr("style", labelStyle)
|
||||
.text(cellNumber);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue