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 visibility to MarkerCluster #1150

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gjmooney
Copy link
Contributor

@gjmooney gjmooney commented Dec 5, 2023

No description provided.

Copy link
Member

@martinRenou martinRenou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this approach, this feels a bit hacky.

Another approach could be to loop over all the markers and apply the same opacity on all of them.

'change:opacity',
function () {
if (this.model.get('visible')) {
document.querySelector('.test-icon').style.opacity =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would not work if you have multiple marker clusters on the map and want to hide one and not the other. Hiding one would hide the other and that's unfortunately not what you want.

Comment on lines +79 to +81
this.obj = L.markerClusterGroup({
disableClusteringAtZoom: options['disableClusteringAtZoom'],
maxClusterRadius: options['maxClusterRadius'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing options manually you can unroll all of them with the following

Suggested change
this.obj = L.markerClusterGroup({
disableClusteringAtZoom: options['disableClusteringAtZoom'],
maxClusterRadius: options['maxClusterRadius'],
this.obj = L.markerClusterGroup({
...options,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants