Closed cma-42 closed 3 months ago
I wonder whether you could declare an arrow function, e.g. render: (count, position) => { ... };
Alternatively, a blind idea: perhaps you can run the following code when the GoogleMap component is added. Create a js file in frontend/ and use @JsModule
to import it:
window.my_google_map_renderer = { render: function().... }
then setClusteringRenderer("window.my_google_map_renderer")
.
@mvysny Thank you for your suggestions. I could have sworn that I tried both of these things but the additional JS module withwindow.my_google_map_renderer = { render: function().... }
did the trick for me and is working as expected 👍
Apologies for creating this ticket, I had never realized that there were multiple tabs in the demo and one of them covers my question 🤦 https://addonsv24.flowingcode.com/googlemaps/clustering-custom-renderer
I tried a couple of approaches to use
setClusteringRenderer
in order to customize the marker clusters.For example, in MyGoogleMap.java:
However, I could never get it to work. In the example above, the issue is the strict mode, resulting in this error:
I also tried defining the custom renderer function in a .js file but the function wasn't available within the scope of the map.
Would it be possible to add a small example for the usage of this method to the readme file?
Alternatively, is it possible to inject custom CSS into the component like it would be for a Vaadin component, using e.g.
@CssImport(value = "./src/mygooglemap.css", themeFor = "google-map")
? That doesn't seem to work for me either.Thank you in advance for you support!