UI - Further restructuring

This commit is contained in:
SpoinkyNL committed 2020-05-14 21:58:30 +02:00
1 parent a9c9d06354
commit 678fad95d1
53 files changed
+459 -1242

No files matched your search

@@ -35,7 +35,7 @@ namespace Artemis.UI.Services
public Point GetLayerAnchorPosition(Layer layer, SKPoint? positionOverride = null)
{
var layerBounds = GetLayerBounds(layer).ToSKRect();
var positionProperty = layer.Properties.Position.CurrentValue;
var positionProperty = layer.Transform.Position.CurrentValue;
if (positionOverride != null)
positionProperty = positionOverride.Value;
@@ -59,7 +59,7 @@ namespace Artemis.UI.Services
// the layer using the structure of the XAML while the Core has to deal with that by applying the layer
// position to the translation
var anchorPosition = GetLayerAnchorPosition(layer);
var anchorProperty = layer.Properties.AnchorPoint.CurrentValue;
var anchorProperty = layer.Transform.AnchorPoint.CurrentValue;
// Translation originates from the unscaled center of the shape and is tied to the anchor
var x = anchorPosition.X - layerBounds.MidX - anchorProperty.X * layerBounds.Width;
@@ -67,8 +67,8 @@ namespace Artemis.UI.Services
var transformGroup = new TransformGroup();
transformGroup.Children.Add(new TranslateTransform(x, y));
transformGroup.Children.Add(new ScaleTransform(layer.Properties.Scale.CurrentValue.Width / 100f, layer.Properties.Scale.CurrentValue.Height / 100f, anchorPosition.X, anchorPosition.Y));
transformGroup.Children.Add(new RotateTransform(layer.Properties.Rotation.CurrentValue, anchorPosition.X, anchorPosition.Y));
transformGroup.Children.Add(new ScaleTransform(layer.Transform.Scale.CurrentValue.Width / 100f, layer.Transform.Scale.CurrentValue.Height / 100f, anchorPosition.X, anchorPosition.Y));
transformGroup.Children.Add(new RotateTransform(layer.Transform.Rotation.CurrentValue, anchorPosition.X, anchorPosition.Y));
return transformGroup;
}
@@ -83,7 +83,7 @@ namespace Artemis.UI.Services
if (anchorOverride != null)
anchorPosition = anchorOverride.Value;
var anchorProperty = layer.Properties.AnchorPoint.CurrentValue;
var anchorProperty = layer.Transform.AnchorPoint.CurrentValue;
// Translation originates from the unscaled center of the shape and is tied to the anchor
var x = anchorPosition.X - layerBounds.MidX - anchorProperty.X * layerBounds.Width;
@@ -94,9 +94,9 @@ namespace Artemis.UI.Services
if (includeTranslation)
path.Transform(SKMatrix.MakeTranslation(x, y));
if (includeScale)
path.Transform(SKMatrix.MakeScale(layer.Properties.Scale.CurrentValue.Width / 100f, layer.Properties.Scale.CurrentValue.Height / 100f, anchorPosition.X, anchorPosition.Y));
path.Transform(SKMatrix.MakeScale(layer.Transform.Scale.CurrentValue.Width / 100f, layer.Transform.Scale.CurrentValue.Height / 100f, anchorPosition.X, anchorPosition.Y));
if (includeRotation)
path.Transform(SKMatrix.MakeRotationDegrees(layer.Properties.Rotation.CurrentValue, anchorPosition.X, anchorPosition.Y));
path.Transform(SKMatrix.MakeRotationDegrees(layer.Transform.Rotation.CurrentValue, anchorPosition.X, anchorPosition.Y));
return path;
}