Skip to content

Commit

Permalink
Use distanceMarkers:true for default setup (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGreatRefrigerator authored and adoroszlai committed Nov 11, 2019
1 parent cbc908e commit 5fce42f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion leaflet-distance-marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit 5fce42f

Please sign in to comment.