diff --git a/src/main/java/org/example/petshopdesktop/ui/SvgNodeLoader.java b/src/main/java/org/example/petshopdesktop/ui/SvgNodeLoader.java index a8bda054..3abd5d66 100644 --- a/src/main/java/org/example/petshopdesktop/ui/SvgNodeLoader.java +++ b/src/main/java/org/example/petshopdesktop/ui/SvgNodeLoader.java @@ -27,14 +27,16 @@ public final class SvgNodeLoader { public static Pane loadSquare(String resourcePath, double size) { Group content = readSvg(resourcePath); var bounds = content.getLayoutBounds(); - double scale = Math.min(size / bounds.getWidth(), size / bounds.getHeight()); + double inset = size * 0.08; + double available = size - (inset * 2); + double scale = Math.min(available / bounds.getWidth(), available / bounds.getHeight()); Group graphic = new Group(content); graphic.setScaleX(scale); graphic.setScaleY(scale); graphic.relocate( - (size - (bounds.getWidth() * scale)) / 2 - (bounds.getMinX() * scale), - (size - (bounds.getHeight() * scale)) / 2 - (bounds.getMinY() * scale) + inset + ((available - (bounds.getWidth() * scale)) / 2) - (bounds.getMinX() * scale), + inset + ((available - (bounds.getHeight() * scale)) / 2) - (bounds.getMinY() * scale) ); Pane pane = new Pane(graphic);