leaflet-polylinedecorator
Advanced tools
Comparing version 1.0.1 to 1.1.0
{ | ||
"name": "leaflet-polylinedecorator", | ||
"main": "leaflet.polylineDecorator.js", | ||
"version": "0.7.2", | ||
"version": "1.1.0", | ||
"authors": [ | ||
@@ -6,0 +6,0 @@ "Benjamin Becquet" |
@@ -7,14 +7,12 @@ | ||
layers: [ | ||
new L.TileLayer('http://otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png', { | ||
attribution: 'Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a> — Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors', | ||
maxZoom: 18, | ||
subdomains: '1234' | ||
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { | ||
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' | ||
}) | ||
] | ||
}); | ||
// --- Arrow, with animation to demonstrate the use of setPatterns --- | ||
var arrow = L.polyline([[57, -19], [60, -12]], {}).addTo(map); | ||
var arrowHead = L.polylineDecorator(arrow).addTo(map); | ||
var arrowOffset = 0; | ||
@@ -37,3 +35,3 @@ var anim = window.setInterval(function() { | ||
// --- Multi-pattern without Polyline --- | ||
// --- Multi-pattern without Polyline --- | ||
var pathPattern = L.polylineDecorator( | ||
@@ -49,3 +47,3 @@ [ [ 49.543519, -12.469833 ], [ 49.808981, -12.895285 ], [ 50.056511, -13.555761 ], [ 50.217431, -14.758789 ], [ 50.476537, -15.226512 ], [ 50.377111, -15.706069 ], [ 50.200275, -16.000263 ], [ 49.860606, -15.414253 ], [ 49.672607, -15.710152 ], [ 49.863344, -16.451037 ], [ 49.774564, -16.875042 ], [ 49.498612, -17.106036 ], [ 49.435619, -17.953064 ], [ 49.041792, -19.118781 ], [ 48.548541, -20.496888 ], [ 47.930749, -22.391501 ], [ 47.547723, -23.781959 ], [ 47.095761, -24.941630 ], [ 46.282478, -25.178463 ], [ 45.409508, -25.601434 ], [ 44.833574, -25.346101 ], [ 44.039720, -24.988345 ] ], | ||
// --- Markers proportionnaly located --- | ||
// --- Markers proportionnaly located --- | ||
var markerLine = L.polyline([[58.44773, -28.65234], [52.9354, -23.33496], [53.01478, -14.32617], [58.1707, -10.37109], [59.68993, -0.65918]], {}).addTo(map); | ||
@@ -58,3 +56,3 @@ var markerPatterns = L.polylineDecorator(markerLine, { | ||
// --- Example with a rotated marker --- | ||
// --- Example with a rotated marker --- | ||
var pathPattern = L.polylineDecorator( | ||
@@ -68,3 +66,3 @@ [ [ 42.9, -15 ], [ 44.18, -11.4 ], [ 45.77, -8.0 ], [ 47.61, -6.4 ], [ 49.41, -6.1 ], [ 51.01, -7.2 ] ], | ||
iconUrl: 'icon_plane.png', | ||
iconAnchor: [16, 16] | ||
iconAnchor: [16, 16] | ||
}) | ||
@@ -78,4 +76,4 @@ }})} | ||
var multiCoords1 = [ | ||
[[47.5468, -0.7910], [48.8068, -0.1318], [49.1242, 1.6699], [49.4966, 3.2958], [51.4266, 2.8564], [51.7542, 2.1093]], | ||
[[48.0193, -2.8125], [46.3165, -2.8564], [44.9336, -1.0107], [44.5278, 1.5820], [44.8714, 3.7353], [45.8287, 5.1855], [48.1953, 5.1416]], | ||
[[47.5468, -0.7910], [48.8068, -0.1318], [49.1242, 1.6699], [49.4966, 3.2958], [51.4266, 2.8564], [51.7542, 2.1093]], | ||
[[48.0193, -2.8125], [46.3165, -2.8564], [44.9336, -1.0107], [44.5278, 1.5820], [44.8714, 3.7353], [45.8287, 5.1855], [48.1953, 5.1416]], | ||
[[45.9205, 0.4394], [46.7699, 0.9228], [47.6061, 2.5488], [47.7540, 3.3837]] | ||
@@ -93,2 +91,1 @@ ]; | ||
} | ||
@@ -170,3 +170,3 @@ | ||
L.PolylineDecorator = L.LayerGroup.extend({ | ||
L.PolylineDecorator = L.FeatureGroup.extend({ | ||
options: { | ||
@@ -177,3 +177,3 @@ patterns: [] | ||
initialize: function(paths, options) { | ||
L.LayerGroup.prototype.initialize.call(this); | ||
L.FeatureGroup.prototype.initialize.call(this); | ||
L.Util.setOptions(this, options); | ||
@@ -450,5 +450,15 @@ this._map = null; | ||
this._icon.style[L.RotatedMarker.TRANSFORM_ORIGIN] = '50% 50%'; | ||
this._icon.style[L.RotatedMarker.TRANSFORM_ORIGIN] = this._getTransformOrigin(); | ||
}, | ||
_getTransformOrigin: function() { | ||
var iconAnchor = this.options.icon.options.iconAnchor; | ||
if (!iconAnchor) { | ||
return '50% 50%'; | ||
} | ||
return iconAnchor[0] + 'px ' + iconAnchor[1] + 'px'; | ||
}, | ||
_setPos: function (pos) { | ||
@@ -455,0 +465,0 @@ L.Marker.prototype._setPos.call(this, pos); |
{ | ||
"name": "leaflet-polylinedecorator", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"repository": "bbecquet/Leaflet.PolylineDecorator", | ||
@@ -5,0 +5,0 @@ "main": "leaflet.polylineDecorator.js", |
@@ -11,2 +11,12 @@ # Leaflet PolylineDecorator | ||
## npm / bower | ||
``` | ||
npm install leaflet-polylinedecorator | ||
``` | ||
``` | ||
bower install leaflet-polylinedecorator | ||
``` | ||
## Features | ||
@@ -13,0 +23,0 @@ |
L.PolylineDecorator = L.LayerGroup.extend({ | ||
L.PolylineDecorator = L.FeatureGroup.extend({ | ||
options: { | ||
@@ -8,3 +8,3 @@ patterns: [] | ||
initialize: function(paths, options) { | ||
L.LayerGroup.prototype.initialize.call(this); | ||
L.FeatureGroup.prototype.initialize.call(this); | ||
L.Util.setOptions(this, options); | ||
@@ -11,0 +11,0 @@ this._map = null; |
@@ -14,5 +14,15 @@ L.RotatedMarker = L.Marker.extend({ | ||
this._icon.style[L.RotatedMarker.TRANSFORM_ORIGIN] = '50% 50%'; | ||
this._icon.style[L.RotatedMarker.TRANSFORM_ORIGIN] = this._getTransformOrigin(); | ||
}, | ||
_getTransformOrigin: function() { | ||
var iconAnchor = this.options.icon.options.iconAnchor; | ||
if (!iconAnchor) { | ||
return '50% 50%'; | ||
} | ||
return iconAnchor[0] + 'px ' + iconAnchor[1] + 'px'; | ||
}, | ||
_setPos: function (pos) { | ||
@@ -19,0 +29,0 @@ L.Marker.prototype._setPos.call(this, pos); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
442636
1200
80