mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-31 17:53:32 +00:00
Fix device ZIndex application
This commit is contained in:
parent
6a5304c3e3
commit
1a98ef62d3
@ -114,5 +114,10 @@ namespace Artemis.Core.Models.Surface
|
|||||||
RgbDevice = null;
|
RgbDevice = null;
|
||||||
Surface = null;
|
Surface = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"[{RgbDevice.DeviceInfo.DeviceType}] {RgbDevice.DeviceInfo.DeviceName} - {X}.{Y}.{ZIndex}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -37,8 +37,6 @@ namespace Artemis.UI.ViewModels.Controls.ProfileEditor
|
|||||||
var targetFps = Math.Min(settingsService.GetSetting("TargetFrameRate", 25).Value, 25);
|
var targetFps = Math.Min(settingsService.GetSetting("TargetFrameRate", 25).Value, 25);
|
||||||
_updateTrigger = new TimerUpdateTrigger {UpdateFrequency = 1.0 / targetFps};
|
_updateTrigger = new TimerUpdateTrigger {UpdateFrequency = 1.0 / targetFps};
|
||||||
_updateTrigger.Update += UpdateLeds;
|
_updateTrigger.Update += UpdateLeds;
|
||||||
|
|
||||||
_updateTrigger.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObservableCollection<ProfileDeviceViewModel> Devices { get; set; }
|
public ObservableCollection<ProfileDeviceViewModel> Devices { get; set; }
|
||||||
@ -69,6 +67,13 @@ namespace Artemis.UI.ViewModels.Controls.ProfileEditor
|
|||||||
else
|
else
|
||||||
viewModel.Device = surfaceDeviceConfiguration;
|
viewModel.Device = surfaceDeviceConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort the devices by ZIndex
|
||||||
|
Execute.OnUIThread(() =>
|
||||||
|
{
|
||||||
|
foreach (var device in Devices.OrderBy(d => d.ZIndex).ToList())
|
||||||
|
Devices.Move(Devices.IndexOf(device), device.ZIndex - 1);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnActivate()
|
protected override void OnActivate()
|
||||||
|
|||||||
@ -13,8 +13,12 @@ namespace Artemis.UI.ViewModels.Controls.ProfileEditor
|
|||||||
public ProfileLedViewModel(Led led)
|
public ProfileLedViewModel(Led led)
|
||||||
{
|
{
|
||||||
Led = led;
|
Led = led;
|
||||||
|
X = Led.LedRectangle.X;
|
||||||
|
Y = Led.LedRectangle.Y;
|
||||||
|
Width = Led.LedRectangle.Width;
|
||||||
|
Height = Led.LedRectangle.Height;
|
||||||
|
|
||||||
Execute.OnUIThread(() => { CreateLedGeometry(); });
|
Execute.OnUIThread(CreateLedGeometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Led Led { get; }
|
public Led Led { get; }
|
||||||
@ -28,8 +32,6 @@ namespace Artemis.UI.ViewModels.Controls.ProfileEditor
|
|||||||
public Geometry StrokeGeometry { get; private set; }
|
public Geometry StrokeGeometry { get; private set; }
|
||||||
public Color DisplayColor { get; private set; }
|
public Color DisplayColor { get; private set; }
|
||||||
|
|
||||||
public string Tooltip => $"{Led.Id} - {Led.LedRectangle}";
|
|
||||||
|
|
||||||
private void CreateLedGeometry()
|
private void CreateLedGeometry()
|
||||||
{
|
{
|
||||||
switch (Led.Shape)
|
switch (Led.Shape)
|
||||||
@ -103,18 +105,6 @@ namespace Artemis.UI.ViewModels.Controls.ProfileEditor
|
|||||||
if (!DisplayColor.Equals(newColor))
|
if (!DisplayColor.Equals(newColor))
|
||||||
DisplayColor = newColor;
|
DisplayColor = newColor;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Math.Abs(Led.LedRectangle.X - X) > 0.1)
|
|
||||||
X = Led.LedRectangle.X;
|
|
||||||
|
|
||||||
if (Math.Abs(Led.LedRectangle.Y - Y) > 0.1)
|
|
||||||
Y = Led.LedRectangle.Y;
|
|
||||||
|
|
||||||
if (Math.Abs(Led.LedRectangle.Width - Width) > 0.1)
|
|
||||||
Width = Led.LedRectangle.Width;
|
|
||||||
|
|
||||||
if (Math.Abs(Led.LedRectangle.Height - Height) > 0.1)
|
|
||||||
Height = Led.LedRectangle.Height;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4,18 +4,23 @@ using Stylet;
|
|||||||
|
|
||||||
namespace Artemis.UI.ViewModels.Screens
|
namespace Artemis.UI.ViewModels.Screens
|
||||||
{
|
{
|
||||||
public class ModuleRootViewModel : Screen
|
public class ModuleRootViewModel : Conductor<ModuleViewModel>.Collection.OneActive
|
||||||
{
|
{
|
||||||
public ModuleRootViewModel(Module module, IProfileEditorViewModelFactory profileEditorViewModelFactory)
|
public ModuleRootViewModel(Module module, IProfileEditorViewModelFactory profileEditorViewModelFactory)
|
||||||
{
|
{
|
||||||
Module = module;
|
Module = module;
|
||||||
ModuleViewModels = new BindableCollection<ModuleViewModel> {profileEditorViewModelFactory.CreateModuleViewModel(Module)};
|
|
||||||
ModuleViewModels.AddRange(Module.GetViewModels());
|
// Add the profile editor and module VMs
|
||||||
|
var profileEditor = profileEditorViewModelFactory.CreateModuleViewModel(Module);
|
||||||
|
Items.Add(profileEditor);
|
||||||
|
Items.AddRange(Module.GetViewModels());
|
||||||
|
|
||||||
|
// Activate the profile editor
|
||||||
|
ActiveItem = profileEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Module Module { get; }
|
public Module Module { get; }
|
||||||
public BindableCollection<ModuleViewModel> ModuleViewModels { get; set; }
|
|
||||||
|
public int FixedHeaderCount => Items.Count;
|
||||||
public int FixedHeaderCount => ModuleViewModels.Count;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,6 +101,13 @@ namespace Artemis.UI.ViewModels.Screens
|
|||||||
viewModel.Device = surfaceDeviceConfiguration;
|
viewModel.Device = surfaceDeviceConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort the devices by ZIndex
|
||||||
|
Execute.OnUIThread(() =>
|
||||||
|
{
|
||||||
|
foreach (var device in Devices.OrderBy(d => d.ZIndex).ToList())
|
||||||
|
Devices.Move(Devices.IndexOf(device), device.ZIndex - 1);
|
||||||
|
});
|
||||||
|
|
||||||
_surfaceService.SetActiveSurfaceConfiguration(SelectedSurface);
|
_surfaceService.SetActiveSurfaceConfiguration(SelectedSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,8 +10,7 @@
|
|||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
d:DataContext="{d:DesignInstance screens:ModuleRootViewModel}">
|
d:DataContext="{d:DesignInstance screens:ModuleRootViewModel}">
|
||||||
<dragablz:TabablzControl Margin="0 -1 0 0" FixedHeaderCount="{Binding FixedHeaderCount}"
|
<dragablz:TabablzControl Margin="0 -1 0 0" ItemsSource="{Binding Items}" SelectedItem="{Binding ActiveItem}" FixedHeaderCount="{Binding FixedHeaderCount}">
|
||||||
ItemsSource="{Binding ModuleViewModels}">
|
|
||||||
<dragablz:TabablzControl.HeaderItemTemplate>
|
<dragablz:TabablzControl.HeaderItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding Name}" />
|
<TextBlock Text="{Binding Name}" />
|
||||||
@ -19,7 +18,7 @@
|
|||||||
</dragablz:TabablzControl.HeaderItemTemplate>
|
</dragablz:TabablzControl.HeaderItemTemplate>
|
||||||
<dragablz:TabablzControl.ContentTemplate>
|
<dragablz:TabablzControl.ContentTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<ContentControl s:View.Model="{Binding}" />
|
<ContentControl s:View.Model="{Binding}" IsTabStop="False"/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</dragablz:TabablzControl.ContentTemplate>
|
</dragablz:TabablzControl.ContentTemplate>
|
||||||
</dragablz:TabablzControl>
|
</dragablz:TabablzControl>
|
||||||
|
|||||||
@ -22,8 +22,9 @@
|
|||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid Margin="16">
|
<Grid Margin="16">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" MinWidth="100" />
|
||||||
<ColumnDefinition Width="300" />
|
<ColumnDefinition Width="5" />
|
||||||
|
<ColumnDefinition Width="300" MinWidth="100" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
@ -175,27 +176,24 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</materialDesign:Card>
|
</materialDesign:Card>
|
||||||
|
<GridSplitter Grid.Column="1" Grid.Row="2" Width="5" HorizontalAlignment="Stretch" />
|
||||||
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" Grid.Row="2" Grid.Column="1"
|
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" Grid.Row="2" Grid.Column="2"
|
||||||
VerticalAlignment="Stretch" Margin="5,0,0,0">
|
VerticalAlignment="Stretch" Margin="5,0,0,0">
|
||||||
<materialDesign:DialogHost Identifier="SurfaceListDialogHost" CloseOnClickAway="True"
|
<materialDesign:DialogHost Identifier="SurfaceListDialogHost" CloseOnClickAway="True" UseLayoutRounding="True">
|
||||||
UseLayoutRounding="True">
|
<Grid HorizontalAlignment="Stretch">
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<ListBox Grid.Row="0" ItemsSource="{Binding SurfaceConfigurations}"
|
<ListBox Grid.Row="0" HorizontalContentAlignment="Stretch" ItemsSource="{Binding SurfaceConfigurations}" SelectedItem="{Binding SelectedSurface}">
|
||||||
SelectedItem="{Binding SelectedSurface}">
|
|
||||||
<ListBox.Resources>
|
<ListBox.Resources>
|
||||||
<DataTemplate DataType="{x:Type models:Surface}">
|
<DataTemplate DataType="{x:Type models:Surface}">
|
||||||
<Grid HorizontalAlignment="Stretch">
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="230" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="40" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Text="{Binding Name}" ToolTip="{Binding Name}"
|
<TextBlock Text="{Binding Name}" ToolTip="{Binding Name}" HorizontalAlignment="Left" VerticalAlignment="Center" />
|
||||||
HorizontalAlignment="Left" VerticalAlignment="Center" />
|
|
||||||
<Button Grid.Column="1"
|
<Button Grid.Column="1"
|
||||||
Command="{s:Action DeleteSurfaceConfiguration}"
|
Command="{s:Action DeleteSurfaceConfiguration}"
|
||||||
CommandParameter="{Binding}"
|
CommandParameter="{Binding}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user