Skip to content

Commit c32a772

Browse files
committed
Update docs.
1 parent 2b6fe1b commit c32a772

File tree

1 file changed

+43
-23
lines changed

1 file changed

+43
-23
lines changed

API.md

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,39 @@
1-
# MapboxDirections
1+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
2+
3+
### Table of Contents
4+
5+
- [MapboxDirections](#mapboxdirections)
6+
- [onRemove](#onremove)
7+
- [interactive](#interactive)
8+
- [getOrigin](#getorigin)
9+
- [setOrigin](#setorigin)
10+
- [getDestination](#getdestination)
11+
- [setDestination](#setdestination)
12+
- [reverse](#reverse)
13+
- [addWaypoint](#addwaypoint)
14+
- [setWaypoint](#setwaypoint)
15+
- [removeWaypoint](#removewaypoint)
16+
- [getWaypoints](#getwaypoints)
17+
- [removeRoutes](#removeroutes)
18+
- [on](#on)
19+
20+
## MapboxDirections
221

322
The Directions control
423

524
**Parameters**
625

726
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
8-
- `options.styles` **\[[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)]** Override default layer properties of the [directions source](https://github.com/mapbox/mapbox-gl-directions/blob/master/src/directions_style.js). Documentation for each property are specified in the [Mapbox GL Style Reference](https://www.mapbox.com/mapbox-gl-style-spec/).
9-
- `options.accessToken` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Required unless `mapboxgl.accessToken` is set globally (optional, default `null`)
10-
- `options.interactive` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** Enable/Disable mouse or touch interactivity from the plugin (optional, default `true`)
11-
- `options.profile` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Routing profile to use. Options: `driving-traffic`, `driving`, `walking`, `cycling` (optional, default `"driving-traffic"`)
12-
- `options.unit` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Measurement system to be used in navigation instructions. Options: `imperial`, `metric` (optional, default `"imperial"`)
13-
- `options.geocoder` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** Pass options available to mapbox-gl-geocoder as [documented here](https://github.com/mapbox/mapbox-gl-geocoder/blob/master/API.md#mapboxglgeocoder).
14-
- `options.controls` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]**
15-
- `options.controls.inputs` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** Hide or display the inputs control. (optional, default `true`)
16-
- `options.controls.instructions` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** Hide or display the instructions control. (optional, default `true`)
27+
- `options.styles` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Override default layer properties of the [directions source](https://github.com/mapbox/mapbox-gl-directions/blob/master/src/directions_style.js). Documentation for each property are specified in the [Mapbox GL Style Reference](https://www.mapbox.com/mapbox-gl-style-spec/).
28+
- `options.accessToken` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Required unless `mapboxgl.accessToken` is set globally (optional, default `null`)
29+
- `options.interactive` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Enable/Disable mouse or touch interactivity from the plugin (optional, default `true`)
30+
- `options.profile` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Routing profile to use. Options: `driving-traffic`, `driving`, `walking`, `cycling` (optional, default `"driving-traffic"`)
31+
- `options.alternatives` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether to enable alternatives. (optional, default `true`)
32+
- `options.unit` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Measurement system to be used in navigation instructions. Options: `imperial`, `metric` (optional, default `"imperial"`)
33+
- `options.geocoder` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Pass options available to mapbox-gl-geocoder as [documented here](https://github.com/mapbox/mapbox-gl-geocoder/blob/master/API.md#mapboxglgeocoder).
34+
- `options.controls` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?**
35+
- `options.controls.inputs` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Hide or display the inputs control. (optional, default `true`)
36+
- `options.controls.instructions` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Hide or display the instructions control. (optional, default `true`)
1737

1838
**Examples**
1939

@@ -30,7 +50,7 @@ map.addControl(directions);
3050

3151
Returns **[MapboxDirections](#mapboxdirections)** `this`
3252

33-
## onRemove
53+
### onRemove
3454

3555
Removes the control from the map it has been added to. This is called by `map.removeControl`,
3656
which is the recommended method to remove controls.
@@ -41,7 +61,7 @@ which is the recommended method to remove controls.
4161

4262
Returns **Control** `this`
4363

44-
## interactive
64+
### interactive
4565

4666
Turn on or off interactivity
4767

@@ -51,13 +71,13 @@ Turn on or off interactivity
5171

5272
Returns **[MapboxDirections](#mapboxdirections)** this
5373

54-
## getOrigin
74+
### getOrigin
5575

5676
Returns the origin of the current route.
5777

5878
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** origin
5979

60-
## setOrigin
80+
### setOrigin
6181

6282
Sets origin. _Note:_ calling this method requires the [map load event](https://www.mapbox.com/mapbox-gl-js/api/#Map.load)
6383
to have run.
@@ -68,13 +88,13 @@ to have run.
6888

6989
Returns **[MapboxDirections](#mapboxdirections)** this
7090

71-
## getDestination
91+
### getDestination
7292

7393
Returns the destination of the current route.
7494

7595
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** destination
7696

77-
## setDestination
97+
### setDestination
7898

7999
Sets destination. _Note:_ calling this method requires the [map load event](https://www.mapbox.com/mapbox-gl-js/api/#Map.load)
80100
to have run.
@@ -85,13 +105,13 @@ to have run.
85105

86106
Returns **[MapboxDirections](#mapboxdirections)** this
87107

88-
## reverse
108+
### reverse
89109

90110
Swap the origin and destination.
91111

92112
Returns **[MapboxDirections](#mapboxdirections)** this
93113

94-
## addWaypoint
114+
### addWaypoint
95115

96116
Add a waypoint to the route. _Note:_ calling this method requires the
97117
[map load event](https://www.mapbox.com/mapbox-gl-js/api/#Map.load) to have run.
@@ -103,7 +123,7 @@ Add a waypoint to the route. _Note:_ calling this method requires the
103123

104124
Returns **[MapboxDirections](#mapboxdirections)** this;
105125

106-
## setWaypoint
126+
### setWaypoint
107127

108128
Change the waypoint at a given index in the route. _Note:_ calling this
109129
method requires the [map load event](https://www.mapbox.com/mapbox-gl-js/api/#Map.load)
@@ -116,7 +136,7 @@ to have run.
116136

117137
Returns **[MapboxDirections](#mapboxdirections)** this;
118138

119-
## removeWaypoint
139+
### removeWaypoint
120140

121141
Remove a waypoint from the route.
122142

@@ -126,19 +146,19 @@ Remove a waypoint from the route.
126146

127147
Returns **[MapboxDirections](#mapboxdirections)** this;
128148

129-
## getWaypoints
149+
### getWaypoints
130150

131151
Fetch all current waypoints in a route.
132152

133153
Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** waypoints
134154

135-
## removeRoutes
155+
### removeRoutes
136156

137157
Removes all routes and waypoints from the map.
138158

139159
Returns **[MapboxDirections](#mapboxdirections)** this;
140160

141-
## on
161+
### on
142162

143163
Subscribe to events that happen within the plugin.
144164

0 commit comments

Comments
 (0)