Repository navigation
Show the current geometry when clicking a drawn shape - #2374
KhadeerBasha1232 wants to merge 1 commit into
Conversation
With show_geometry_on_click, the alert used a GeoJSON string captured when the shape was drawn, so a shape changed with the edit toolbar kept showing its original coordinates. Read the geometry inside the click handler instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Can you just stop? Do you think that you're going to flood a project with your LLM generated PRs and maintainers will now spend a week reviewing those? Have some decency... |
I don't think "have some decency" is a fair way to talk to a contributor. Every PR I've opened targets a real bug or a real gap, has tests, and passes CI. Two have already been merged, including the fix that got pre-commit.ci working again on main. To be clear: I don't expect everything to get merged. Close whatever you don't want. That's your call as a maintainer, and I'll respect it. But judge the PRs on their content, not on what tools I used to write them. If there's a specific problem with a specific change, point it out and I'll fix it. If you'd rather I keep fewer open at once, just say how many. |
|
I'm judging based on the fact that you're flooding the backlog and depleting maintainers capacity. I would complain about that if you were writing all that by hand, as I have done before. |
Understood. I'll stop opening new PRs and leave the existing ones for you to review whenever you have time. And thanks for clarifying the by-hand point. Good to know this is about volume, not about how the code was written. |
Show the current geometry when clicking a drawn shape
The problem
With
Draw(show_geometry_on_click=True), which is the default, clicking a drawn shape alerts its GeoJSON. If the shape is changed with the edit toolbar first, the alert still shows the coordinates it had when it was drawn.To reproduce:
The export button isn't affected, because it calls
toGeoJSON()when clicked. Only the click alert is out of date.The cause
The GeoJSON is turned into a string once, inside the
draw:createdhandler, and the click handler reuses that string:The fix
Call
layer.toGeoJSON()inside the click handler. Thevar coordsline is left as it is, in case a user'son={...}handler, which is inlined into the same function, refers to it.Before / after
The steps above in Chrome. To get the alert text into the screenshot,
window.alertis replaced with a box at the bottom of the page. The rectangle was resized from about 7.5°E / 44.2°N to about 15.4°E / 40.0°N before clicking.Tests
Two new tests in
tests/plugins/test_draw.py:test_draw_click_shows_current_geometrychecks that the click handler callstoGeoJSON()itself. It fails onmain.test_draw_no_click_alertchecks thatshow_geometry_on_click=Falsestill renders no alert.