Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -738,13 +738,13 @@ protected void renderLabels(
);
}

// Find the maximum tick time for normalization
Duration peakTickTime = Duration.ZERO;
for (int i = 0; i < menu.tickTimes.length; i++) {
Duration candidate = menu.tickTimes[i];
if (candidate.compareTo(peakTickTime) > 0) {
peakTickTime = candidate;
}
// Find the maximum tick time for normalization
Duration peakTickTime = Duration.ZERO;
for (int i = 0; i < menu.tickTimes.length; i++) {
Duration candidate = menu.tickTimes[i];
if (candidate != null && candidate.compareTo(peakTickTime) > 0) {
peakTickTime = candidate;
}
}
long yMax = Long.max(peakTickTime.toNanos(), 50_000_000); // Start with max at 50 ms but allow it to grow

Expand Down Expand Up @@ -777,10 +777,11 @@ protected void renderLabels(

// Draw lines for each data point
bufferbuilder = tesselator.getBuilder();
bufferbuilder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
int mouseTickTimeIndex = -1;
for (int i = 0; i < menu.tickTimes.length; i++) {
long y = menu.tickTimes[i].toNanos();
bufferbuilder.begin(VertexFormat.Mode.DEBUG_LINE_STRIP, DefaultVertexFormat.POSITION_COLOR);
int mouseTickTimeIndex = -1;
for (int i = 0; i < menu.tickTimes.length; i++) {
Duration tickTime = menu.tickTimes[i];
long y = tickTime == null ? 0 : tickTime.toNanos();
float normalizedTickTime = y == 0 ? 0 : (float) (Math.log10(y) / Math.log10(yMax));
int plotPosY = plotY + plotHeight - (int) (normalizedTickTime * plotHeight);

Expand Down Expand Up @@ -811,9 +812,10 @@ protected void renderLabels(
// Draw the tick time text
var format = new DecimalFormat("0.000");
if (mouseTickTimeIndex != -1) { // We are hovering over the plot
// Draw the tick time text for the hovered point instead of peak
{
long hoveredTickTimeNanoseconds = menu.tickTimes[mouseTickTimeIndex].toNanos();
// Draw the tick time text for the hovered point instead of peak
{
Duration hoveredTickTime = menu.tickTimes[mouseTickTimeIndex];
long hoveredTickTimeNanoseconds = hoveredTickTime == null ? 0 : hoveredTickTime.toNanos();
var hoveredTickTimeMilliseconds = hoveredTickTimeNanoseconds / 1_000_000f;
String formattedMillis = format.format(hoveredTickTimeMilliseconds);
ChatFormatting lagColor = getMillisecondColour(hoveredTickTimeMilliseconds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ NAME "Changelog"
-- Add copy and paste support to the draw canvas
-- Improve draw canvas selection highlight positioning while panning
-- Add a draw canvas Done button tooltip for the Shift+Enter shortcut
-- Fix manager screen crash when opening before tick-time history is populated, fixes #535

---- 4.34.0 ----
-- Update zh_cn localizations, thanks @ZHAY10086 #526
Expand Down