forced current changelog version to be opened on default

This commit is contained in:
choco
2025-10-17 15:36:50 +02:00
parent 8a3902ec2b
commit 47b7ecd521
2 changed files with 24 additions and 22 deletions

View File

@@ -26,6 +26,7 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
private CreditsFile _credits = new();
private bool _scrollToTop;
private int _selectedTab;
private bool _hasInitializedCollapsingHeaders;
private struct Particle
{
@@ -65,6 +66,7 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
PerformanceCollectorService performanceCollectorService)
: base(logger, mediator, "Lightless Sync — Update Notes", performanceCollectorService)
{
logger.LogInformation("UpdateNotesUi constructor called");
_uiShared = uiShared;
_configService = configService;
@@ -82,11 +84,13 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
};
LoadEmbeddedResources();
logger.LogInformation("UpdateNotesUi constructor completed successfully");
}
public override void OnOpen()
{
_scrollToTop = true;
_hasInitializedCollapsingHeaders = false;
}
protected override void DrawInternal()
@@ -108,7 +112,6 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
var headerStart = windowPos + new Vector2(windowPadding.X, windowPadding.Y);
var headerEnd = headerStart + new Vector2(headerWidth, HeaderHeight);
var headerSize = new Vector2(headerWidth, HeaderHeight);
var extendedParticleSize = new Vector2(headerWidth, HeaderHeight + ExtendedParticleHeight);
@@ -610,6 +613,8 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
{
DrawChangelogEntry(entry);
}
_hasInitializedCollapsingHeaders = true;
ImGui.PopTextWrapPos();
ImGui.Spacing();
@@ -618,28 +623,32 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
private void DrawChangelogEntry(ChangelogEntry entry)
{
var currentColor = entry.IsCurrent == true
var isCurrent = entry.IsCurrent ?? false;
var currentColor = isCurrent
? UIColors.Get("LightlessGreen")
: new Vector4(0.95f, 0.95f, 1.0f, 1.0f);
var flags = entry.IsCurrent == true
? ImGuiTreeNodeFlags.DefaultOpen
: ImGuiTreeNodeFlags.None;
var flags = isCurrent ? ImGuiTreeNodeFlags.DefaultOpen : ImGuiTreeNodeFlags.None;
if (!_hasInitializedCollapsingHeaders)
{
ImGui.SetNextItemOpen(isCurrent, ImGuiCond.Always);
}
bool isOpen;
using (ImRaii.PushStyle(ImGuiStyleVar.FrameRounding, 4f))
using (ImRaii.PushColor(ImGuiCol.Header, UIColors.Get("ButtonDefault")))
using (ImRaii.PushColor(ImGuiCol.HeaderHovered, UIColors.Get("LightlessPurple")))
using (ImRaii.PushColor(ImGuiCol.HeaderActive, UIColors.Get("LightlessPurpleActive")))
using (ImRaii.PushColor(ImGuiCol.Text, currentColor))
{
var isOpen = ImGui.CollapsingHeader($" {entry.Name} — {entry.Date} ", flags);
isOpen = ImGui.CollapsingHeader($" {entry.Name} — {entry.Date} ", flags);
ImGui.SameLine();
ImGui.TextColored(new Vector4(0.85f, 0.85f, 0.95f, 1.0f), $" — {entry.Tagline}");
if (!isOpen)
return;
}
if (!isOpen)
return;
ImGuiHelpers.ScaledDummy(8);