diff options
| author | Dennis Fink | 2026-11-03 23:18:23 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-03 23:18:23 +0100 |
| commit | ebe123a6d40bf17ab2a35f331fb08c8c0fc76a3a (patch) | |
| tree | 441d3a817736e9db25d5c14aa3938c0392166160 /assets/static/vendor/leaflet-elevation/src/handlers/labels.js | |
| parent | 7f4de25eb8abca76a619bc70bb0fce7e8be36561 (diff) | |
| download | dennisfink.me-ebe123a6d40bf17ab2a35f331fb08c8c0fc76a3a.tar.gz dennisfink.me-ebe123a6d40bf17ab2a35f331fb08c8c0fc76a3a.zip | |
Update vendored Leaflet Elevation and map dependencies
Diffstat (limited to '')
| -rw-r--r-- | assets/static/vendor/leaflet-elevation/src/handlers/labels.js | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/assets/static/vendor/leaflet-elevation/src/handlers/labels.js b/assets/static/vendor/leaflet-elevation/src/handlers/labels.js index 31b3cd6..4deb0c7 100644 --- a/assets/static/vendor/leaflet-elevation/src/handlers/labels.js +++ b/assets/static/vendor/leaflet-elevation/src/handlers/labels.js @@ -17,25 +17,24 @@ export function Labels() { if (90 == Math.abs(textRotation)) { - pointG.selectAll('text') - .attr('dy', '4px') - .attr("dx", (d, i, el) => Math.sign(textRotation) * (this._height() - d3.select(el[i].parentElement).datum().y - 8) + 'px') - .attr('text-anchor', textRotation > 0 ? 'end' : 'start') - .attr('transform', 'rotate(' + textRotation + ')') + pointG.querySelectorAll('text').forEach(text => L.Control.Elevation.Utils.setAttributes(text, { + dy: '4px', + dx: Math.sign(textRotation) * (this._height() - Number(text.parentElement.dataset.y) - 8) + 'px', + 'text-anchor': textRotation > 0 ? 'end' : 'start', + transform: 'rotate(' + textRotation + ')', + })); - pointG.selectAll('circle') - .attr('r', '2.5') - .attr('fill', '#fff') - .attr("stroke", '#000') - .attr("stroke-width", '1.1'); + pointG.querySelectorAll('circle').forEach(circle => L.Control.Elevation.Utils.setAttributes(circle, { + r: 2.5, fill: '#fff', stroke: '#000', 'stroke-width': 1.1, + })); } else if (!isNaN(textRotation)) { - pointG.selectAll('text') - .attr("dx", "4px") - .attr("dy", "-9px") - .attr('text-anchor', textAnchor ?? (0 == textRotation ? 'start' : 'middle')) - .attr('transform', 'rotate('+ -textRotation +')') + pointG.querySelectorAll('text').forEach(text => L.Control.Elevation.Utils.setAttributes(text, { + dx: '4px', dy: '-9px', + 'text-anchor': textAnchor ?? (0 == textRotation ? 'start' : 'middle'), + transform: 'rotate(' + -textRotation + ')', + })); } |
