From 7046737a480f7deeaffa6f41725af295bab3d93f Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Fri, 27 Aug 2021 17:13:34 +0100 Subject: [PATCH] xp globes: account for progress arc width when deciding overlay bounds --- .../plugins/xpglobes/XpGlobesOverlay.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesOverlay.java index 526d3aacbc..1243c76712 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesOverlay.java @@ -63,6 +63,7 @@ public class XpGlobesOverlay extends Overlay private static final int MINIMUM_STEP = 10; private static final int PROGRESS_RADIUS_START = 90; private static final int PROGRESS_RADIUS_REMAINDER = 0; + private static final int PROGRESS_BACKGROUND_SIZE = 5; private static final int TOOLTIP_RECT_SIZE_X = 150; private static final Color DARK_OVERLAY_COLOR = new Color(0, 0, 0, 180); static final String FLIP_ACTION = "Flip"; @@ -108,31 +109,34 @@ public class XpGlobesOverlay extends Overlay return null; } - int curDrawPosition = 0; + // The progress arc is drawn either side of the perimeter of the background. This value accounts for that + // when calculating draw positions and overall size of the overlay + final int progressArcOffset = (int) Math.ceil(Math.max(PROGRESS_BACKGROUND_SIZE, config.progressArcStrokeWidth()) / 2.0); + int curDrawPosition = progressArcOffset; for (final XpGlobe xpGlobe : xpGlobes) { int startXp = xpTrackerService.getStartGoalXp(xpGlobe.getSkill()); int goalXp = xpTrackerService.getEndGoalXp(xpGlobe.getSkill()); if (config.alignOrbsVertically()) { - renderProgressCircle(graphics, xpGlobe, startXp, goalXp, 0, curDrawPosition, getBounds()); + renderProgressCircle(graphics, xpGlobe, startXp, goalXp, progressArcOffset, curDrawPosition, getBounds()); } else { - renderProgressCircle(graphics, xpGlobe, startXp, goalXp, curDrawPosition, 0, getBounds()); + renderProgressCircle(graphics, xpGlobe, startXp, goalXp, curDrawPosition, progressArcOffset, getBounds()); } curDrawPosition += MINIMUM_STEP + config.xpOrbSize(); } // Get length of markers - final int markersLength = (queueSize * (config.xpOrbSize())) + ((MINIMUM_STEP) * (queueSize - 1)); + final int markersLength = (queueSize * (config.xpOrbSize() + progressArcOffset)) + ((MINIMUM_STEP) * (queueSize - 1)); if (config.alignOrbsVertically()) { - return new Dimension(config.xpOrbSize(), markersLength); + return new Dimension(config.xpOrbSize() + progressArcOffset * 2, markersLength); } else { - return new Dimension(markersLength, config.xpOrbSize()); + return new Dimension(markersLength, config.xpOrbSize() + progressArcOffset * 2); } } @@ -184,7 +188,7 @@ public class XpGlobesOverlay extends Overlay x, y, config.xpOrbSize(), config.xpOrbSize(), PROGRESS_RADIUS_REMAINDER, radiusToGoalXp, - 5, + PROGRESS_BACKGROUND_SIZE, config.progressOrbOutLineColor() ); drawProgressArc(