Use Overlay#getBounds for getting correct bounds

Use Overlay#getBounds for getting correct bounds in OverlayManager in
case overlay overrides getBounds with custom functionality.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-07-22 11:55:42 +02:00
parent d700ebc257
commit 84473262ba

View File

@@ -205,9 +205,9 @@ public class OverlayRenderer extends MouseListener implements KeyListener
}
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;
}
@@ -216,7 +216,7 @@ public class OverlayRenderer extends MouseListener implements KeyListener
{
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);
}
}
@@ -391,7 +391,6 @@ public class OverlayRenderer extends MouseListener implements KeyListener
subGraphics.setFont(FontManager.getRunescapeFont());
}
subGraphics.translate(point.x, point.y);
final Dimension dimension = MoreObjects.firstNonNull(overlay.render(subGraphics), new Dimension());
subGraphics.dispose();