Skip to content

Commit

Permalink
Update after review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hansthen committed Oct 17, 2024
1 parent 888acf2 commit f7f849b
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions folium/plugins/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,18 @@ class Draw(JSCSSMixin, MacroElement):
var {{ this.get_name() }} = new L.Control.Draw(
options
).addTo( {{this._parent.get_name()}} );
{{ this._parent.get_name() }}.on(
L.Draw.Event.CREATED,
function(e) {
var layer = e.layer,
type = e.layerType;
var coords = JSON.stringify(layer.toGeoJSON());
{%- if this.show_geometry_on_click %}
layer.on('click', function() {
alert(coords);
console.log(coords);
});
{%- endif %}
drawnItems_{{ this.get_name() }}.addLayer(layer);
}
);
{{ this._parent.get_name() }}.on(L.Draw.Event.CREATED, function(e) {
var layer = e.layer,
type = e.layerType;
var coords = JSON.stringify(layer.toGeoJSON());
{%- if this.show_geometry_on_click %}
layer.on('click', function() {
alert(coords);
console.log(coords);
});
{%- endif %}
drawnItems_{{ this.get_name() }}.addLayer(layer);
});
{{ this._parent.get_name() }}.on('draw:created', function(e) {
drawnItems_{{ this.get_name() }}.addLayer(e.layer);
});
Expand Down

0 comments on commit f7f849b

Please sign in to comment.