-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
BorderHandler.cs
107 lines (89 loc) · 3.36 KB
/
BorderHandler.cs
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#nullable enable
#if __IOS__ || MACCATALYST
using PlatformView = Microsoft.Maui.Platform.ContentView;
#elif __ANDROID__
using PlatformView = Microsoft.Maui.Platform.ContentViewGroup;
#elif WINDOWS
using PlatformView = Microsoft.Maui.Platform.ContentPanel;
#elif TIZEN
using PlatformView = Microsoft.Maui.Platform.BorderView;
#elif (NETSTANDARD || !PLATFORM)
using PlatformView = System.Object;
#endif
namespace Microsoft.Maui.Handlers
{
public partial class BorderHandler : IBorderHandler
{
public static IPropertyMapper<IBorderView, IBorderHandler> Mapper = new PropertyMapper<IBorderView, IBorderHandler>(ViewMapper)
{
#if __ANDROID__
[nameof(IContentView.Height)] = MapHeight,
[nameof(IContentView.Width)] = MapWidth,
#endif
[nameof(IContentView.Background)] = MapBackground,
[nameof(IContentView.Content)] = MapContent,
[nameof(IBorderStroke.Shape)] = MapStrokeShape,
[nameof(IBorderStroke.Stroke)] = MapStroke,
[nameof(IBorderStroke.StrokeThickness)] = MapStrokeThickness,
[nameof(IBorderStroke.StrokeLineCap)] = MapStrokeLineCap,
[nameof(IBorderStroke.StrokeLineJoin)] = MapStrokeLineJoin,
[nameof(IBorderStroke.StrokeDashPattern)] = MapStrokeDashPattern,
[nameof(IBorderStroke.StrokeDashOffset)] = MapStrokeDashOffset,
[nameof(IBorderStroke.StrokeMiterLimit)] = MapStrokeMiterLimit
};
public static CommandMapper<IBorderView, BorderHandler> CommandMapper = new(ViewCommandMapper)
{
};
public BorderHandler() : base(Mapper, CommandMapper)
{
}
protected BorderHandler(IPropertyMapper mapper, CommandMapper? commandMapper = null)
: base(mapper, commandMapper ?? ViewCommandMapper)
{
}
public BorderHandler(IPropertyMapper? mapper = null) : base(mapper ?? Mapper)
{
}
IBorderView IBorderHandler.VirtualView => VirtualView;
PlatformView IBorderHandler.PlatformView => PlatformView;
public static void MapBackground(IBorderHandler handler, IBorderView border)
{
((PlatformView?)handler.PlatformView)?.UpdateBackground(border);
}
public static void MapStrokeShape(IBorderHandler handler, IBorderView border)
{
((PlatformView?)handler.PlatformView)?.UpdateStrokeShape(border);
MapBackground(handler, border);
}
public static void MapStroke(IBorderHandler handler, IBorderView border)
{
((PlatformView?)handler.PlatformView)?.UpdateStroke(border);
MapBackground(handler, border);
}
public static void MapStrokeThickness(IBorderHandler handler, IBorderView border)
{
((PlatformView?)handler.PlatformView)?.UpdateStrokeThickness(border);
MapBackground(handler, border);
}
public static void MapStrokeLineCap(IBorderHandler handler, IBorderView border)
{
((PlatformView?)handler.PlatformView)?.UpdateStrokeLineCap(border);
}
public static void MapStrokeLineJoin(IBorderHandler handler, IBorderView border)
{
((PlatformView?)handler.PlatformView)?.UpdateStrokeLineJoin(border);
}
public static void MapStrokeDashPattern(IBorderHandler handler, IBorderView border)
{
((PlatformView?)handler.PlatformView)?.UpdateStrokeDashPattern(border);
}
public static void MapStrokeDashOffset(IBorderHandler handler, IBorderView border)
{
((PlatformView?)handler.PlatformView)?.UpdateStrokeDashOffset(border);
}
public static void MapStrokeMiterLimit(IBorderHandler handler, IBorderView border)
{
((PlatformView?)handler.PlatformView)?.UpdateStrokeMiterLimit(border);
}
}
}