Normalize svg logo
This commit is contained in:
@@ -33,17 +33,20 @@ public final class SvgNodeLoader {
|
|||||||
double scale = Math.min(available / bounds.getWidth(), available / bounds.getHeight());
|
double scale = Math.min(available / bounds.getWidth(), available / bounds.getHeight());
|
||||||
|
|
||||||
Group graphic = new Group(content);
|
Group graphic = new Group(content);
|
||||||
|
graphic.setTranslateX(-bounds.getMinX());
|
||||||
|
graphic.setTranslateY(-bounds.getMinY());
|
||||||
graphic.setScaleX(scale);
|
graphic.setScaleX(scale);
|
||||||
graphic.setScaleY(scale);
|
graphic.setScaleY(scale);
|
||||||
graphic.relocate(
|
graphic.relocate(
|
||||||
inset + ((available - (bounds.getWidth() * scale)) / 2) - (bounds.getMinX() * scale),
|
inset + ((available - (bounds.getWidth() * scale)) / 2),
|
||||||
inset + ((available - (bounds.getHeight() * scale)) / 2) - (bounds.getMinY() * scale)
|
inset + ((available - (bounds.getHeight() * scale)) / 2)
|
||||||
);
|
);
|
||||||
|
|
||||||
Pane pane = new Pane(graphic);
|
Pane pane = new Pane(graphic);
|
||||||
pane.setMinSize(size, size);
|
pane.setMinSize(size, size);
|
||||||
pane.setPrefSize(size, size);
|
pane.setPrefSize(size, size);
|
||||||
pane.setMaxSize(size, size);
|
pane.setMaxSize(size, size);
|
||||||
|
pane.setClip(new Rectangle(size, size));
|
||||||
return pane;
|
return pane;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user