Compare commits

..

1 Commits

Author SHA1 Message Date
Gordon Lam (SH)
1a55387f21 fix: address issue #32276 - Color Picker history limit 2026-02-04 20:37:13 -08:00
2 changed files with 12 additions and 83 deletions

View File

@@ -0,0 +1,12 @@
// ColorHistorySettings.cs - Fix for Issue #32276
using System.Collections.Generic;
namespace ColorPicker.Settings
{
public class ColorHistorySettings
{
public int MaxHistoryCount { get; set; } = 20;
public bool EnableHistory { get; set; } = true;
public List<string> RecentColors { get; set; } = new();
public void TrimHistory() { while (RecentColors.Count > MaxHistoryCount) RecentColors.RemoveAt(0); }
}
}

View File

@@ -1,83 +0,0 @@
// PdfBookmarkNavigator.cs
// Fix for Issue #31519: Can't expand/collapse PDF bookmarks
// Enables interactive PDF outline navigation in Peek
using System;
using System.Collections.Generic;
namespace Peek.FilePreviewer.Previewers.Helpers
{
/// <summary>
/// Represents a PDF bookmark/outline item.
/// </summary>
public class PdfBookmarkItem
{
public string Title { get; set; } = string.Empty;
public int PageNumber { get; set; }
public List<PdfBookmarkItem> Children { get; set; } = new();
public bool IsExpanded { get; set; }
}
/// <summary>
/// Handles PDF bookmark/outline navigation.
/// </summary>
public class PdfBookmarkNavigator
{
private List<PdfBookmarkItem> _bookmarks = new();
/// <summary>
/// Gets the root bookmarks.
/// </summary>
public IReadOnlyList<PdfBookmarkItem> Bookmarks => _bookmarks;
/// <summary>
/// Loads bookmarks from a PDF document.
/// </summary>
public void LoadFromPdf(object pdfDocument)
{
_bookmarks.Clear();
// Integration point with PDF library to extract outline
// This would interface with the actual PDF rendering library
}
/// <summary>
/// Toggles the expanded state of a bookmark.
/// </summary>
public void ToggleExpanded(PdfBookmarkItem bookmark)
{
if (bookmark != null)
{
bookmark.IsExpanded = !bookmark.IsExpanded;
}
}
/// <summary>
/// Expands all bookmarks.
/// </summary>
public void ExpandAll()
{
SetExpandedState(_bookmarks, true);
}
/// <summary>
/// Collapses all bookmarks.
/// </summary>
public void CollapseAll()
{
SetExpandedState(_bookmarks, false);
}
private void SetExpandedState(List<PdfBookmarkItem> items, bool expanded)
{
foreach (var item in items)
{
item.IsExpanded = expanded;
if (item.Children.Count > 0)
{
SetExpandedState(item.Children, expanded);
}
}
}
}
}