[go: nahoru, domu]

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

Add intial state param for map markers in order to support having info window content opened by default #352

Open
vladcioricagoogle opened this issue Jul 27, 2023 · 8 comments
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@vladcioricagoogle
Copy link

For now map markers are not supporting to have the info window content opened by default. You are only able to press on the marker and then see it. Markers should support to let the clients decide if the info window content is opened or closed when rendering the UI.

@vladcioricagoogle vladcioricagoogle added triage me I really want to be triaged. type: question Request for information or clarification. Not an issue. labels Jul 27, 2023
@wangela wangela added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: question Request for information or clarification. Not an issue. labels Jul 28, 2023
@kikoso
Copy link
Collaborator
kikoso commented Aug 10, 2023

Hi @vladcioricagoogle .

We have the following public methods in Marker.kt, would this suit your needs?

public fun hideInfoWindow() {
        marker?.hideInfoWindow()
}

and

 public fun showInfoWindow() {
        marker?.showInfoWindow()
}

@vladcioricagoogle
Copy link
Author
vladcioricagoogle commented Aug 10, 2023

Hi @kikoso ,

How could these be used to have the marker info window opened by default? The marker composable is not supporting anything related with initial state and also I don't see any place where showInfoWindow() method can be called by default. Do you have any other thoughts?

@kikoso kikoso added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed triage me I really want to be triaged. labels Aug 15, 2023
@kikoso
Copy link
Collaborator
kikoso commented Aug 15, 2023

What about using a LaunchedEffect? They can be used to run a block just once. You could use something like this:

LaunchedEffect(Unit){
    markerState.hideInfoWindow()
 }

@vladcioricagoogle
Copy link
Author

I don't see how would this work. Also how would be the markerState passed, you have access to it only in the onClick methods from the MarkerInfoWindow.

@bubenheimer
Copy link
Contributor
bubenheimer commented Jan 15, 2024

@vladcioricagoogle I think @kikoso meant:

LaunchedEffect(Unit) {
    markerState.showInfoWindow()
}

Accessing MarkerState:

val markerState = rememberMarkerState()
Marker(state = markerState)

@bubenheimer
Copy link
Contributor

@vladcioricagoogle Also be aware that you can only have a single open marker info window at a time due to GoogleMap limitations.

@kikoso
Copy link
Collaborator
kikoso commented Jan 17, 2024

Hi @vladcioricagoogle ,

If you haven't solved this yet, you can add to the BasicMapActivity the following block in the line 150:

LaunchedEffect(Unit) {
        singapore3State.showInfoWindow()
}

This will open by default the info window from one of the markers.

And as @bubenheimer pointed out, only one info window can be open at a single time.

@vladcioricagoogle
Copy link
Author

Thanks for suggestions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

4 participants