Merge pull request #14073 from Hydrox6/xp-globes-correct-bounds
xp globes: account for progress arc width when deciding overlay bounds
This commit is contained in:
@@ -63,6 +63,7 @@ public class XpGlobesOverlay extends Overlay
|
|||||||
private static final int MINIMUM_STEP = 10;
|
private static final int MINIMUM_STEP = 10;
|
||||||
private static final int PROGRESS_RADIUS_START = 90;
|
private static final int PROGRESS_RADIUS_START = 90;
|
||||||
private static final int PROGRESS_RADIUS_REMAINDER = 0;
|
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 int TOOLTIP_RECT_SIZE_X = 150;
|
||||||
private static final Color DARK_OVERLAY_COLOR = new Color(0, 0, 0, 180);
|
private static final Color DARK_OVERLAY_COLOR = new Color(0, 0, 0, 180);
|
||||||
static final String FLIP_ACTION = "Flip";
|
static final String FLIP_ACTION = "Flip";
|
||||||
@@ -108,31 +109,34 @@ public class XpGlobesOverlay extends Overlay
|
|||||||
return null;
|
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)
|
for (final XpGlobe xpGlobe : xpGlobes)
|
||||||
{
|
{
|
||||||
int startXp = xpTrackerService.getStartGoalXp(xpGlobe.getSkill());
|
int startXp = xpTrackerService.getStartGoalXp(xpGlobe.getSkill());
|
||||||
int goalXp = xpTrackerService.getEndGoalXp(xpGlobe.getSkill());
|
int goalXp = xpTrackerService.getEndGoalXp(xpGlobe.getSkill());
|
||||||
if (config.alignOrbsVertically())
|
if (config.alignOrbsVertically())
|
||||||
{
|
{
|
||||||
renderProgressCircle(graphics, xpGlobe, startXp, goalXp, 0, curDrawPosition, getBounds());
|
renderProgressCircle(graphics, xpGlobe, startXp, goalXp, progressArcOffset, curDrawPosition, getBounds());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
renderProgressCircle(graphics, xpGlobe, startXp, goalXp, curDrawPosition, 0, getBounds());
|
renderProgressCircle(graphics, xpGlobe, startXp, goalXp, curDrawPosition, progressArcOffset, getBounds());
|
||||||
}
|
}
|
||||||
curDrawPosition += MINIMUM_STEP + config.xpOrbSize();
|
curDrawPosition += MINIMUM_STEP + config.xpOrbSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get length of markers
|
// 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())
|
if (config.alignOrbsVertically())
|
||||||
{
|
{
|
||||||
return new Dimension(config.xpOrbSize(), markersLength);
|
return new Dimension(config.xpOrbSize() + progressArcOffset * 2, markersLength);
|
||||||
}
|
}
|
||||||
else
|
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,
|
x, y,
|
||||||
config.xpOrbSize(), config.xpOrbSize(),
|
config.xpOrbSize(), config.xpOrbSize(),
|
||||||
PROGRESS_RADIUS_REMAINDER, radiusToGoalXp,
|
PROGRESS_RADIUS_REMAINDER, radiusToGoalXp,
|
||||||
5,
|
PROGRESS_BACKGROUND_SIZE,
|
||||||
config.progressOrbOutLineColor()
|
config.progressOrbOutLineColor()
|
||||||
);
|
);
|
||||||
drawProgressArc(
|
drawProgressArc(
|
||||||
|
|||||||
Reference in New Issue
Block a user