nuxt-modules / leaflet

A Nuxt module to use Leaflet
https://leaflet.nuxtjs.org/
Apache License 2.0
119 stars 3 forks source link

Disappearing Interactive components #73

Closed tobychidi closed 2 months ago

tobychidi commented 2 months ago

When I place my map within a modal, the interactive components disappear. I have tried using client-only and other tinkering and nothing works except setting the pane for LCircle to markerPane. Need help πŸ™πŸΎ

Without setting pane:

image

After setting pane to "markerPane or higher"

image

My Code:

<div class="relative isolate h-[250px] w-full">
        <u-skeleton v-if="!isLocationReady" class="h-full" />
        <LMap v-else ref="map" class="h-full" :zoom="10" :center="latLng" :use-global-leaflet="false">
            <LTileLayer
                url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
                layer-type="base"
                name="OpenStreetMap"
            />
            <LMarker :lat-lng="location" draggable />
            <LCircle :lat-lng="location" :radius />
        </LMap>
    </div>

Reproduction

On Stackblitz : Couldn't load the tile layer but if it loads the controls and paths hide behind it.

Gugustinette commented 2 months ago

The example you provided on StackBlitz seems to work fine for me, I do not understand what's wrong ?

Capture d’écran 2024-08-26 aΜ€ 09 17 08

tobychidi commented 2 months ago

The map tile didn't load on my stackblitz. How did you get it to load?

When the map loads in my project is when the circle disappears

tobychidi commented 2 months ago

image.png This is what I get from Stackblitz

Gugustinette commented 2 months ago

Well that's weird, it could be a network error, make sure to check you console for that. But it's all fine on my side 😭

tobychidi commented 2 months ago

image.png This seems to be the problem

Gugustinette commented 2 months ago

Weird origin network issue, but seems unrelated to the module then, can I close the issue ?

tobychidi commented 2 months ago

Not yet. This issue is different from the main issue. I'll create a repo instead.

Gugustinette commented 2 months ago

So what's the main issue ?

tobychidi commented 2 months ago

The interactive components disappear. The Stackblitz doesn't reproduce this issues because the map image doesn't load

Gugustinette commented 2 months ago

Well then yes I'll need a better reproduction

tobychidi commented 2 months ago

So, I have been testing. This issue doesn't have anything to do with modals. The zoom controls and a circle should be visible. image.png

Gugustinette commented 2 months ago

k but I'll need a reproduction 😭

tobychidi commented 2 months ago

https://s3.fr-par.scw.cloud/volta/20240826_1246_58_3427594_0f02b9f9cc.mp4 This also happens when I scroll. Watch the zoom controls flicker. I'm trying so hard to figure this out. πŸ˜…

tobychidi commented 2 months ago

I don't have this issue when I use leaflet directly. Unfortunately, I cannot reproduce this, I cannot share the full project either. But I am not doing anything extra. My project has multiple nested pages.


Gugustinette commented 2 months ago

Well I won't be able to help you out without decent reproduction, it could really be related to anything at this point. πŸ˜•

tobychidi commented 2 months ago

My guess is that it is related to stacking/z-index. For some reason, the map is covering the buttons

tobychidi commented 2 months ago

I used vue-leaflet directly and the issue persists. You can close this.

tobychidi commented 2 months ago

More comments on this issue.

Leaflet is now my preferred mapping library for most use cases because it is lightweight, simple and easy to use. With this module, you have done a phenomenal job especially with documentaion and support. Thank you.

I have tested this issue and found it be caused not by this module or Vue-leaflet but with the main leaflet library.

My current solution is to add my own control components on the map (which I actually prefer) like so: image

I also had to include :style={isolation: 'isolate} on LMap or else, even my custom buttons would disappear πŸ˜…

image

Leaflet V2 is on the way. I am hoping the update will make what's good even better. I will dropping an issue on the leaflet page as well.

Thanks.

Gugustinette commented 2 months ago

Thanks for the kind words !

Can't wait to see what's coming 😎