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

Added styles to the cluster are not applied #46

Open
Kainar9292 opened this issue Jan 13, 2023 · 8 comments
Open

Added styles to the cluster are not applied #46

Kainar9292 opened this issue Jan 13, 2023 · 8 comments
Assignees
Labels
advise or question Seeking for advise or question help wanted You can contribute with this with in any way possible waiting We need more info about it or we are waiting for something else

Comments

@Kainar9292
Copy link

Kainar9292 commented Jan 13, 2023

I want to change the cluster icon, but when I change the styles, the cluster icon stays default. Can you tell me what I'm doing wrong or is this a bug?

image

image

Using the render function also fails to render another icon. In this case, the cluster disappears altogether and even the standard icon is not displayed. I am attaching screenshots of my code:

image

image

Thanks in advance for your answer to my question

@NathanAP
Copy link
Owner

Hello! Sorry if I'm late.

It seems that icon is not really well documented on how to use them. We should try to make it work and then change the docs to be more clear on how to do it.

This example shows that you can add a custom icon to marker by adding an url to it. Did you try it?

The renderer part, when you look into the code, you see that it is a new DefaultRenderer that is imported from @googlemaps/markerclusterer (image below). I believe we could try to see if using it could help you to customize your own Cluster.

image

@NathanAP NathanAP self-assigned this Jan 16, 2023
@NathanAP NathanAP added help wanted You can contribute with this with in any way possible waiting We need more info about it or we are waiting for something else advise or question Seeking for advise or question labels Jan 16, 2023
@scrtechnologies
Copy link

scrtechnologies commented Jan 16, 2023

The code below should work in Nuxt 3

<script setup lang="ts">
const render = ({ count, position }) =>
    new google.maps.Marker({
        label: { text: String(count), color: 'white', fontSize: '10px' },
        position,
        // adjust zIndex to be above other markers
        zIndex: Number(google.maps.Marker.MAX_ZINDEX) + count,
    })
</script>

<GMapCluster :renderer="{ render }"></GMapCluster>

@Kainar9292
Copy link
Author

Hello! Sorry if I'm late.

It seems that icon is not really well documented on how to use them. We should try to make it work and then change the docs to be more clear on how to do it.

This example shows that you can add a custom icon to marker by adding an url to it. Did you try it?

The renderer part, when you look into the code, you see that it is a new DefaultRenderer that is imported from @googlemaps/markerclusterer (image below). I believe we could try to see if using it could help you to customize your own Cluster.

image

I tried to apply for the cluster as in the example for the marker icon, it did not help me, although it works on the marker icon

@Kainar9292
Copy link
Author

Kainar9292 commented Jan 16, 2023

The code below should work in Nuxt 3

<script setup lang="ts">
const render = ({ count, position }) =>
    new google.maps.Marker({
        label: { text: String(count), color: 'white', fontSize: '10px' },
        position,
        // adjust zIndex to be above other markers
        zIndex: Number(google.maps.Marker.MAX_ZINDEX) + count,
    })
</script>

<GMapCluster :renderer="{ render }"></GMapCluster>

It didn't work for me on vue 3. The cluster, like the markers, disappear

@Amaurgit
Copy link

Amaurgit commented Mar 8, 2023

Same here, can't manage to make the clusters work... Any idea ?

@alexandrapopa96
Copy link

alexandrapopa96 commented Mar 16, 2023

Hello,

I had the same issue with changing the icon for the cluster. For me, in vue3, this worked:

image

image

@Kainar9292
Copy link
Author

Kainar9292 commented Mar 28, 2023

this version works in my project:

image

image

@elvismercado
Copy link

I was also having this issue using a Vue3+Vite project.
The code by @alexandrapopa96 and @Kainar9292 worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
advise or question Seeking for advise or question help wanted You can contribute with this with in any way possible waiting We need more info about it or we are waiting for something else
Projects
None yet
Development

No branches or pull requests

6 participants