mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-12 21:38:38 +00:00
Surface editor - Auto-arrange new configs by default
This commit is contained in:
parent
8c42c916e8
commit
dcd4a85e37
@ -45,9 +45,13 @@ namespace Artemis.Core.Services
|
||||
void DeleteSurfaceConfiguration(ArtemisSurface surface);
|
||||
|
||||
/// <summary>
|
||||
/// Applies auto-arranging logic to the current active surface
|
||||
/// Applies auto-arranging logic to a surface
|
||||
/// </summary>
|
||||
void AutoArrange();
|
||||
/// <param name="artemisSurface">
|
||||
/// The surface to apply auto-arrange to. If <see langword="null" /> the
|
||||
/// <see cref="ActiveSurface" /> is used.
|
||||
/// </param>
|
||||
void AutoArrange(ArtemisSurface? artemisSurface = null);
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the active device entity has been changed
|
||||
|
||||
@ -49,6 +49,9 @@ namespace Artemis.Core.Services
|
||||
configuration.Devices.Add(new ArtemisDevice(rgbDevice, deviceProvider, configuration));
|
||||
}
|
||||
|
||||
// Auto-arrange the new config
|
||||
AutoArrange(configuration);
|
||||
|
||||
lock (_surfaceConfigurations)
|
||||
{
|
||||
_surfaceRepository.Add(configuration.SurfaceEntity);
|
||||
@ -102,6 +105,7 @@ namespace Artemis.Core.Services
|
||||
deviceConfiguration.ApplyToRgbDevice();
|
||||
}
|
||||
}
|
||||
|
||||
surface.UpdateLedMap();
|
||||
|
||||
_surfaceRepository.Save(surface.SurfaceEntity);
|
||||
@ -200,11 +204,13 @@ namespace Artemis.Core.Services
|
||||
|
||||
#region AutoLayout
|
||||
|
||||
public void AutoArrange()
|
||||
public void AutoArrange(ArtemisSurface? artemisSurface = null)
|
||||
{
|
||||
artemisSurface ??= ActiveSurface;
|
||||
|
||||
SurfaceArrangement surfaceArrangement = SurfaceArrangement.GetDefaultArrangement();
|
||||
surfaceArrangement.Arrange(ActiveSurface);
|
||||
UpdateSurfaceConfiguration(ActiveSurface, true);
|
||||
surfaceArrangement.Arrange(artemisSurface);
|
||||
UpdateSurfaceConfiguration(artemisSurface, true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user