Merge pull request #2641 from deathbeam/fix-overlay-resets
Fix overlay system sizing
This commit is contained in:
@@ -33,6 +33,7 @@ import javax.inject.Inject;
|
|||||||
import net.runelite.client.plugins.cluescrolls.clues.ClueScroll;
|
import net.runelite.client.plugins.cluescrolls.clues.ClueScroll;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||||
|
import net.runelite.client.ui.overlay.components.ComponentConstants;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
|
||||||
public class ClueScrollOverlay extends Overlay
|
public class ClueScrollOverlay extends Overlay
|
||||||
@@ -60,6 +61,7 @@ public class ClueScrollOverlay extends Overlay
|
|||||||
}
|
}
|
||||||
|
|
||||||
panelComponent.getChildren().clear();
|
panelComponent.getChildren().clear();
|
||||||
|
panelComponent.setPreferredSize(new Dimension(ComponentConstants.STANDARD_WIDTH, 0));
|
||||||
|
|
||||||
clue.makeOverlayHint(panelComponent, plugin);
|
clue.makeOverlayHint(panelComponent, plugin);
|
||||||
|
|
||||||
|
|||||||
@@ -100,6 +100,22 @@ public class PanelComponent implements LayoutableRenderableEntity
|
|||||||
preferredSize.width - border.x - border.width,
|
preferredSize.width - border.x - border.width,
|
||||||
preferredSize.height - border.y - border.height);
|
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
|
// Render all children
|
||||||
for (final LayoutableRenderableEntity child : children)
|
for (final LayoutableRenderableEntity child : children)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user