Hello, I implemented Google Map in web using `Web...
# compose-web
j
Hello, I implemented Google Map in web using
WebElementView
. That is working fine. But problem is If i place any
Composable
about
WebElementView
it will not appear, it's only show
WebElementView
's view. I don't know how to fix, i tried various method but any of then not worked.
Copy code
WebElementView(
    factory = {
        val container = document.createElement("div") as HTMLElement
        container.setAttribute("style", "width:100%; height:100%; position:relative; overflow:hidden;")
        val div = document.createElement("div") as HTMLElement
        div.setAttribute("style", "width:100%; height:100%; overflow:visible;")
        val options = createMapOptions(
            lat = mapState.currentPosition.latitude,
            lng = mapState.currentPosition.longitude,
            zoom = mapState.zoom.toInt(),
            isEnable = isEnable
        )
        val googleMap = createGoogleMap(el = div, options = options)
        mapState.setGoogleMap(googleMap)
        container.appendChild(div)
        container
    }
)
c
You cannot put
Composables
above the
WebElementView
> The embedded HTML element overlays the canvas area based on the size defined in your Compose code. It intercepts input events within that area, preventing those events from being received by Compose Multiplatform. https://kotlinlang.org/docs/multiplatform/whats-new-compose-190.html#new-api-for-embedding-html-content
j
@Chrimaeon Is there any way or work around for this problem?
🚫 1
t
I implemented a map in compose from scratch. Not sure if you want to go this route but a very basic version is here: https://github.com/timo-drick/Compose-Multiplatform-Tile-Map Depending on your needs you have to implement everything yourself. Maybe if there is need we could develop a real MP library out of it.
There is another project what is able to show composables above a html video element. Not sure how it is done but you can look into the code: https://github.com/kdroidFilter/ComposeMediaPlayer
j
@Timo Drick: Good observation. I'll check and update here.