Need this on another PC :))

This commit is contained in:
Robert committed 2019-12-17 20:27:50 +01:00
1 parent 6cf9fb9158
commit 94df1544c5
13 files changed
+232 -77

No files matched your search

+14 -1
View File
@@ -98,7 +98,7 @@ namespace Artemis.Core.Models.Profile
{
_layerShape = value;
if (Path != null)
_layerShape.CalculateRenderProperties();
CalculateRenderProperties();
}
}
@@ -221,7 +221,13 @@ namespace Artemis.Core.Models.Profile
internal void CalculateRenderProperties()
{
if (!Leds.Any())
{
Rectangle = SKRect.Empty;
AbsoluteRectangle = SKRect.Empty;
Path = new SKPath();
OnRenderPropertiesUpdated();
return;
}
// Determine to top-left and bottom-right
var minX = Leds.Min(l => l.AbsoluteRenderRectangle.Left);
@@ -237,6 +243,7 @@ namespace Artemis.Core.Models.Profile
path.AddRect(artemisLed.AbsoluteRenderRectangle);
Path = path;
LayerShape.CalculateRenderProperties();
OnRenderPropertiesUpdated();
}
@@ -248,12 +255,18 @@ namespace Artemis.Core.Models.Profile
#region Events
public event EventHandler RenderPropertiesUpdated;
public event EventHandler ShapePropertiesUpdated;
private void OnRenderPropertiesUpdated()
{
RenderPropertiesUpdated?.Invoke(this, EventArgs.Empty);
}
private void OnShapePropertiesUpdated()
{
ShapePropertiesUpdated?.Invoke(this, EventArgs.Empty);
}
#endregion
}
}
@@ -9,8 +9,6 @@ namespace Artemis.Core.Models.Profile.LayerShapes
protected LayerShape(Layer layer)
{
Layer = layer;
Layer.RenderPropertiesUpdated += LayerOnRenderPropertiesUpdated;
}
protected LayerShape(Layer layer, ShapeEntity shapeEntity)
@@ -19,14 +17,8 @@ namespace Artemis.Core.Models.Profile.LayerShapes
Anchor = new SKPoint(shapeEntity.Anchor?.X ?? 0, shapeEntity.Anchor?.Y ?? 0);
Position = new SKPoint(shapeEntity.Position?.X ?? 0, shapeEntity.Position?.Y ?? 0);
Size = new SKSize(shapeEntity.Width, shapeEntity.Height);
Layer.RenderPropertiesUpdated += LayerOnRenderPropertiesUpdated;
}
private void LayerOnRenderPropertiesUpdated(object sender, EventArgs e)
{
CalculateRenderProperties();
}
/// <summary>
/// The layer this shape is attached to
@@ -95,9 +95,6 @@ namespace Artemis.Core.Services.Storage
folder.ApplyToEntity();
foreach (var layer in profile.GetAllLayers())
layer.ApplyToEntity();
if (_surfaceService.ActiveSurface != null)
profile.PopulateLeds(_surfaceService.ActiveSurface);
}
_profileRepository.Save(profile.ProfileEntity);