Skip to content

Commit

Permalink
Add MMapRouteControl in README (#43)
Browse files Browse the repository at this point in the history
<!--

Thank you for submitting a pull request!

Here's a checklist you might find useful.
[ ] There is an associated issue that is labelled
  'Bug' or 'help wanted' or is in the Community milestone
[ ] Code is up-to-date with the `main` branch
[ ] You've successfully run `npm test` locally
[ ] There are new or updated tests validating the change

-->

Fixes #
  • Loading branch information
matthew44-mappable authored Dec 11, 2024
1 parent 3f9d0d2 commit 4e842d6
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ See a [live-example](./controls/vanilla/index.html) with simple controls.

### Rich controls

More comprehensive controls include the following classes::
More comprehensive controls include the following classes:

- `MMapSearchControl` – adds a control to the map in the form of a search bar.
It also has built-in suggest hints when entering the name of a place or organization.
#### MMapSearchControl

`MMapSearchControl` – adds a control to the map in the form of a search bar.
It also has built-in suggest hints when entering the name of a place or organization.

`MMapSearchControl` has the following parameters:

Expand All @@ -55,7 +57,32 @@ More comprehensive controls include the following classes::

`MMapSearchControl` does not display markers on the map, it only returns coordinates and location parameters,
the developer is responsible for displaying them on the map.
There is a [live example](./search-control/vanilla/index.html) that demonstrates the possibilities of search control.

#### MMapRouteControl

`MMapRouteControl` – adds a control to the map in the form of a route panel.
There are also built-in suggest hint when entering the name of a place, panel control buttons
and the ability to specify a waypoint with a click on the map.

`MMapRouteControl` has the following parameters:

| Props name | Description |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| geolocationTextInput | Text that will be displayed in the input field when the user's geolocation is selected. |
| clearFieldsText | Text of the route reset button. |
| changeOrderText | The text of the route change order button. |
| availableTypes | Array of available route types in the routing panel (`driving`, `transit`, `truck`, `walking`). |
| truckParameters | A parameter object for a truck (only for `type=truck`). |
| waypoints | Array with coordinates of waypoints (`[LngLat, LngLat]`). |
| waypointsPlaceholders | Array with placeholders for waypoint inputs (`[string, string]`). |
| autofocus | Flag that the first waypoint input should be in focus when opening. |
| search | Function that overrides the search function. By default, `mappable.search` is used. |
| suggest | Function that overrides the suggest function. By default, `mappable.suggest` is used. |
| route | Function that overrides the route function. By default, `mappable.route` is used. |
| onMouseMoveOnMap | Callback that is called when the user selects a waypoint on the map. It can be used to display a marker under the user's cursor. |
| onUpdateWaypoints | Callback that is called when the user has changed the waypoints. |
| onRouteResult | Callback that receives a route between waypoints. |
| onBuildRouteError | Callback that is called if the route could not be set (route was not found or server error). |

## Markers and popups

Expand Down

0 comments on commit 4e842d6

Please sign in to comment.