1.0.0 • Published 6 months ago
leaflet-control-resetview v1.0.0
Leaflet Control ResetView
A simple Leaflet control that allows you to reset the map view to a predefined position and zoom level.
Installation
# Using npm
npm install leaflet-control-resetview
# Using yarn
yarn add leaflet-control-resetview
Usage
import 'leaflet-control-resetview';
// or
require('leaflet-control-resetview');
// Create the control
const resetControl = L.control.resetView({
position: "topleft", // position on the map
title: "Reset view", // button title on hover
latlng: [51.505, -0.09], // the position to reset to
zoom: 13 // the zoom level to reset to
});
// Add it to the map
resetControl.addTo(map);
Options
position
(string): The position of the control (default: 'topleft')title
(string): The title text on hover (default: 'Reset view')latlng
(L.LatLng|Array): The position to reset to (required)zoom
(number): The zoom level to reset to (required)
License
MIT
Contributing
- Fork it
- Create your feature branch (
git checkout -b feature/my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin feature/my-new-feature
) - Create new Pull Request
1.0.0
6 months ago