notif overlay flex with 1 sec delay removal
This commit is contained in:
@@ -25,8 +25,6 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
|||||||
private readonly NotificationService _notificationService;
|
private readonly NotificationService _notificationService;
|
||||||
private bool _notificationDismissed = true;
|
private bool _notificationDismissed = true;
|
||||||
private int _lastDownloadStateHash = 0;
|
private int _lastDownloadStateHash = 0;
|
||||||
private DateTime _lastNotificationUpdate = DateTime.MinValue;
|
|
||||||
private const int MinUpdateIntervalMs = 1000;
|
|
||||||
|
|
||||||
public DownloadUi(ILogger<DownloadUi> logger, DalamudUtilService dalamudUtilService, LightlessConfigService configService,
|
public DownloadUi(ILogger<DownloadUi> logger, DalamudUtilService dalamudUtilService, LightlessConfigService configService,
|
||||||
PairProcessingLimiter pairProcessingLimiter, FileUploadManager fileTransferManager, LightlessMediator mediator, UiSharedService uiShared,
|
PairProcessingLimiter pairProcessingLimiter, FileUploadManager fileTransferManager, LightlessMediator mediator, UiSharedService uiShared,
|
||||||
@@ -142,7 +140,6 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
|||||||
_notificationService.DismissPairDownloadNotification();
|
_notificationService.DismissPairDownloadNotification();
|
||||||
_notificationDismissed = true;
|
_notificationDismissed = true;
|
||||||
_lastDownloadStateHash = 0;
|
_lastDownloadStateHash = 0;
|
||||||
_lastNotificationUpdate = DateTime.MinValue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -354,14 +351,11 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
|||||||
hashCode.Add(queueWaiting);
|
hashCode.Add(queueWaiting);
|
||||||
|
|
||||||
var currentHash = hashCode.ToHashCode();
|
var currentHash = hashCode.ToHashCode();
|
||||||
var now = DateTime.UtcNow;
|
|
||||||
var timeSinceLastUpdate = (now - _lastNotificationUpdate).TotalMilliseconds;
|
|
||||||
|
|
||||||
// Only update notification if state has changed AND at least 1 second has passed
|
// Only update notification if state has actually changed
|
||||||
if (currentHash != _lastDownloadStateHash && timeSinceLastUpdate >= MinUpdateIntervalMs)
|
if (currentHash != _lastDownloadStateHash)
|
||||||
{
|
{
|
||||||
_lastDownloadStateHash = currentHash;
|
_lastDownloadStateHash = currentHash;
|
||||||
_lastNotificationUpdate = now;
|
|
||||||
if (downloadStatus.Count > 0 || queueWaiting > 0)
|
if (downloadStatus.Count > 0 || queueWaiting > 0)
|
||||||
{
|
{
|
||||||
_notificationService.ShowPairDownloadNotification(downloadStatus, queueWaiting);
|
_notificationService.ShowPairDownloadNotification(downloadStatus, queueWaiting);
|
||||||
|
|||||||
@@ -134,11 +134,7 @@ public class LightlessNotificationUI : WindowMediatorSubscriberBase
|
|||||||
|
|
||||||
var viewport = ImGui.GetMainViewport();
|
var viewport = ImGui.GetMainViewport();
|
||||||
|
|
||||||
// Set window to full viewport height
|
// Window auto-resizes based on content (AlwaysAutoResize flag)
|
||||||
var width = _configService.Current.NotificationWidth;
|
|
||||||
Size = new Vector2(width, viewport.WorkSize.Y);
|
|
||||||
SizeCondition = ImGuiCond.Always;
|
|
||||||
|
|
||||||
Position = CalculateWindowPosition(viewport);
|
Position = CalculateWindowPosition(viewport);
|
||||||
PositionCondition = ImGuiCond.Always;
|
PositionCondition = ImGuiCond.Always;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user