Skip to content

Conversation

mangecoeur
Copy link
Contributor

  • Currently, if options are changed on the GeomanDrawControl after creation, the toolbar doesn't update. This PR adds event listeners to the model attributes to remove & re-add the draw toolbar on options change so they are reflected in the UI.
  • This PR also adds the snapping option to Layers, to control which layers are used by the snapping function of Geoman.
  • The version of Geoman is bumped to the latest version.

@mangecoeur mangecoeur mentioned this pull request Apr 30, 2025
mangecoeur added 2 commits May 5, 2025 09:18
…to .data attr for editing. Also made circlemarker style use the draw control configured style if the feature doesn't have its own style overrides.
…to .data attr for editing. Also made circlemarker style use the draw control configured style if the feature doesn't have its own style overrides.
@martinRenou martinRenou force-pushed the fix_geoman_controls_option_update branch from 6e9251b to 361c8ec Compare June 3, 2025 12:18
Copy link
Contributor

@arjxn-py arjxn-py left a comment

Choose a reason for hiding this comment

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

Thanks a lot @mangecoeur
Just a couple of minor suggestions.

options = model.get('marker')?.markerStyle;
}
return new L.Marker(latlng, options);
case 'circle':
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
case 'circle':
case 'circle':
if (!options) {
options = model.get('circle')?.pathOptions;
}

When i was testing it, I got options undefined everytime, so let's add a check like other cases?

Comment on lines +551 to +556
this.setControlOptions();

this.map_view.obj.pm.removeControls();
if (!this.model.get('hide_controls')) {
this.map_view.obj.pm.addControls(this.controlOptions);
}
Copy link
Contributor

@arjxn-py arjxn-py Jun 4, 2025

Choose a reason for hiding this comment

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

This part of code is also being repeated in setPosition() below, maybe you want to take it out in a separate method or if you have any better idea?

@arjxn-py
Copy link
Contributor

arjxn-py commented Jun 4, 2025

By the way, if you happen to have a short clip or demo showing the improvements, that would be awesome to add here too. Thanks again!

@mangecoeur
Copy link
Contributor Author

Added some examples in the GeomanDrawControls.ipnb notebook, that just shows that you can change the control settings and the toolbar updates.

Below is a short clip showing the snapping that ignores all but the chosen layer.

Geoman.Snap.Demo.mp4

@arjxn-py
Copy link
Contributor

arjxn-py commented Jun 9, 2025

Thanks @mangecoeur, this is awesome!!!

Copy link
Member

@martinRenou martinRenou left a comment

Choose a reason for hiding this comment

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

Thanks!

@martinRenou martinRenou merged commit 3970364 into jupyter-widgets:master Jun 10, 2025
4 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.

3 participants