From 80d49c701babce27e111054662091ea39e4b6da7 Mon Sep 17 00:00:00 2001 From: ghybs Date: Mon, 19 Dec 2016 11:06:39 +0400 Subject: [PATCH] README add shields, CDN with unpkg, links to Leaflet docs planning to publish plugin onto npm, therefore we can now use unpkg CDN instead of having to commit dist files (into gh-pages branch) and use RawGit CDN. Updated links to Leaflet docs version 1.0.2. --- README.md | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2dc4820..da9cfbd 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,10 @@ Plugin for Leaflet. Replaces missing Tiles (404 error) by scaled lower zoom Tile [Leaflet](http://leafletjs.com/) is the leading open-source JavaScript library for mobile-friendly interactive maps. -Latest TileLayer.Fallback release (for Leaflet 1.x): [`v1.0.1`](https://github.com/ghybs/Leaflet.TileLayer.Fallback/releases/tag/v1.0.1) +[![GitHub releases](https://img.shields.io/github/release/ghybs/leaflet.tilelayer.fallback.svg?label=GitHub)](https://github.com/ghybs/Leaflet.TileLayer.Fallback/releases) +[![npm](https://img.shields.io/npm/v/leaflet.tilelayer.fallback.svg)](https://www.npmjs.com/package/leaflet.tilelayer.fallback) + +Size: 2 kB minified, < 1 kB gzipped. @@ -44,20 +47,19 @@ Now missing tiles will be automatically replaced by scaled up tiles from lower z ### Installing the plugin #### Local copy -1. Download the "`leaflet.tilelayer.fallback.js`" file from [`v1.0.1` release](https://github.com/ghybs/Leaflet.TileLayer.Fallback/releases/tag/v1.0.1). +1. Download the "`leaflet.tilelayer.fallback.js`" file from the [`v1.0.2` release](https://github.com/ghybs/Leaflet.TileLayer.Fallback/releases/tag/v1.0.2). 2. Place the file alongside your page. 3. Add the `script` tag (see [Quick Guide > HTML](#quick-guide)) to your page after Leaflet script. #### CDN -You can alternatively use the free [RawGit](https://rawgit.com/) CDN service, but keep in mind that there are [no uptime or support guarantees](https://github.com/rgrove/rawgit/wiki/Frequently-Asked-Questions#i-need-guaranteed-100-uptime-should-i-use-cdnrawgitcom). +You can alternatively use the free [unpkg](https://unpkg.com) CDN service, but keep in mind that it "[_is a free, best-effort service and cannot provide any uptime or support guarantees_](https://unpkg.com/#/about)". ```html - + ``` - ### Creation Simply use the `L.tileLayer.fallback` factory instead of your regular `L.tileLayer`: @@ -76,16 +78,16 @@ myTileLayer.addTo(map); | Factory | Description | | :------ | :---------- | -| **L.tileLayer.fallback**( `` [urlTemplate](http://leafletjs.com/reference.html#url-template), [``](#options) options? ) | Instantiates a tile layer object given a [URL template](http://leafletjs.com/reference.html#url-template) and optionally an options object. When tile images return a 404 error, they are replaced by a scaled up tile from lower zoom. | +| **L.tileLayer.fallback**( `` [urlTemplate](http://leafletjs.com/reference-1.0.2.html#tilelayer-l-tilelayer), [``](#options) options? ) | Instantiates a tile layer object given a [URL template](http://leafletjs.com/reference-1.0.2.html#tilelayer-l-tilelayer) and optionally an options object. When tile images return a 404 error, they are replaced by a scaled up tile from lower zoom. | ### Options | Option | Type | Default | Description | | :----- | :--- | :------ | :---------- | -| **minNativeZoom** | `Number` | 0 | Minimum zoom number the tiles source has available. If tiles are missing down to that zoom level (included), they will be replaced by the standard Error Tile (specified by [`errorTileUrl`](http://leafletjs.com/reference.html#tilelayer-errortileurl)). | +| **minNativeZoom** | `Number` | 0 | Minimum zoom number the tiles source has available. If tiles are missing down to that zoom level (included), they will be replaced by the standard Error Tile (specified by [`errorTileUrl`](http://leafletjs.com/reference-1.0.2.html#tilelayer-errortileurl)). For zoom lower than `minNativeZoom`, [standard Tile Layer behaviour](http://leafletjs.com/reference-1.0.2.html#tilelayer-minnativezoom) applies, i.e. tiles are loaded from `minNativeZoom` and scaled down. | -All other [TileLayer options](http://leafletjs.com/reference.html#tilelayer-options) are applicable. +All other [TileLayer options](http://leafletjs.com/reference-1.0.2.html#tilelayer-option) are applicable. ### Events @@ -94,7 +96,7 @@ All other [TileLayer options](http://leafletjs.com/reference.html#tilelayer-opti | :---- | :--- | :---------- | | **tilefallback** | [`TileFallbackEvent`](#tilefallbackevent) | Fired when a tile is being replaced by a scaled up tile of lower zoom. | -All other [TileLayer events](http://leafletjs.com/reference.html#tilelayer-loading) are applicable. +All other [TileLayer events](http://leafletjs.com/reference-1.0.2.html#tilelayer-crossorigin) are applicable. #### TileFallbackEvent @@ -109,7 +111,7 @@ All other [TileLayer events](http://leafletjs.com/reference.html#tilelayer-loadi ### Methods -All regular [TileLayer methods](http://leafletjs.com/reference.html#tilelayer-addto) are applicable. +All regular [TileLayer methods](http://leafletjs.com/reference-1.0.2.html#tilelayer-method) are applicable. @@ -127,5 +129,6 @@ the more missing zoom levels, the more time it takes to replace a tile. ## License +[![license](https://img.shields.io/github/license/ghybs/leaflet.tilelayer.fallback.svg)](LICENSE) Leaflet.TileLayer.Fallback is distributed under the [Apache 2.0 License](http://choosealicense.com/licenses/apache-2.0/).