mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Refactored the edit tool
Fixed the fill shape but it might need some rethinking
This commit is contained in:
1 parent
19bbef4cad
commit
5a44e5fbe8
32 files changed
+1037
-826
No files matched your search
@@ -16,7 +16,11 @@ namespace Artemis.Core.Models.Profile.LayerShapes
|
||||
public override void CalculateRenderProperties()
|
||||
{
|
||||
RenderRectangle = GetUnscaledRectangle();
|
||||
RenderPath = Layer.Path;
|
||||
|
||||
// Shape originates from the center so compensate the path for that
|
||||
var renderPath = new SKPath(Layer.Path);
|
||||
renderPath.Transform(SKMatrix.MakeTranslation(RenderRectangle.Left - Layer.Path.Bounds.Left, RenderRectangle.Top - Layer.Path.Bounds.Top));
|
||||
RenderPath = renderPath;
|
||||
}
|
||||
|
||||
public override void ApplyToEntity()
|
||||
|
||||
@@ -58,37 +58,10 @@ namespace Artemis.Core.Models.Profile.LayerShapes
|
||||
return SKRect.Empty;
|
||||
|
||||
return SKRect.Create(
|
||||
Layer.Rectangle.Left + Layer.Rectangle.Width * ScaledRectangle.Left,
|
||||
Layer.Rectangle.Top + Layer.Rectangle.Height * ScaledRectangle.Top,
|
||||
Layer.Rectangle.Width * ScaledRectangle.Width,
|
||||
Layer.Rectangle.Height * ScaledRectangle.Height
|
||||
);
|
||||
}
|
||||
|
||||
public void SetFromUnscaledAnchor(SKPoint anchor, TimeSpan? time)
|
||||
{
|
||||
if (!Layer.Leds.Any())
|
||||
{
|
||||
Layer.PositionProperty.SetCurrentValue(SKPoint.Empty, time);
|
||||
Layer.SizeProperty.SetCurrentValue(SKSize.Empty, time);
|
||||
return;
|
||||
}
|
||||
|
||||
Layer.AnchorPointProperty.SetCurrentValue(new SKPoint(
|
||||
100f / Layer.Rectangle.Width * (anchor.X - Layer.Rectangle.Left - Layer.PositionProperty.CurrentValue.X) / 100f,
|
||||
100f / Layer.Rectangle.Height * (anchor.Y - Layer.Rectangle.Top - Layer.PositionProperty.CurrentValue.Y) / 100f
|
||||
), time);
|
||||
CalculateRenderProperties();
|
||||
}
|
||||
|
||||
public SKPoint GetUnscaledAnchor()
|
||||
{
|
||||
if (!Layer.Leds.Any())
|
||||
return SKPoint.Empty;
|
||||
|
||||
return new SKPoint(
|
||||
Layer.Rectangle.Left + Layer.Rectangle.Width * (Layer.AnchorPointProperty.CurrentValue.X + Layer.PositionProperty.CurrentValue.X),
|
||||
Layer.Rectangle.Top + Layer.Rectangle.Height * (Layer.AnchorPointProperty.CurrentValue.Y + Layer.PositionProperty.CurrentValue.Y)
|
||||
Layer.AbsoluteRectangle.Left + Layer.AbsoluteRectangle.Width * ScaledRectangle.Left,
|
||||
Layer.AbsoluteRectangle.Top + Layer.AbsoluteRectangle.Height * ScaledRectangle.Top,
|
||||
Layer.AbsoluteRectangle.Width * ScaledRectangle.Width,
|
||||
Layer.AbsoluteRectangle.Height * ScaledRectangle.Height
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user