infobox overlay: hoist some config values out of the render loop

This commit is contained in:
Adam
2022-01-07 18:11:56 -05:00
parent 791912a7c0
commit 32ccf59f30

View File

@@ -124,6 +124,9 @@ public class InfoBoxOverlay extends OverlayPanel
panelComponent.setOrientation(orientation); panelComponent.setOrientation(orientation);
final Font font = config.infoboxFontType().getFont(); final Font font = config.infoboxFontType().getFont();
final boolean infoBoxTextOutline = config.infoBoxTextOutline();
final Color overlayBackgroundColor = config.overlayBackgroundColor();
final Dimension preferredSize = new Dimension(config.infoBoxSize(), config.infoBoxSize());
for (InfoBox box : infoBoxes) for (InfoBox box : infoBoxes)
{ {
if (!box.render()) if (!box.render())
@@ -141,11 +144,11 @@ public class InfoBoxOverlay extends OverlayPanel
{ {
infoBoxComponent.setColor(color); infoBoxComponent.setColor(color);
} }
infoBoxComponent.setOutline(config.infoBoxTextOutline()); infoBoxComponent.setOutline(infoBoxTextOutline);
infoBoxComponent.setImage(box.getScaledImage()); infoBoxComponent.setImage(box.getScaledImage());
infoBoxComponent.setTooltip(box.getTooltip()); infoBoxComponent.setTooltip(box.getTooltip());
infoBoxComponent.setPreferredSize(new Dimension(config.infoBoxSize(), config.infoBoxSize())); infoBoxComponent.setPreferredSize(preferredSize);
infoBoxComponent.setBackgroundColor(config.overlayBackgroundColor()); infoBoxComponent.setBackgroundColor(overlayBackgroundColor);
infoBoxComponent.setInfoBox(box); infoBoxComponent.setInfoBox(box);
panelComponent.getChildren().add(infoBoxComponent); panelComponent.getChildren().add(infoBoxComponent);
} }