ui: render lone surfaces as donut clusters of 1 for a unified map (v0.2.9)
Set minClusterSize:1 so a solitary surface is drawn with the same donut icon (showing "1", green when free / red when busy) instead of a small dot, and every click flows through the single cluster handler into our panel. A cluster of one keeps the rich single-surface hover tooltip. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
e83bb5ad49
commit
78d62ae36c
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "mapdash-frontend",
|
||||
"private": true,
|
||||
"version": "0.2.8",
|
||||
"version": "0.2.9",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@ -533,6 +533,10 @@ export function createMapView(els: MapElements, apiKey: string): MapView {
|
||||
objectManager = new ymaps.ObjectManager({
|
||||
clusterize: true,
|
||||
gridSize: 112,
|
||||
// Even a lone surface becomes a cluster of 1 (donut showing "1"), so all
|
||||
// map graphics share the donut style and every click flows through the
|
||||
// one cluster handler -> our panel.
|
||||
minClusterSize: 1,
|
||||
// No Yandex balloons — clicks open our own panel. Clusters must not zoom.
|
||||
clusterDisableClickZoom: true,
|
||||
clusterHasBalloon: false,
|
||||
@ -553,7 +557,9 @@ export function createMapView(els: MapElements, apiKey: string): MapView {
|
||||
const cluster = objectManager.clusters.getById(e.get('objectId'));
|
||||
const objs = cluster ? cluster.properties.geoObjects : [];
|
||||
const list = objs.map((o: any) => drawn[o.id as number]).filter(Boolean);
|
||||
if (list.length) showTip(clusterTip(list));
|
||||
// A cluster of one keeps the rich single-surface tooltip.
|
||||
if (list.length === 1) showTip(singleTip(list[0]!));
|
||||
else if (list.length) showTip(clusterTip(list));
|
||||
});
|
||||
objectManager.clusters.events.add(['mouseleave'], hideTip);
|
||||
// Click opens our own panel (and hides the hover tip so it doesn't stick).
|
||||
|
||||
Loading…
Reference in New Issue
Block a user