aboutsummaryrefslogtreecommitdiffstats
path: root/docs/MapCommands.md
blob: c1d7eeaf390b44f85a66b0e3d8f7b012783fdefb (plain)
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
# MapCommands

Tell your map to do something! Most of these Commands tell your map to (with or without animation) to show a different location. You can use the options from `Mapbox.Cmd.Option` to configure these.

#### `id : String`

Maps should use this as their DOM id.

## Moving the map around

#### `panBy : List (Option { duration : S, easing : S, offset : S, animate : S }) -> ( Int, Int ) -> Cmd msg`

Pans the map by the specified offset.

#### `panTo : List (Option { duration : S, easing : S, offset : S, animate : S }) -> LngLat -> Cmd msg`

Pans the map to the specified location, with an animated transition.


#### `zoomTo : List (Option { duration : S, easing : S, offset : S, animate : S }) -> Float -> Cmd msg`

Zooms the map to the specified zoom level, with an animated transition.

#### `zoomIn : List (Option { duration : S, easing : S, offset : S, animate : S }) -> Cmd msg`

Increases the map's zoom level by 1.


#### `zoomOut : List (Option { duration : S, easing : S, offset : S, animate : S }) -> Cmd msg`

Decreases the map's zoom level by 1.

#### `rotateTo : List (Option { duration : S, easing : S, offset : S, animate : S }) -> Float -> Cmd msg`

Rotates the map to the specified bearing, with an animated transition. The bearing is the compass direction that is "up"; for example, a bearing of 90° orients the map so that east is up.

#### `jumpTo : List (Option { center : S, zoom : S, bearing : S, pitch : S, around : S }) -> Cmd msg`

Changes any combination of center, zoom, bearing, and pitch, without an animated transition. The map will retain its current values for any details not specified in options.

#### `easeTo : List (Option { ... }) -> Cmd msg`

Changes any combination of center, zoom, bearing, and pitch, with an animated transition between old and new values. The map will retain its current values for any details not specified in options.

Supported options:

- `center`
- `zoom`
- `bearing`
- `pitch`
- `around`
- `duration`
- `easing`
- `offset`
- `animate`

#### `flyTo : List (Option { ... }) -> Cmd msg`

Changes any combination of center, zoom, bearing, and pitch, animating the transition along a curve that evokes flight. The animation seamlessly incorporates zooming and panning to help the user maintain her bearings even after traversing a great distance.

Supported options:

- `center`
- `zoom`
- `bearing`
- `pitch`
- `around`
- `duration`
- `easing`
- `offset`
- `animate`
- `curve`
- `minZoom`
- `speed`
- `screenSpeed`
- `maxDuration`

#### `fitBounds : List (Option { ... }) -> ( LngLat, LngLat ) -> Cmd msg`

Pans and zooms the map to contain its visible area within the specified geographical bounds. This function will also reset the map's bearing to 0 if bearing is nonzero.

Supported options:

- `padding`
- `easing`
- `linear`
- `offset`
- `maxZoom`


#### `stop : Cmd msg`

Stops any animated transition underway.


## Other

#### `resize : Cmd msg`

Resizes the map according to the dimensions of its container element.

This command must be sent after the map's container is resized, or when the map is shown after being initially hidden with CSS.