Skip to content

Commit 6dd129a

Browse files
committed
bug fixes
1 parent 5da7cc6 commit 6dd129a

2 files changed

Lines changed: 37 additions & 8 deletions

File tree

Bloxstrap/Models/GlyphItem.cs

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,41 @@
1-
using System.Windows.Media;
1+
using System.ComponentModel;
2+
using System.Runtime.CompilerServices;
3+
using System.Windows.Media;
24

35
namespace Bloxstrap.Models
46
{
5-
public class GlyphItem
7+
public class GlyphItem : INotifyPropertyChanged
68
{
7-
public Geometry Data { get; set; } = null!;
8-
public SolidColorBrush ColorBrush { get; set; } = null!;
9+
private Geometry? _data;
10+
private SolidColorBrush? _colorBrush;
11+
12+
public Geometry? Data
13+
{
14+
get => _data;
15+
set
16+
{
17+
if (Equals(_data, value)) return;
18+
_data = value;
19+
OnPropertyChanged();
20+
}
21+
}
22+
23+
public SolidColorBrush? ColorBrush
24+
{
25+
get => _colorBrush;
26+
set
27+
{
28+
if (Equals(_colorBrush, value)) return;
29+
_colorBrush = value;
30+
OnPropertyChanged();
31+
}
32+
}
33+
34+
public event PropertyChangedEventHandler? PropertyChanged;
35+
36+
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
37+
{
38+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
39+
}
940
}
10-
}
41+
}

Bloxstrap/UI/ViewModels/Settings/ModsViewModel.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ private async Task LoadGlyphPreviewsAsync(string fontPath)
634634

635635
var characterCodes = typeface.CharacterToGlyphMap.Keys
636636
.OrderByDescending(c => c)
637+
.Take(80)
637638
.ToList();
638639

639640
var tasks = characterCodes.Select(async characterCode =>
@@ -700,9 +701,6 @@ private void UpdateGlyphColors()
700701
{
701702
item.ColorBrush = newBrush;
702703
}
703-
704-
var updatedItems = new ObservableCollection<GlyphItem>(GlyphItems);
705-
GlyphItems = updatedItems;
706704
}
707705

708706
private bool IsValidHexColor(string hex)

0 commit comments

Comments
 (0)