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

设置聚合cluster: true后,聚合数量为1也不会显示原来点标记样式 #2634

Closed
Siwuji opened this issue Nov 7, 2024 · 3 comments
Assignees

Comments

@Siwuji
Copy link

Siwuji commented Nov 7, 2024

问题描述

设置了cluster和clusterOption的maxZoom,point_min。但是依然在聚合数量为1的情况下,点标记显示的是聚合样式而非原本的点标记。有其他配置或者方法可以解决吗,MarkerLayer和PointLayer都尝试了,全都不行。

重现链接

No response

重现步骤

No response

预期行为

No response

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@Siwuji
Copy link
Author

Siwuji commented Nov 7, 2024

const markerLayer = new MarkerLayer({
  cluster: true,
  clusterOption: {
    radius: 40,
    minZoom: 0,
    maxZoom: 8,
    point_min: 2,
  },
});
for (let i = 0; i < pointData.features.length; i++) {
  const el = document.createElement("label");
  el.className = "labelclass";
  el.textContent = pointData.features[i].properties.name;
  el.style.background = "#fff";
  const marker = new Marker({
    element: el,
  }).setLnglat({
    lng: pointData.features[i].geometry.coordinates[0],
    lat: pointData.features[i].geometry.coordinates[1],
  });
  markerLayer.addMarker(marker);
}
scene.addMarkerLayer(markerLayer);

想聚合为1时显示原本Marker的element

@Siwuji
Copy link
Author

Siwuji commented Nov 7, 2024

https://gw.alipayobjects.com/mdn/rms_855bab/afts/img/A*2vBbRYT2bgIAAAAAAAAAAABkARQnAQ
官网Marker文档这个图片的效果就是我想要的,但是没有找到相关配置和示例

@Siwuji Siwuji closed this as completed Nov 7, 2024
@Siwuji
Copy link
Author

Siwuji commented Nov 7, 2024

找到了个解决办法,设置clusterOption的element,在没有cluster的时候这是点标记原本的dom样式

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

2 participants