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

ArgumentRequiredTypeDefault ValueDescription
idYesString | ArrayundefinedA 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

ArgumentRequiredTypeDefault ValueDescription
indexYesIntegerundefinedThe 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

ArgumentRequiredTypeDefault ValueDescription
iteratorYesFunctionundefinedA 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

ArgumentRequiredTypeDefault ValueDescription
iteratorYesFunctionundefinedA 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

ArgumentRequiredTypeDefault ValueDescription
valueYesBooleanundefinedWhether 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

ArgumentRequiredTypeDefault ValueDescription
valueYesStringundefinedA valid CSS cursor value — e.g. grab or pointer.

Returns

The object chain.