Skip to content

Conversation

@hansthen
Copy link
Collaborator

@hansthen hansthen commented Oct 5, 2024

This can be used to pass existing layer objects into the Draw plugin, which the user can then edit.

This can be used to pass existing layer objects into
the Draw plugin, which the user can then edit.
@hansthen hansthen requested a review from Conengmo October 6, 2024 08:59
Copy link
Member

@Conengmo Conengmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this change, seems really useful. I added one comment about a code block change that doesn't seem necessary.

I feel like this could benefit from an example in the user guide regarding how this option can be used. Not necessary to get this merged, but if you feel like it: https://python-visualization.github.io/folium/latest/user_guide/plugins/draw.html

Comment on lines 61 to 85
{{ 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);
}
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't mix styling changes with functional changes. Seems this code didn't change functionally, so don't include it in this PR then please.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted.

@hansthen
Copy link
Collaborator Author

Love this change, seems really useful. I added one comment about a code block change that doesn't seem necessary.

I feel like this could benefit from an example in the user guide regarding how this option can be used. Not necessary to get this merged, but if you feel like it: https://python-visualization.github.io/folium/latest/user_guide/plugins/draw.html

Will add the documentation when I have a bit more time.

@hansthen hansthen requested a review from Conengmo October 17, 2024 18:36
@hansthen hansthen merged commit 806f697 into python-visualization:main Oct 18, 2024
9 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants