LocationSelection
A collection of zero or more Location instances, returned by the locations() method on a Trip.
map.nav().directions(waypoints, function (error, trip) {
// Make every location of the trip draggable:
trip.locations().draggable(true).cursor("grab");
});LocationSelection.length
The number of Location instances in the collection.
LocationSelection.first()
Get the first Location in the collection.
Returns
A new LocationSelection instance.
LocationSelection.last()
Get the last Location in the collection.
Returns
A new LocationSelection instance.
LocationSelection.find(id)
Get all Location instances in the collection which match the given id or ids.
Arguments
| Argument | Required | Type | Default Value | Description |
|---|---|---|---|---|
| id | Yes | String | Array | undefined | A single id or an array of ids to look for. |
Returns
A new LocationSelection instance.
LocationSelection.at(index)
Get the location at the given index.
Arguments
| Argument | Required | Type | Default Value | Description |
|---|---|---|---|---|
| index | Yes | Integer | undefined | The index of the desired location. |
Returns
A new LocationSelection instance.
LocationSelection.each(iterator)
Iterate over each Location in the collection. This method is chainable.
Arguments
| Argument | Required | Type | Default Value | Description |
|---|---|---|---|---|
| iterator | Yes | Function | undefined | A function invoked with each Location and its index. |
Returns
The object chain.
LocationSelection.map(iterator)
Map over each Location in the collection, returning an array of the iterator results.
Arguments
| Argument | Required | Type | Default Value | Description |
|---|---|---|---|---|
| iterator | Yes | Function | undefined | A function invoked with each Location in the collection. |
Returns
An Array of the iterator return values.
LocationSelection.draggable([value])
Enable or disable dragging for every Location in the collection. This method is chainable.
Arguments
| Argument | Required | Type | Default Value | Description |
|---|---|---|---|---|
| value | Yes | Boolean | undefined | Whether the Location instances may be dragged. |
Returns
The object chain.
LocationSelection.cursor(value)
Set the CSS cursor used when hovering each Location in the collection. This method is chainable.
trip.locations().draggable(true).cursor("grab");Arguments
| Argument | Required | Type | Default Value | Description |
|---|---|---|---|---|
| value | Yes | String | undefined | A valid CSS cursor value — e.g. grab or pointer. |
Returns
The object chain.
Updated 2 days ago
