1
+ namespace MapboxMauiQs ;
2
+
3
+ public class CameraFlyAnimationExample : ContentPage , IExamplePage , IQueryAttributable
4
+ {
5
+ MapboxView map ;
6
+ IExampleInfo info ;
7
+
8
+ public CameraFlyAnimationExample ( )
9
+ {
10
+ iOSPage . SetUseSafeArea ( this , false ) ;
11
+
12
+ var grid = new Grid ( ) ;
13
+ map = new MapboxView ( ) ;
14
+ grid . Children . Add ( map ) ;
15
+
16
+ var btnMoveCamera = new Button ( )
17
+ {
18
+ Text = "Move Camera" ,
19
+ VerticalOptions = LayoutOptions . End ,
20
+ HorizontalOptions = LayoutOptions . Center ,
21
+ Margin = new Thickness ( 24 ) ,
22
+ } ;
23
+ btnMoveCamera . Clicked += HandleMoveCamera ;
24
+ grid . Children . Add ( btnMoveCamera ) ;
25
+
26
+ map . MapReady += Map_MapReady ;
27
+ map . StyleLoaded += Map_StyleLoaded ;
28
+ map . MapLoaded += Map_MapLoaded ;
29
+
30
+ Content = grid ;
31
+ }
32
+
33
+ private void HandleMoveCamera ( object sender , EventArgs e )
34
+ {
35
+ var centerLocation = new MapPosition ( 21.0278 , 105.8342 ) ;
36
+ var cameraOptions = new CameraOptions
37
+ {
38
+ Center = centerLocation ,
39
+ Zoom = 9 ,
40
+ } ;
41
+ map . CameraController . FlyTo (
42
+ cameraOptions ,
43
+ new AnimationOptions ( 3000L ) ) ;
44
+ }
45
+
46
+ public void ApplyQueryAttributes ( IDictionary < string , object > query )
47
+ {
48
+ info = query [ "example" ] as IExampleInfo ;
49
+
50
+ Title = info ? . Title ;
51
+ }
52
+
53
+ private void Map_MapReady ( object sender , EventArgs e )
54
+ {
55
+ var centerLocation = new MapPosition ( 60.1699 , 24.9384 ) ;
56
+ var cameraOptions = new CameraOptions
57
+ {
58
+ Center = centerLocation ,
59
+ Zoom = 9 ,
60
+ } ;
61
+ map . CameraOptions = cameraOptions ;
62
+ map . MapboxStyle = MapboxStyle . STANDARD ;
63
+ }
64
+
65
+ private void Map_MapLoaded ( object sender , EventArgs e )
66
+ {
67
+ // Setup Styles, Annotations, etc here
68
+ }
69
+ private void Map_StyleLoaded ( object sender , EventArgs e )
70
+ {
71
+ }
72
+
73
+ }
0 commit comments