diff --git a/src/Artemis.UI/ViewModels/Controls/ProfileEditor/ProfileLedViewModel.cs b/src/Artemis.UI/ViewModels/Controls/ProfileEditor/ProfileLedViewModel.cs
index 55e7c1a54..42e13bb2b 100644
--- a/src/Artemis.UI/ViewModels/Controls/ProfileEditor/ProfileLedViewModel.cs
+++ b/src/Artemis.UI/ViewModels/Controls/ProfileEditor/ProfileLedViewModel.cs
@@ -32,46 +32,69 @@ namespace Artemis.UI.ViewModels.Controls.ProfileEditor
private void CreateLedGeometry()
{
- var geometryRectangle = new Rect(0, 0, 1, 1);
- Geometry geometry;
-
switch (Led.Shape)
{
case Shape.Custom:
- try
- {
- geometry = Geometry.Parse(Led.ShapeData);
- }
- catch (Exception)
- {
- geometry = new RectangleGeometry(geometryRectangle);
- }
-
+ CreateCustomGeometry();
break;
case Shape.Rectangle:
- geometry = new RectangleGeometry(geometryRectangle);
+ if (Led.Device.DeviceInfo.DeviceType == RGBDeviceType.Keyboard || Led.Device.DeviceInfo.DeviceType == RGBDeviceType.Keypad)
+ CreateKeyCapGeometry();
+ else
+ CreateRectangleGeometry();
break;
case Shape.Circle:
- geometry = new EllipseGeometry(geometryRectangle);
+ CreateCircleGeometry();
break;
default:
throw new ArgumentOutOfRangeException();
}
- DisplayGeometry = Geometry.Combine(
- Geometry.Empty,
- geometry,
- GeometryCombineMode.Union,
- new ScaleTransform(Led.LedRectangle.Width, Led.LedRectangle.Height)
- );
-
// Stroke geometry is the display geometry excluding the inner geometry
- StrokeGeometry = DisplayGeometry.GetWidenedPathGeometry(new Pen(null, Led.Shape == Shape.Rectangle ? 2.0 : 1.0), 0.1, ToleranceType.Absolute);
-
+ StrokeGeometry = DisplayGeometry.GetWidenedPathGeometry(new Pen(null, 1.0), 0.1, ToleranceType.Absolute);
DisplayGeometry.Freeze();
StrokeGeometry.Freeze();
}
+ private void CreateRectangleGeometry()
+ {
+ DisplayGeometry = new RectangleGeometry(new Rect(0.5, 0.5, Led.LedRectangle.Width - 1, Led.LedRectangle.Height - 1));
+ }
+
+ private void CreateCircleGeometry()
+ {
+ DisplayGeometry = new EllipseGeometry(new Rect(0.5, 0.5, Led.LedRectangle.Width - 1, Led.LedRectangle.Height - 1));
+ }
+
+ private void CreateKeyCapGeometry()
+ {
+ DisplayGeometry = new RectangleGeometry(new Rect(1, 1, Led.LedRectangle.Width - 2, Led.LedRectangle.Height - 2), 1.6, 1.6);
+ }
+
+ private void CreateCustomGeometry()
+ {
+ try
+ {
+ DisplayGeometry = Geometry.Combine(
+ Geometry.Empty,
+ Geometry.Parse(Led.ShapeData),
+ GeometryCombineMode.Union,
+ new TransformGroup
+ {
+ Children = new TransformCollection
+ {
+ new ScaleTransform(Led.LedRectangle.Width - 1, Led.LedRectangle.Height - 1),
+ new TranslateTransform(0.5, 0.5)
+ }
+ }
+ );
+ }
+ catch (Exception)
+ {
+ CreateRectangleGeometry();
+ }
+ }
+
public void Update()
{
var newColor = Led.Color.ToMediaColor();
diff --git a/src/Artemis.UI/Views/Controls/ProfileEditor/ProfileLedView.xaml b/src/Artemis.UI/Views/Controls/ProfileEditor/ProfileLedView.xaml
index 67e112818..52ba21911 100644
--- a/src/Artemis.UI/Views/Controls/ProfileEditor/ProfileLedView.xaml
+++ b/src/Artemis.UI/Views/Controls/ProfileEditor/ProfileLedView.xaml
@@ -19,7 +19,7 @@
-
+