Fixed height issue of download box
This commit is contained in:
@@ -562,7 +562,10 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
boxHeight += lineHeight + spacingY;
|
||||
|
||||
if (_configService.Current.ShowPlayerSpeedBarsTransferWindow && p.DlProg > 0)
|
||||
var showBar = _configService.Current.ShowPlayerSpeedBarsTransferWindow
|
||||
&& p.TransferredBytes > 0;
|
||||
|
||||
if (showBar)
|
||||
{
|
||||
boxHeight += perPlayerBarHeight + spacingY;
|
||||
}
|
||||
@@ -630,8 +633,6 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
);
|
||||
cursor.Y += lineHeight * 1.4f + spacingY;
|
||||
|
||||
if (_configService.Current.ShowPlayerLinesTransferWindow)
|
||||
{
|
||||
var orderedPlayers = perPlayer.OrderByDescending(p => p.TotalBytes).ToList();
|
||||
|
||||
foreach (var p in orderedPlayers)
|
||||
@@ -641,19 +642,12 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
? $"{UiSharedService.ByteToString((long)p.SpeedBytesPerSecond)}/s"
|
||||
: "-";
|
||||
|
||||
// Label line for the player
|
||||
var showBar = _configService.Current.ShowPlayerSpeedBarsTransferWindow
|
||||
&& p.TransferredBytes > 0;
|
||||
|
||||
var labelLine =
|
||||
$"{p.Name} [W:{p.DlSlot}/Q:{p.DlQueue}/P:{p.DlProg}/D:{p.DlDecomp}] {p.TransferredFiles}/{p.TotalFiles}";
|
||||
|
||||
// State flags
|
||||
var isDownloading = p.DlProg > 0;
|
||||
var isDecompressing = p.DlDecomp > 0
|
||||
|| (!isDownloading && p.TotalBytes > 0 && p.TransferredBytes >= p.TotalBytes);
|
||||
|
||||
|
||||
var showBar = _configService.Current.ShowPlayerSpeedBarsTransferWindow
|
||||
&& (isDownloading || isDecompressing);
|
||||
|
||||
if (!showBar)
|
||||
{
|
||||
UiSharedService.DrawOutlinedFont(
|
||||
@@ -669,7 +663,6 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
continue;
|
||||
}
|
||||
|
||||
// Top label line (only name + W/Q/P/D + files)
|
||||
UiSharedService.DrawOutlinedFont(
|
||||
drawList,
|
||||
labelLine,
|
||||
@@ -691,15 +684,10 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
3f
|
||||
);
|
||||
|
||||
// Fill based on Progress of download
|
||||
float ratio = 0f;
|
||||
if (isDownloading && p.TotalBytes > 0)
|
||||
{
|
||||
if (p.TotalBytes > 0)
|
||||
ratio = (float)p.TransferredBytes / p.TotalBytes;
|
||||
}
|
||||
else if (isDecompressing)
|
||||
{
|
||||
ratio = 1f;
|
||||
}
|
||||
|
||||
if (ratio < 0f) ratio = 0f;
|
||||
if (ratio > 1f) ratio = 1f;
|
||||
@@ -714,9 +702,17 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
3f
|
||||
);
|
||||
|
||||
// Text inside bar: downloading vs decompressing
|
||||
string barText;
|
||||
|
||||
if (isDownloading)
|
||||
var isDecompressing = p.DlDecomp > 0 && p.TransferredBytes >= p.TotalBytes && p.TotalBytes > 0;
|
||||
|
||||
if (isDecompressing)
|
||||
{
|
||||
// Keep bar full, static text showing decompressing
|
||||
barText = "Decompressing...";
|
||||
}
|
||||
else
|
||||
{
|
||||
var bytesInside =
|
||||
$"{UiSharedService.ByteToString(p.TransferredBytes, addSuffix: false)}/{UiSharedService.ByteToString(p.TotalBytes)}";
|
||||
@@ -725,18 +721,11 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
? $"{bytesInside} @ {playerSpeedText}"
|
||||
: bytesInside;
|
||||
}
|
||||
else if (isDecompressing)
|
||||
{
|
||||
barText = "Decompressing...";
|
||||
}
|
||||
else
|
||||
{
|
||||
barText = string.Empty;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(barText))
|
||||
{
|
||||
var barTextSize = ImGui.CalcTextSize(barText);
|
||||
|
||||
var barTextPos = new Vector2(
|
||||
barBgMin.X + ((barBgMax.X - barBgMin.X) - barTextSize.X) / 2f - 1,
|
||||
barBgMin.Y + ((perPlayerBarHeight - barTextSize.Y) / 2f) - 1
|
||||
@@ -755,7 +744,6 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
cursor.Y += perPlayerBarHeight + spacingY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool DrawConditions()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user