Combine BOTTOM_RIGHT and ABOVE_CHATBOX_RIGHT overlays for fixed mode

This commit is contained in:
Devin French
2018-01-02 18:30:05 -08:00
committed by Adam
parent 73134b73d3
commit 729b4be816

View File

@@ -207,9 +207,16 @@ public class OverlayRenderer
.filter(overlay -> shouldDrawOverlay(client, overlay))
.forEach(overlay ->
{
OverlayPosition overlayPosition = overlay.getPosition();
if (overlayPosition == OverlayPosition.ABOVE_CHATBOX_RIGHT && !client.isResized())
{
// On fixed mode, ABOVE_CHATBOX_RIGHT is in the same location as
// BOTTOM_RIGHT. Just use BOTTOM_RIGHT to prevent overlays from
// drawing over each other.
overlayPosition = OverlayPosition.BOTTOM_RIGHT;
}
final Point subPosition = new Point();
switch (overlay.getPosition())
switch (overlayPosition)
{
case BOTTOM_LEFT:
subPosition.setLocation(bottomLeftPoint);
@@ -228,7 +235,7 @@ public class OverlayRenderer
break;
}
if (overlay.getPosition().equals(OverlayPosition.DYNAMIC))
if (overlayPosition.equals(OverlayPosition.DYNAMIC))
{
safeRender(overlay, graphics, new Point());
}
@@ -244,7 +251,7 @@ public class OverlayRenderer
final BufferedImage clippedImage = surface.getSubimage(0, 0, dimension.width, dimension.height);
switch (overlay.getPosition())
switch (overlayPosition)
{
case BOTTOM_LEFT:
bottomLeftPoint.x += dimension.width + (dimension.width == 0 ? 0 : PADDING);
@@ -263,7 +270,7 @@ public class OverlayRenderer
break;
}
final Point transformed = OverlayUtil.transformPosition(overlay.getPosition(), dimension);
final Point transformed = OverlayUtil.transformPosition(overlayPosition, dimension);
graphics.drawImage(clippedImage, subPosition.x + transformed.x, subPosition.y + transformed.y, null);
}
});