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

Marker clusters icons are not visible #1046

Closed
RoboVij opened this issue Jan 26, 2022 · 1 comment
Closed

Marker clusters icons are not visible #1046

RoboVij opened this issue Jan 26, 2022 · 1 comment

Comments

@RoboVij
Copy link

RoboVij commented Jan 26, 2022

We're creating a wrapper component for leaflet and some other plugins included in it using stencil.js.

Normal marker icons after zooming are working fine. But the cluster icons (the colored circles) are not visible. The numbers, of the clusters, are visible though. In other projects everything's working fine. But in this stencil project, it's not. Following are my imports:

import * as Leaflet from 'leaflet';
//import 'leaflet/dist/leaflet.css';
import 'leaflet.markercluster';
import 'leaflet.markercluster/dist/MarkerCluster.css';
import "leaflet.markercluster/dist/MarkerCluster.Default.css";
//import 'leaflet.markercluster/dist/leaflet.markercluster';

I tried to to use the custom cluster icons, but that's not working too.

var mcg = Leaflet.markerClusterGroup({
  chunkedLoading: true,
  spiderfyOnMaxZoom: true,
  iconCreateFunction: function(cluster) {
    var count = cluster.getChildCount();
    var digits = (count + '').length;
    return new Leaflet.DivIcon({
      html: '<div><span>' + count + '</span></div>',
      className: 'cluster digits-' + digits,
      iconSize: null
    });
  },
});

In this setup, I commented MarkerCluster.Default.css import and imported the new css file.
What could be the problem? Any suggestions?

Screenshot 2022-01-26 180125

@RoboVij
Copy link
Author

RoboVij commented Feb 3, 2022

The problem was that I was importing the css files in the .tsx file. It need to be imported in the global styling .css file or the .css file of the respective component. It's stencil.js specific, I guess.

@RoboVij RoboVij closed this as completed Feb 3, 2022
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

No branches or pull requests

1 participant