Skip to content

Commit

Permalink
Use Overlay#getBounds for getting correct bounds
Browse files Browse the repository at this point in the history
Use Overlay#getBounds for getting correct bounds in OverlayManager in
case overlay overrides getBounds with custom functionality.

Signed-off-by: Tomas Slusny <[email protected]>
  • Loading branch information
deathbeam committed Jul 22, 2018
1 parent d700ebc commit 8447326
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ public void render(Graphics2D graphics, final OverlayLayer layer)
}

safeRender(client, overlay, layer, graphics, location);
dimension.setSize(overlay.getBounds().getSize());
final Rectangle bounds = overlay.getBounds();

if (dimension.width == 0 && dimension.height == 0)
if (bounds.isEmpty())
{
continue;
}
Expand All @@ -216,7 +216,7 @@ public void render(Graphics2D graphics, final OverlayLayer layer)
{
final Color previous = graphics.getColor();
graphics.setColor(movedOverlay == overlay ? MOVING_OVERLAY_ACTIVE_COLOR : MOVING_OVERLAY_COLOR);
graphics.drawRect(location.x, location.y, dimension.width - 1, dimension.height - 1);
graphics.draw(bounds);
graphics.setColor(previous);
}
}
Expand Down Expand Up @@ -391,7 +391,6 @@ else if (position == OverlayPosition.TOOLTIP)
subGraphics.setFont(FontManager.getRunescapeFont());
}


subGraphics.translate(point.x, point.y);
final Dimension dimension = MoreObjects.firstNonNull(overlay.render(subGraphics), new Dimension());
subGraphics.dispose();
Expand Down

0 comments on commit 8447326

Please sign in to comment.