Skip to content

Commit ad539c5

Browse files
committed
rely on fitLegendBox()
Deleted manual legend repositioning that overrides fitLegendBox() behavior. On: public/modules/ui/editors.js
1 parent 8acb49e commit ad539c5

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

public/modules/ui/units-editor.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -179,17 +179,8 @@ function editUnits() {
179179
const bbox = legend.node().getBBox();
180180
legendLabel.attr("x", bbox.width / 2);
181181

182-
// Adjust legend position to ensure it's fully visible
183-
const legendBox = legend.select("#legendBox");
184-
const legendWidth = +legendBox.attr("width");
185-
const legendHeight = +legendBox.attr("height");
186-
const svgWidth = +d3.select("svg").attr("width");
187-
const svgHeight = +d3.select("svg").attr("height");
188-
189-
const x = Math.max(10, Math.min(svgWidth - legendWidth - 10, (+legend.attr("data-x") / 100) * svgWidth));
190-
const y = Math.max(10, Math.min(svgHeight - legendHeight - 10, (+legend.attr("data-y") / 100) * svgHeight));
191-
192-
legend.attr("transform", `translate(${x},${y})`);
182+
// Use shared legend positioning logic (defaults near bottom-right when data-x/y are unset)
183+
if (window.fitLegendBox) fitLegendBox();
193184
}
194185

195186
function updateLegendIfVisible() {

0 commit comments

Comments
 (0)