Locator
The Locator instance provides methods for displaying and positioning the locator icon. An instance is created via the UnitMap.locator() method.
An image of the locator icon.
This icon is used to highlight a single position on the map, most likely that of a user's geolocation, but can have other use cases and is not directly coupled to geo positioning data.
map.on("ready", function() {
// Create a Locator instance via `map.locator()`, which can only be called once the map has loaded.
var locator = map.locator();
});Locator.translate([point])
Moves the locator icon to the given position if provided. Otherwise returns the current position value.
Arguments
| Argument | Required | Type | Default Value | Description |
|---|---|---|---|---|
| point | No | Array | undefined | An array representing an x and y coordinate pair of a position in map space. Example: [1, 5]. |
Returns
Either an [x, y] coordinates Array of the current position or the object chain.
Locator.show()
Display the locator icon. This method is chainable.
Locator.hide()
Hide the locator icon. This method is chainable.
