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

Wrong datatype for LMapOptions#zoomDelta #499

Closed
2 tasks done
mlannan opened this issue Feb 13, 2025 · 5 comments
Closed
2 tasks done

Wrong datatype for LMapOptions#zoomDelta #499

mlannan opened this issue Feb 13, 2025 · 5 comments
Assignees
Labels
question Information is requested

Comments

@mlannan
Copy link

mlannan commented Feb 13, 2025

Checklist

  • I made sure that there are no existing issues - open or closed - which I could contribute my information to.
  • I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise.

What is/are your question(s)?

What is the correct way to instantiate a new LMap and display it or add it to the MapContainer?
I have tried LMap map = new LMap(reg,"my-id"); but can't get this map to display.

Ultimately, I am trying to create a map where I can set the 'id'. Then via js, change properties of the LMap by retrieving the id etc...

Additional information

No response

@mlannan mlannan added the question Information is requested label Feb 13, 2025
@AB-xdev
Copy link
Member

AB-xdev commented Feb 13, 2025

What is the correct way to instantiate a new LMap and display it or add it to the MapContainer?

To quote from our usage section:

To get started it's recommended to have a look at the demo, notably the minimalistic example.

I have tried LMap map = new LMap(reg,"my-id"); but can't get this map to display.

Okay I need more info here otherwise I can't help.

The id inside the constructor is used for the component that will display the map. This is also documented in Leaflet.

@AB-xdev AB-xdev self-assigned this Feb 13, 2025
@mlannan
Copy link
Author

mlannan commented Feb 13, 2025

Thanks for the response. Let me try again.
I want to set the 'zoomDelta' for the LMap. Unfortunately, your implementation in LMapOptions.setZoomDelta takes an Integer as a parameter - unlike Leaflet's zoomDelta property which accepts double values. I want granularity smaller than 1.
My workaround was to try and access the map object directly via js and set the 'zoomDelta' property that way. However, I can't get the LMap id.

@AB-xdev
Copy link
Member

AB-xdev commented Feb 14, 2025

I want to set the 'zoomDelta' for the LMap.

Ok that's something completely different as was described in the issue.

LMapOptions.setZoomDelta takes an Integer as a parameter - unlike Leaflet's zoomDelta property which accepts double values

Okay so that has a wrong data type, we should fix that.

My workaround was to try and access the map object directly via js and set the 'zoomDelta' property that way. However, I can't get the LMap id.

You could run something like this:

map.invokeSelf(".options.zoomDelta = 0.2");

or extends from LMapOptions and override the datatype with e.g. a Double

@AB-xdev AB-xdev changed the title Instantiating LMap Wrong datatype for LMapOptions#zoomDelta Feb 14, 2025
@mlannan
Copy link
Author

mlannan commented Feb 19, 2025

Following up on this. Cool that you fixed it in the above commit, thanks. Is there a way to access the map element directly? The above line map.invokeSelf(".options.zoomDelta = 0.2"); does not work for me, in fact nothing with map.invokeSelf seems to. What am I missing? Thanks.

@AB-xdev
Copy link
Member

AB-xdev commented Feb 20, 2025

So I had a quick look into this:

The values are written to options as expected however leaflet is not updating the map automatically as the options seem to be only used during Map initialization.

This is a leaflet specific problem and not related to the component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Information is requested
Projects
None yet
Development

No branches or pull requests

2 participants