Make ground items overlay use new Widget.contains

This commit is contained in:
Onvo
2017-12-23 19:06:54 -05:00
committed by Adam
parent 9f6b4e2d6c
commit 93b950c829

View File

@@ -28,7 +28,6 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -211,7 +210,7 @@ public class GroundItemsOverlay extends Overlay
{
Point point = itemLayer.getCanvasLocation();
// if the item is offscreen, don't bother drawing it
if (point == null || !pointInWidget(point, viewport))
if (point == null || (viewport != null && !viewport.contains(point)))
{
continue;
}
@@ -301,14 +300,4 @@ public class GroundItemsOverlay extends Overlay
return null;
}
private boolean pointInWidget(Point point, Widget widget)
{
if (widget != null)
{
Rectangle bounds = widget.getBounds();
return bounds != null && bounds.contains(new java.awt.Point(point.getX(), point.getY()));
}
return false;
}
}