forked from unoplatform/uno
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransformExtensions.Android.cs
More file actions
54 lines (47 loc) · 1.31 KB
/
Copy pathTransformExtensions.Android.cs
File metadata and controls
54 lines (47 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Numerics;
using System.Text;
using Uno;
using Uno.UI;
namespace Windows.UI.Xaml.Media
{
public static class TransformExtensions
{
internal static DependencyPropertyChangedEventArgs CreateInitialChangedEventArgs(this Transform transform, DependencyProperty property)
{
return new DependencyPropertyChangedEventArgs(
property,
null,
DependencyPropertyValuePrecedences.DefaultValue,
transform.GetValue(property),
transform.GetCurrentHighestValuePrecedence(property)
);
}
internal static Vector2? GetCenter(this Transform transform)
{
var asRotate = transform as RotateTransform;
if (asRotate != null)
{
return new Vector2((float)asRotate.CenterX, (float)asRotate.CenterY);
}
var asComposite = transform as CompositeTransform;
if (asComposite != null)
{
return new Vector2((float)asComposite.CenterX, (float)asComposite.CenterY);
}
var asScale = transform as ScaleTransform;
if (asScale != null)
{
return new Vector2((float)asScale.CenterX, (float)asScale.CenterY);
}
var asSkew = transform as SkewTransform;
if (asSkew != null)
{
return new Vector2((float)asSkew.CenterX, (float)asSkew.CenterY);
}
return null;
}
}
}