Ruler polyline width Style interface

for white line and gray line.
This commit is contained in:
Ángel Montero Lamas 2024-08-28 17:52:50 +02:00
parent f50b077f84
commit c2c58c2894
4 changed files with 75 additions and 30 deletions

View file

@ -140,8 +140,11 @@ class Ruler extends Measurer {
const points = this.getPointsString();
const size = this.getSize();
const dash = this.getDash();
const whiteColor = localStorage.getItem("rulerWhiteLineColor") || "#ffffff";
const grayColor = localStorage.getItem("rulerGrayLineColor") || "#808080";
const whiteWidth = parseFloat(localStorage.getItem("rulerWhiteLineWidth")) || 1;
const grayWidth = parseFloat(localStorage.getItem("rulerGrayLineWidth")) || 1.2;
const el = (this.el = ruler
.append("g")
@ -152,13 +155,13 @@ class Ruler extends Measurer {
.attr("points", points)
.attr("class", "white")
.style("stroke", whiteColor)
.attr("stroke-width", size)
.style("stroke-width", size * whiteWidth)
.call(d3.drag().on("start", () => this.addControl(this)));
el.append("polyline")
.attr("points", points)
.attr("class", "gray")
.style("stroke", grayColor)
.attr("stroke-width", rn(size * 1.2, 2))
.style("stroke-width", size * grayWidth)
.attr("stroke-dasharray", dash);
el.append("g")
.attr("class", "rulerPoints")