Skip to content
This repository was archived by the owner on Nov 25, 2023. It is now read-only.

Commit 4447e6d

Browse files
committed
Fix ComplexFeature key background color
1 parent 9f83526 commit 4447e6d

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

src/InvvardDev.EZLayoutDisplay.Desktop/Helper/EZLayoutMaker.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ private KeyDisplayMode SelectKeyDisplayMode(ErgodoxKey ergodoxKey)
7777
.ToList();
7878

7979
var featureCount = features.Count;
80+
var isComplexFeature = featureCount == 1 && (ergodoxKey.DoubleTap != null || ergodoxKey.TapHold != null);
8081
KeyDefinition firstKeyDefinition = null;
8182
if (features.Any())
8283
{
@@ -87,8 +88,9 @@ private KeyDisplayMode SelectKeyDisplayMode(ErgodoxKey ergodoxKey)
8788
{
8889
0 => KeyDisplayMode.Empty,
8990
1 when ergodoxKey.Tap?.Macro != null => KeyDisplayMode.Macro,
90-
1 when firstKeyDefinition.Category == KeyCategory.Modifier => KeyDisplayMode.Modifier,
9191
1 when firstKeyDefinition.Category == KeyCategory.Shine => KeyDisplayMode.ColorControl,
92+
1 when isComplexFeature => KeyDisplayMode.ComplexFeature,
93+
1 when firstKeyDefinition.Category == KeyCategory.Modifier => KeyDisplayMode.Modifier,
9294
1 when !string.IsNullOrWhiteSpace(ergodoxKey.CustomLabel) => KeyDisplayMode.CustomLabel,
9395
>= 2 => KeyDisplayMode.DualFunction,
9496
_ => KeyDisplayMode.Base
@@ -122,6 +124,7 @@ private Key PrepareKeyContent(ErgodoxKey ergodoxKey, KeyDisplayMode displayMode)
122124
key.Primary = new BaseContent { Label = "Macro" };
123125
break;
124126
case KeyDisplayMode.Base:
127+
case KeyDisplayMode.ComplexFeature:
125128
case KeyDisplayMode.Modifier:
126129
case KeyDisplayMode.ColorControl:
127130
key.Primary = GetDisplayedFeature(features[0]);

src/InvvardDev.EZLayoutDisplay.Desktop/Model/Enum/KeyDisplayMode.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public enum KeyDisplayMode
88
Macro,
99
CustomLabel,
1010
Modifier,
11-
ColorControl
11+
ColorControl,
12+
ComplexFeature
1213
}
1314
}

src/InvvardDev.EZLayoutDisplay.Desktop/Skins/KeyboardLayoutSkin.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<converter:KeyCategoryToBrushConverter x:Key="KeyCategoryToBrushConverter"
1919
DefaultBackgroundBrush="{StaticResource DefaultBackgroundBrush}"
2020
ColorControlBackgroundBrush="{StaticResource ColorControlBackgroundBrush}"
21+
ComplexFeatureBackgroundBrush="{StaticResource DualFunctionBackgroundBrush}"
2122
CustomLabelBackgroundBrush="{StaticResource CustomLabelBackgroundBrush}"
2223
DualFunctionBackgroundBrush="{StaticResource DualFunctionBackgroundBrush}"
2324
MacroBackgroundBrush="{StaticResource MacroBackgroundBrush}"

src/InvvardDev.EZLayoutDisplay.Desktop/View/Converter/KeyCategoryToBrushConverter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class KeyCategoryToBrushConverter : IValueConverter
1212
{
1313
public SolidColorBrush DefaultBackgroundBrush { private get; set; }
1414
public SolidColorBrush ColorControlBackgroundBrush { private get; set; }
15+
public SolidColorBrush ComplexFeatureBackgroundBrush { private get; set; }
1516
public SolidColorBrush CustomLabelBackgroundBrush { private get; set; }
1617
public SolidColorBrush DualFunctionBackgroundBrush { private get; set; }
1718
public SolidColorBrush MacroBackgroundBrush { private get; set; }
@@ -21,6 +22,7 @@ public KeyCategoryToBrushConverter()
2122
{
2223
DefaultBackgroundBrush = Application.Current.Resources["DefaultBackgroundBrush"] as SolidColorBrush;
2324
ColorControlBackgroundBrush = Application.Current.Resources["ColorControlBackgroundBrush"] as SolidColorBrush;
25+
ComplexFeatureBackgroundBrush = Application.Current.Resources["ComplexFeatureBackgroundBrush"] as SolidColorBrush;
2426
CustomLabelBackgroundBrush = Application.Current.Resources["CustomLabelBackgroundBrush"] as SolidColorBrush;
2527
DualFunctionBackgroundBrush = Application.Current.Resources["DualFunctionBackgroundBrush"] as SolidColorBrush;
2628
MacroBackgroundBrush = Application.Current.Resources["MacroBackgroundBrush"] as SolidColorBrush;
@@ -35,6 +37,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
3537
brush = displayMode switch
3638
{
3739
KeyDisplayMode.ColorControl => ColorControlBackgroundBrush,
40+
KeyDisplayMode.ComplexFeature => ComplexFeatureBackgroundBrush,
3841
KeyDisplayMode.CustomLabel => CustomLabelBackgroundBrush,
3942
KeyDisplayMode.DualFunction => DualFunctionBackgroundBrush,
4043
KeyDisplayMode.Macro => MacroBackgroundBrush,

0 commit comments

Comments
 (0)