1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Surface editor - Added option to only light the top-left LED of a device

This commit is contained in:
Robert 2021-03-15 19:50:21 +01:00
parent eaa1f15ac3
commit c51016f8f2
2 changed files with 30 additions and 3 deletions

View File

@ -209,6 +209,13 @@
ToolTip="If selected, each device is completely lid up with a random color">
Show random device colors
</CheckBox>
<CheckBox Style="{StaticResource MaterialDesignCheckBox}"
IsChecked="{Binding ColorFirstLedOnly}"
IsEnabled="{Binding ColorDevices}"
ToolTip="If selected, only the first LED of each device is lid up, aiding with rotation settings"
Margin="5 0 0 0">
Light up first LED only
</CheckBox>
</StackPanel>
</materialDesign:Card>
</StackPanel>

View File

@ -92,7 +92,18 @@ namespace Artemis.UI.Screens.SurfaceEditor
public bool ColorDevices
{
get => _colorDevices;
set => SetAndNotify(ref _colorDevices, value);
set
{
SetAndNotify(ref _colorDevices, value);
if (!value)
ColorFirstLedOnly = false;
}
}
public bool ColorFirstLedOnly
{
get => _colorFirstLedOnly;
set => SetAndNotify(ref _colorFirstLedOnly, value);
}
public void OpenHyperlink(object sender, RequestNavigateEventArgs e)
@ -127,8 +138,16 @@ namespace Artemis.UI.Screens.SurfaceEditor
foreach (ListDeviceViewModel listDeviceViewModel in ListDeviceViewModels)
{
foreach (ArtemisLed artemisLed in listDeviceViewModel.Device.Leds)
e.Canvas.DrawRect(artemisLed.AbsoluteRectangle, new SKPaint {Color = listDeviceViewModel.Color});
// Order by position to accurately get the first LED
List<ArtemisLed> leds = listDeviceViewModel.Device.Leds.OrderBy(l => l.Rectangle.Left).ThenBy(l => l.Rectangle.Top).ToList();
for (int index = 0; index < leds.Count; index++)
{
ArtemisLed artemisLed = leds[index];
if (ColorFirstLedOnly && index > 0)
e.Canvas.DrawRect(artemisLed.AbsoluteRectangle, new SKPaint {Color = new SKColor(0, 0, 0)});
else
e.Canvas.DrawRect(artemisLed.AbsoluteRectangle, new SKPaint {Color = listDeviceViewModel.Color});
}
}
}
@ -258,6 +277,7 @@ namespace Artemis.UI.Screens.SurfaceEditor
private MouseDragStatus _mouseDragStatus;
private Point _mouseDragStartPoint;
private bool _colorDevices;
private bool _colorFirstLedOnly;
// ReSharper disable once UnusedMember.Global - Called from view
public void EditorGridMouseClick(object sender, MouseButtonEventArgs e)