Skip to content

Commit

Permalink
Merge pull request Leaflet#507 from wandergis/master
Browse files Browse the repository at this point in the history
fixed bug when use with layercontrol
  • Loading branch information
ddproxy committed May 20, 2016
2 parents 3e1e215 + 6e8af49 commit 096d404
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions examples/full.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,14 @@
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});
map = new L.Map('map', {layers: [osm], center: new L.LatLng(51.505, -0.04), zoom: 13}),
map = new L.Map('map', {center: new L.LatLng(51.505, -0.04), zoom: 13}),
drawnItems = L.featureGroup().addTo(map);

L.control.layers({
'osm':osm.addTo(map),
"google": L.tileLayer('http://www.google.cn/maps/vt?lyrs=s@189&gl=cn&x={x}&y={y}&z={z}', {
attribution: 'google'
})
}, {'drawlayer':drawnItems}, { position: 'topleft', collapsed: false }).addTo(map);
map.addControl(new L.Control.Draw({
edit: {
featureGroup: drawnItems,
Expand Down
2 changes: 1 addition & 1 deletion src/draw/handler/Draw.Polyline.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ L.Draw.Polyline = L.Draw.Feature.extend({
},

_updateGuide: function (newPos) {
var markerCount = this._markers.length;
var markerCount = this._markers ? this._markers.length : 0;

if (markerCount > 0) {
newPos = newPos || this._map.latLngToLayerPoint(this._currentLatLng);
Expand Down

0 comments on commit 096d404

Please sign in to comment.