diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f11b75 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ diff --git a/README.md b/README.md index aad5a83..4658ecc 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,9 @@ Plugin for Leaflet to display markers along a route at equivalent distances. ```javascript // use defaults -var line = L.polyline(coords); +var line = L.polyline(coords, { + distanceMarkers: true +}); // override defaults var line = L.polyline(coords, { @@ -26,7 +28,7 @@ map.addLayer(line); ``` ## Options - + * **offset**: distance in meters between the markers (default: 1000 (= 1 km)) * **showAll**: the zoom level at which all distance markers will be shown -- zooming out once from this level will remove approximately half of the markers (default: 12) * **lazy**: postpone adding the markers until Polyline.addDistanceMarkers is explicitly called (default: false) diff --git a/leaflet-distance-marker.js b/leaflet-distance-marker.js index 33f21c2..59ead1b 100644 --- a/leaflet-distance-marker.js +++ b/leaflet-distance-marker.js @@ -130,7 +130,7 @@ L.Polyline.include({ this._originalOnAdd(map); var opts = this.options.distanceMarkers || {}; - if (this._distanceMarkers === undefined) { + if (this._distanceMarkers === undefined && this.options.distanceMarkers) { this._distanceMarkers = new L.DistanceMarkers(this, map, opts); } if (opts.lazy === undefined || opts.lazy === false) { diff --git a/package.json b/package.json new file mode 100644 index 0000000..97ce2c3 --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "leaflet-distance-markers", + "version": "0.1.0", + "description": "Leaflet plugin to display markers along a route at equivalent distances.", + "main": "leaflet-distance-marker.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/adoroszlai/leaflet-distance-markers" + }, + "keywords": [ + "leaflet", + "plugin", + "distance", + "markers" + ], + "author": "", + "license": "MIT", + "bugs": { + "url": "https://github.com/adoroszlai/leaflet-distance-markers/issues" + }, + "homepage": "https://github.com/adoroszlai/leaflet-distance-markers#readme" +}