Merge remote-tracking branch 'runelite/master'
This commit is contained in:
@@ -80,12 +80,26 @@ public abstract class WidgetItemOverlay extends Overlay
|
|||||||
Widget parent = widget.getParent();
|
Widget parent = widget.getParent();
|
||||||
Rectangle parentBounds = parent.getBounds();
|
Rectangle parentBounds = parent.getBounds();
|
||||||
Rectangle itemCanvasBounds = widgetItem.getCanvasBounds();
|
Rectangle itemCanvasBounds = widgetItem.getCanvasBounds();
|
||||||
|
boolean dragging = widgetItem.getDraggingCanvasBounds() != null;
|
||||||
|
|
||||||
boolean shouldClip;
|
boolean shouldClip;
|
||||||
shouldClip = itemCanvasBounds.y < parentBounds.y && itemCanvasBounds.y + itemCanvasBounds.height >= parentBounds.y;
|
if (dragging)
|
||||||
shouldClip |= itemCanvasBounds.y < parentBounds.y + parentBounds.height && itemCanvasBounds.y + itemCanvasBounds.height >= parentBounds.y + parentBounds.height;
|
{
|
||||||
shouldClip |= itemCanvasBounds.x < parentBounds.x && (itemCanvasBounds.x + itemCanvasBounds.width) >= parentBounds.x;
|
// If dragging, clip if the dragged item is outside of the parent bounds
|
||||||
shouldClip |= itemCanvasBounds.x < parentBounds.x + parentBounds.width && itemCanvasBounds.x + itemCanvasBounds.width >= parentBounds.x + parentBounds.width;
|
shouldClip = itemCanvasBounds.x < parentBounds.x;
|
||||||
|
shouldClip |= itemCanvasBounds.x + itemCanvasBounds.width >= parentBounds.x + parentBounds.width;
|
||||||
|
shouldClip |= itemCanvasBounds.y < parentBounds.y;
|
||||||
|
shouldClip |= itemCanvasBounds.y + itemCanvasBounds.height >= parentBounds.y + parentBounds.height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Otherwise, we only need to clip the overlay if it intersects the parent bounds,
|
||||||
|
// since items completely outside of the parent bounds are not drawn
|
||||||
|
shouldClip = itemCanvasBounds.y < parentBounds.y && itemCanvasBounds.y + itemCanvasBounds.height >= parentBounds.y;
|
||||||
|
shouldClip |= itemCanvasBounds.y < parentBounds.y + parentBounds.height && itemCanvasBounds.y + itemCanvasBounds.height >= parentBounds.y + parentBounds.height;
|
||||||
|
shouldClip |= itemCanvasBounds.x < parentBounds.x && itemCanvasBounds.x + itemCanvasBounds.width >= parentBounds.x;
|
||||||
|
shouldClip |= itemCanvasBounds.x < parentBounds.x + parentBounds.width && itemCanvasBounds.x + itemCanvasBounds.width >= parentBounds.x + parentBounds.width;
|
||||||
|
}
|
||||||
if (shouldClip)
|
if (shouldClip)
|
||||||
{
|
{
|
||||||
if (curClipParent != parent)
|
if (curClipParent != parent)
|
||||||
|
|||||||
Reference in New Issue
Block a user