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

Commit 29cabf4

Browse files
committed
Update key templating
1 parent cef6f9d commit 29cabf4

File tree

2 files changed

+33
-37
lines changed

2 files changed

+33
-37
lines changed

src/InvvardDev.EZLayoutDisplay.Desktop/Model/KeyTemplate.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,15 @@ public class KeyTemplate
6969
[DefaultValue(false)]
7070
public bool IsGlowing { get; set; }
7171

72-
// ReSharper disable UnusedMember.Global : Used in XAML
73-
// ReSharper disable MemberCanBePrivate.Global : Used in XAML
7472
public double BaseKeyX => HorizontalOffset * KeyUnitSize + BaseRelativeLeft * KeyUnitSize;
7573
public double BaseKeyY => VerticalOffset * KeyUnitSize + BaseRelativeTop * KeyUnitSize;
76-
public double TopKeyX => BaseKeyX + 3;
77-
public double TopKeyY => BaseKeyY + 3;
74+
public double TopKeyX => BaseKeyX + 2;
75+
public double TopKeyY => BaseKeyY + 2;
7876

7977
public double BaseKeyWidth => BaseRelativeWidth * KeyUnitSize;
8078
public double BaseKeyHeight => BaseRelativeHeight * KeyUnitSize;
81-
public double TopKeyWidth => BaseKeyWidth - 6;
82-
public double TopKeyHeight => BaseKeyHeight - 11;
83-
// ReSharper restore MemberCanBePrivate.Global
84-
// ReSharper restore UnusedMember.Global
79+
public double TopKeyWidth => BaseKeyWidth - 4;
80+
public double TopKeyHeight => BaseKeyHeight - 4;
8581

8682
public Key Key { get; set; }
8783

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

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
xmlns:helper="clr-namespace:InvvardDev.EZLayoutDisplay.Desktop.Helper"
44
xmlns:converter="clr-namespace:InvvardDev.EZLayoutDisplay.Desktop.View.Converter">
55

6-
<FontFamily x:Key="LatoFontFamily">/InvvardDev.EZLayoutDisplay.Desktop;component/Skins/Fonts/#Lato</FontFamily>
7-
<FontFamily x:Key="OryxFontFamily">/InvvardDev.EZLayoutDisplay.Desktop;component/Skins/Fonts/#Oryx</FontFamily>
6+
<FontFamily x:Key="InterFontFamily">/Skins/Fonts/#Inter</FontFamily>
7+
<FontFamily x:Key="OryxFontFamily">/Skins/Fonts/#Oryx</FontFamily>
88

99
<SolidColorBrush x:Key="KeyLabelForeground" Color="#323546" />
1010
<SolidColorBrush x:Key="DefaultBackgroundBrush" Color="#FFFFFF" />
@@ -24,19 +24,7 @@
2424

2525
<SolidColorBrush x:Key="KeyBorderColorBrush" Color="#c7c7c7" />
2626

27-
<Style TargetType="Rectangle" x:Key="BaseKey">
28-
<Setter Property="StrokeThickness" Value="1" />
29-
<Setter Property="RenderTransform">
30-
<Setter.Value>
31-
<TransformGroup>
32-
<RotateTransform Angle="{Binding RotationAngle}" />
33-
</TransformGroup>
34-
</Setter.Value>
35-
</Setter>
36-
<Setter Property="RenderTransformOrigin" Value="{Binding RotationOrigin}" />
37-
</Style>
38-
39-
<Style TargetType="Rectangle" BasedOn="{StaticResource BaseKey}" x:Key="KeyBase">
27+
<Style TargetType="Rectangle" x:Key="KeyBase">
4028
<Setter Property="RadiusX" Value="5" />
4129
<Setter Property="RadiusY" Value="5" />
4230
<Setter Property="Fill" Value="{Binding Key.DisplayMode, Converter={StaticResource KeyCategoryToBrushConverter}}" />
@@ -45,21 +33,29 @@
4533
<Setter Property="Canvas.Left" Value="{Binding BaseKeyX}" />
4634
<Setter Property="Height" Value="{Binding BaseKeyHeight}" />
4735
<Setter Property="Width" Value="{Binding BaseKeyWidth}" />
36+
<Setter Property="StrokeThickness" Value="1" />
37+
<Setter Property="RenderTransformOrigin" Value="{Binding RotationOrigin}" />
38+
<Setter Property="RenderTransform">
39+
<Setter.Value>
40+
<TransformGroup>
41+
<RotateTransform Angle="{Binding RotationAngle}" />
42+
</TransformGroup>
43+
</Setter.Value>
44+
</Setter>
4845
</Style>
4946

5047
<Style TargetType="Label" x:Key="BaseLabelStyle">
51-
<Setter Property="Padding" Value="2 0" />
5248
<Setter Property="Foreground" Value="{StaticResource KeyLabelForeground}" />
5349
</Style>
5450

5551
<Style TargetType="Label" x:Key="LabelStyle" BasedOn="{StaticResource BaseLabelStyle}">
56-
<Setter Property="FontFamily" Value="{StaticResource LatoFontFamily}" />
57-
<Setter Property="FontSize" Value="22" />
52+
<Setter Property="FontFamily" Value="{StaticResource InterFontFamily}" />
53+
<Setter Property="FontSize" Value="20" />
5854
</Style>
5955

6056
<Style TargetType="Label" x:Key="GlyphStyle" BasedOn="{StaticResource BaseLabelStyle}">
6157
<Setter Property="FontFamily" Value="{StaticResource OryxFontFamily}" />
62-
<Setter Property="FontSize" Value="18" />
58+
<Setter Property="FontSize" Value="22" />
6359
</Style>
6460

6561
<DataTemplate x:Key="KeyDataTemplate">
@@ -85,16 +81,11 @@
8581

8682
<Style TargetType="Viewbox" x:Key="LabelViewBox">
8783
<Setter Property="Height" Value="30" />
88-
<Setter Property="Margin" Value="1 0" />
8984
<Setter Property="Stretch" Value="Uniform" />
90-
<Setter Property="StretchDirection" Value="Both" />
85+
<Setter Property="StretchDirection" Value="DownOnly" />
9186
<Setter Property="VerticalAlignment" Value="Center" />
9287
</Style>
9388

94-
<Style TargetType="Viewbox" x:Key="ModifierViewBox" BasedOn="{StaticResource LabelViewBox}">
95-
<Setter Property="Height" Value="18" />
96-
</Style>
97-
9889
<Style TargetType="Grid" x:Key="ContentGridBase">
9990
<Setter Property="Canvas.Top" Value="{Binding TopKeyY}" />
10091
<Setter Property="Canvas.Left" Value="{Binding TopKeyX}" />
@@ -136,7 +127,10 @@
136127

137128
<DataTemplate x:Key="ColorPickerDataTemplate">
138129
<Viewbox Style="{StaticResource LabelViewBox}">
139-
<Label Style="{StaticResource GlyphStyle}" Content="{Binding Label}" />
130+
<Grid>
131+
<Ellipse Width="10" Height="10" Fill="{Binding ColorCode}" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0 -10 -8 0"/>
132+
<Label Style="{StaticResource GlyphStyle}" Content="{Binding Label}" FontSize="30"/>
133+
</Grid>
140134
</Viewbox>
141135
</DataTemplate>
142136

@@ -151,7 +145,9 @@
151145
<Canvas>
152146
<ContentPresenter Content="{Binding}" ContentTemplate="{StaticResource KeyDataTemplate}" />
153147
<Grid Style="{StaticResource ContentGridBase}">
154-
<TextBlock Style="{StaticResource PrimaryTag}" Text="{Binding Key.Primary.Tag}" />
148+
<Viewbox VerticalAlignment="Top" HorizontalAlignment="Right" Stretch="None">
149+
<TextBlock Style="{StaticResource PrimaryTag}" Text="{Binding Key.Primary.Tag}" />
150+
</Viewbox>
155151
<ContentControl ContentTemplateSelector="{StaticResource KeyFeatureTemplateSelector}" Content="{Binding Key.Primary}" />
156152
</Grid>
157153
</Canvas>
@@ -165,8 +161,12 @@
165161
<RowDefinition Height="*"/>
166162
<RowDefinition Height="*"/>
167163
</Grid.RowDefinitions>
168-
<TextBlock Style="{StaticResource PrimaryTag}" Text="{Binding Key.Primary.Tag}" />
169-
<TextBlock Style="{StaticResource SecondaryTag}" Text="{Binding Key.Secondary.Tag}" />
164+
<Viewbox Grid.Row="0" VerticalAlignment="Top" HorizontalAlignment="Right" Stretch="None">
165+
<TextBlock Style="{StaticResource PrimaryTag}" Text="{Binding Key.Primary.Tag}" />
166+
</Viewbox>
167+
<Viewbox Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" Stretch="None">
168+
<TextBlock Style="{StaticResource SecondaryTag}" Text="{Binding Key.Secondary.Tag}" />
169+
</Viewbox>
170170

171171
<ContentControl ContentTemplateSelector="{StaticResource KeyFeatureTemplateSelector}"
172172
Content="{Binding Key.Primary}"

0 commit comments

Comments
 (0)