Add new overlay position for above right side of chatbox
This commit is contained in:
@@ -45,5 +45,9 @@ public enum OverlayPosition
|
|||||||
/**
|
/**
|
||||||
* Place overlay in the bottom right most area possible
|
* Place overlay in the bottom right most area possible
|
||||||
*/
|
*/
|
||||||
BOTTOM_RIGHT;
|
BOTTOM_RIGHT,
|
||||||
|
/**
|
||||||
|
* Place overlay directly above right most area of chatbox possible
|
||||||
|
*/
|
||||||
|
ABOVE_CHATBOX_RIGHT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,6 +187,10 @@ public class OverlayRenderer
|
|||||||
? new Rectangle(viewport.getBounds())
|
? new Rectangle(viewport.getBounds())
|
||||||
: new Rectangle(0, 0, surface.getWidth(), surface.getHeight());
|
: new Rectangle(0, 0, surface.getWidth(), surface.getHeight());
|
||||||
|
|
||||||
|
final Widget chatbox = client.getWidget(WidgetInfo.CHATBOX);
|
||||||
|
final Rectangle chatboxBounds = chatbox != null
|
||||||
|
? chatbox.getBounds() : new Rectangle(0, bounds.height, 519, 165);
|
||||||
|
|
||||||
OverlayUtil.setGraphicProperties(graphics);
|
OverlayUtil.setGraphicProperties(graphics);
|
||||||
final Point topLeftPoint = new Point();
|
final Point topLeftPoint = new Point();
|
||||||
topLeftPoint.move(BORDER_LEFT, BORDER_TOP);
|
topLeftPoint.move(BORDER_LEFT, BORDER_TOP);
|
||||||
@@ -196,6 +200,8 @@ public class OverlayRenderer
|
|||||||
bottomLeftPoint.move(BORDER_LEFT, bounds.y + bounds.height - BORDER_BOTTOM);
|
bottomLeftPoint.move(BORDER_LEFT, bounds.y + bounds.height - BORDER_BOTTOM);
|
||||||
final Point bottomRightPoint = new Point();
|
final Point bottomRightPoint = new Point();
|
||||||
bottomRightPoint.move(bounds.x + bounds.width - BORDER_RIGHT, bounds.y + bounds.height - BORDER_BOTTOM);
|
bottomRightPoint.move(bounds.x + bounds.width - BORDER_RIGHT, bounds.y + bounds.height - BORDER_BOTTOM);
|
||||||
|
final Point rightChatboxPoint = new Point();
|
||||||
|
rightChatboxPoint.move(bounds.x + chatboxBounds.width - BORDER_RIGHT,bounds.y + bounds.height - BORDER_BOTTOM);
|
||||||
|
|
||||||
overlays.stream()
|
overlays.stream()
|
||||||
.filter(overlay -> shouldDrawOverlay(client, overlay))
|
.filter(overlay -> shouldDrawOverlay(client, overlay))
|
||||||
@@ -217,6 +223,9 @@ public class OverlayRenderer
|
|||||||
case TOP_RIGHT:
|
case TOP_RIGHT:
|
||||||
subPosition.setLocation(topRightPoint);
|
subPosition.setLocation(topRightPoint);
|
||||||
break;
|
break;
|
||||||
|
case ABOVE_CHATBOX_RIGHT:
|
||||||
|
subPosition.setLocation(rightChatboxPoint);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overlay.getPosition().equals(OverlayPosition.DYNAMIC))
|
if (overlay.getPosition().equals(OverlayPosition.DYNAMIC))
|
||||||
@@ -249,6 +258,9 @@ public class OverlayRenderer
|
|||||||
case TOP_RIGHT:
|
case TOP_RIGHT:
|
||||||
topRightPoint.y += dimension.height + (dimension.height == 0 ? 0 : PADDING);
|
topRightPoint.y += dimension.height + (dimension.height == 0 ? 0 : PADDING);
|
||||||
break;
|
break;
|
||||||
|
case ABOVE_CHATBOX_RIGHT:
|
||||||
|
rightChatboxPoint.y -= dimension.height + (dimension.height == 0 ? 0 : PADDING);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Point transformed = OverlayUtil.transformPosition(overlay.getPosition(), dimension);
|
final Point transformed = OverlayUtil.transformPosition(overlay.getPosition(), dimension);
|
||||||
|
|||||||
@@ -337,6 +337,7 @@ public class OverlayUtil
|
|||||||
result.y = result.y - dimension.height;
|
result.y = result.y - dimension.height;
|
||||||
break;
|
break;
|
||||||
case BOTTOM_RIGHT:
|
case BOTTOM_RIGHT:
|
||||||
|
case ABOVE_CHATBOX_RIGHT:
|
||||||
result.y = result.y - dimension.height;
|
result.y = result.y - dimension.height;
|
||||||
case TOP_RIGHT:
|
case TOP_RIGHT:
|
||||||
result.x = result.x - dimension.width;
|
result.x = result.x - dimension.width;
|
||||||
|
|||||||
Reference in New Issue
Block a user