Skip to content

Commit

Permalink
Update build and push version to 0.2.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtoye committed Feb 21, 2013
1 parent 6eb7b7e commit e1eabfa
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
35 changes: 31 additions & 4 deletions dist/leaflet.draw-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Leaflet.draw assumes that you have already included the Leaflet library.
*/

L.drawVersion = '0.2-dev';
L.drawVersion = '0.2.0';

L.Draw = {};

Expand Down Expand Up @@ -685,7 +685,27 @@ L.Draw.Marker = L.Draw.Feature.extend({

if (this._map) {
this._tooltip.updateContent({ text: 'Click map to place marker.' });
this._map.on('mousemove', this._onMouseMove, this);

// Same mouseMarker as in Draw.Polyline
if (!this._mouseMarker) {
this._mouseMarker = L.marker(this._map.getCenter(), {
icon: L.divIcon({
className: 'leaflet-mouse-marker',
iconAnchor: [20, 20],
iconSize: [40, 40]
}),
opacity: 0,
zIndexOffset: this.options.zIndexOffset
});
}

this._mouseMarker
.on('click', this._onClick, this)
.addTo(this._map);

this._map
.on('mousemove', this._onMouseMove, this)
.on('zoomend', this._onZoomEnd, this);
}
},

Expand All @@ -701,15 +721,22 @@ L.Draw.Marker = L.Draw.Feature.extend({
delete this._marker;
}

this._map.off('mousemove', this._onMouseMove);
this._mouseMarker.off('click', this._onClick);
this._map.removeLayer(this._mouseMarker);
delete this._mouseMarker;

this._map
.off('mousemove', this._onMouseMove)
.off('zoomend', this._onZoomEnd);
}
},

_onMouseMove: function (e) {
var latlng = e.latlng;

this._tooltip.updatePosition(latlng);

this._mouseMarker.setLatLng(latlng);

if (!this._marker) {
this._marker = new L.Marker(latlng, {
icon: this.options.icon,
Expand Down
Loading

0 comments on commit e1eabfa

Please sign in to comment.