Show/hide text of "ruler" class

This commit is contained in:
Ángel Montero Lamas 2024-08-29 16:45:06 +02:00
parent c2c58c2894
commit bb35d5149c
7 changed files with 86 additions and 12 deletions

View file

@ -145,6 +145,8 @@ class Ruler extends Measurer {
const grayColor = localStorage.getItem("rulerGrayLineColor") || "#808080";
const whiteWidth = parseFloat(localStorage.getItem("rulerWhiteLineWidth")) || 1;
const grayWidth = parseFloat(localStorage.getItem("rulerGrayLineWidth")) || 1.2;
const showText = localStorage.getItem("rulerShowText") !== "false"; // by default, show the text
const el = (this.el = ruler
.append("g")
@ -170,6 +172,7 @@ class Ruler extends Measurer {
el.append("text")
.attr("dx", ".35em")
.attr("dy", "-.45em")
.style("display", showText ? "inline" : "none")
.on("click", () => rulers.remove(this.id));
this.drawPoints(el);
this.updateLabel();