Merge pull request #2641 from deathbeam/fix-overlay-resets

Fix overlay system sizing
This commit is contained in:
Adam
2018-05-12 19:15:17 -04:00
committed by GitHub
2 changed files with 18 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ import javax.inject.Inject;
import net.runelite.client.plugins.cluescrolls.clues.ClueScroll;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayPriority;
import net.runelite.client.ui.overlay.components.ComponentConstants;
import net.runelite.client.ui.overlay.components.PanelComponent;
public class ClueScrollOverlay extends Overlay
@@ -60,6 +61,7 @@ public class ClueScrollOverlay extends Overlay
}
panelComponent.getChildren().clear();
panelComponent.setPreferredSize(new Dimension(ComponentConstants.STANDARD_WIDTH, 0));
clue.makeOverlayHint(panelComponent, plugin);

View File

@@ -100,6 +100,22 @@ public class PanelComponent implements LayoutableRenderableEntity
preferredSize.width - border.x - border.width,
preferredSize.height - border.y - border.height);
// Adjust preferred size of children based on orientation and children
// sizes exceeding the parent size
switch (orientation)
{
case VERTICAL:
childPreferredSize.setSize(
Math.max(childDimensions.width, childPreferredSize.width),
childPreferredSize.height);
break;
case HORIZONTAL:
childPreferredSize.setSize(
childPreferredSize.width,
Math.max(childDimensions.height, childPreferredSize.height));
break;
}
// Render all children
for (final LayoutableRenderableEntity child : children)
{