Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit radius of editable circle #201

Open
magnuswikhog opened this issue May 19, 2020 · 3 comments
Open

Limit radius of editable circle #201

magnuswikhog opened this issue May 19, 2020 · 3 comments

Comments

@magnuswikhog
Copy link

I can't find a way to limit the radius of an editable circle. For example, I want the smallest possible radius to be 1000 meters, and if the user tries to make it smaller the radius just stays at 1000 meters.

I looked at cancelable events in the API documentation, but I can't see any that would fit my use case.

@HIRANO-Satoshi
Copy link

Hi, set limit like this.

    mapEventHandler(evt: Leaflet.LeafletEvent) {
       if (evt.type === 'editable:vertex:dragend' || evt.type === 'editable:vertex:drag') {
           if (circle.getRadius() > 1000) 
                 circle.setRadius(1000);

@HIRANO-Satoshi
Copy link

Do you have a good way to limit the size of rectangles?

@iyuuya
Copy link

iyuuya commented Nov 1, 2023

Hi, set limit like this.

    mapEventHandler(evt: Leaflet.LeafletEvent) {
       if (evt.type === 'editable:vertex:dragend' || evt.type === 'editable:vertex:drag') {
           if (circle.getRadius() > 1000) 
                 circle.setRadius(1000);

Its good, but there was still a problem.
Marker no longer follows the circle.

2023-11-01.9.49.09.mov

#204 (comment)

The only workaround I have found so far is to call disableEdit() before and enableEdit() after changing bounds. This does not allow changing bounds in real time and only reliably works on dragend and editable:vertex:dragend events.

I tried this, but it difficult to operate.

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

No branches or pull requests

3 participants