googlemaps / android-maps-compose

Jetpack Compose composables for the Maps SDK for Android
https://developers.google.com/maps/documentation/android-sdk/maps-compose
Apache License 2.0
1.16k stars 139 forks source link

GeoJson breaks marker listener #530

Open alfroid2k opened 8 months ago

alfroid2k commented 8 months ago

Environment details

  1. Specify the API at the beginning of the title (for example, "Places: ...") Maps compose
  2. OS type and version Any version
  3. Library version and other environment information 4.3.3

Steps to reproduce

When loading a geoJson layer the click listeners for the MarkerComposable stops working

Code example

                    GoogleMap(
                        modifier = Modifier.fillMaxSize(),
                        cameraPositionState = cameraPositionState
                    ) {
                        val context = LocalContext.current
                        MarkerComposable(state = MarkerState(position = LatLng(1.35, 103.87)), onClick = {
                            Toast.makeText(context, "marker clicked!!", Toast.LENGTH_SHORT).show()
                            true
                        }) {
                            Box(modifier = Modifier
                                .size(32.dp)
                                .background(color = Color.Blue))
                        }
                        MapEffect(key1 = "12313", block = { map ->

                            val layer = GeoJsonLayer(map, R.raw.anyjson, context)

                            layer.setOnFeatureClickListener { feature ->
                                Toast.makeText(context, "Map layer feature clicked", Toast.LENGTH_SHORT)
                            }

                            layer.addLayerToMap()
                        })
                    }
wangela commented 8 months ago

If you would like to upvote the priority of this issue, please comment below or react on the original post above with :+1: so we can see what is popular when we triage.

@alfroid2k Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.