1.1.1 • Published 2 years ago

@drustack/leaflet.resetview v1.1.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

Leaflet.ResetView

GitHub tag (latest SemVer) GitHub license npm jsDelivr hits (GitHub)

A reset view control for Leaflet.

Design for Drupal Leaflet Module integration.

Requirement

Demo

Usage

Provide a button for reset view into its original location:

<div id="map"></div>

<script>
    var map = L.map("map").setView([51.505, -0.09], 13);
    
    L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
        maxZoom: 19,
        attribution: "&copy; <a href='https://openstreetmap.org/copyright'>OpenStreetMap contributors</a>"
    }).addTo(map);
    
    L.control.resetView({
        position: "topleft",
        title: "Reset view",
        latlng: L.latLng([51.505, -0.09]),
        zoom: 13,
    }).addTo(map);
</script>

Include via CDN

Leaflet.ResetView is available through jsDelivr:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@drustack/leaflet.resetview/dist/L.Control.ResetView.min.css">
<script src="https://cdn.jsdelivr.net/npm/@drustack/leaflet.resetview/dist/L.Control.ResetView.min.js"></script>

Development

Install NPM depedencies:

npm install

Build CSS and JS individually:

npm run jshint
npm run uglifyjs
npm run sass

Or simply build everything once together:

npm run build

License

Author Information