Fix svg layout

This commit is contained in:
2026-03-11 13:37:44 -06:00
parent c80373eeff
commit 38e044192e

View File

@@ -32,17 +32,12 @@ public final class SvgNodeLoader {
double available = size - (inset * 2);
double scale = Math.min(available / bounds.getWidth(), available / bounds.getHeight());
Group graphic = new Group(content);
graphic.setTranslateX(-bounds.getMinX());
graphic.setTranslateY(-bounds.getMinY());
graphic.setScaleX(scale);
graphic.setScaleY(scale);
graphic.relocate(
inset + ((available - (bounds.getWidth() * scale)) / 2),
inset + ((available - (bounds.getHeight() * scale)) / 2)
);
content.setScaleX(scale);
content.setScaleY(scale);
content.setLayoutX(inset + ((available - (bounds.getWidth() * scale)) / 2) - (bounds.getMinX() * scale));
content.setLayoutY(inset + ((available - (bounds.getHeight() * scale)) / 2) - (bounds.getMinY() * scale));
Pane pane = new Pane(graphic);
Pane pane = new Pane(content);
pane.setMinSize(size, size);
pane.setPrefSize(size, size);
pane.setMaxSize(size, size);