Pad svg logo
This commit is contained in:
@@ -27,14 +27,16 @@ public final class SvgNodeLoader {
|
|||||||
public static Pane loadSquare(String resourcePath, double size) {
|
public static Pane loadSquare(String resourcePath, double size) {
|
||||||
Group content = readSvg(resourcePath);
|
Group content = readSvg(resourcePath);
|
||||||
var bounds = content.getLayoutBounds();
|
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);
|
Group graphic = new Group(content);
|
||||||
graphic.setScaleX(scale);
|
graphic.setScaleX(scale);
|
||||||
graphic.setScaleY(scale);
|
graphic.setScaleY(scale);
|
||||||
graphic.relocate(
|
graphic.relocate(
|
||||||
(size - (bounds.getWidth() * scale)) / 2 - (bounds.getMinX() * scale),
|
inset + ((available - (bounds.getWidth() * scale)) / 2) - (bounds.getMinX() * scale),
|
||||||
(size - (bounds.getHeight() * scale)) / 2 - (bounds.getMinY() * scale)
|
inset + ((available - (bounds.getHeight() * scale)) / 2) - (bounds.getMinY() * scale)
|
||||||
);
|
);
|
||||||
|
|
||||||
Pane pane = new Pane(graphic);
|
Pane pane = new Pane(graphic);
|
||||||
|
|||||||
Reference in New Issue
Block a user