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:
aaverbitskiy 2026-08-15 09:04:27 +00:00
parent e83bb5ad49
commit 12e165d763
2 changed files with 8 additions and 2 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "mapdash-frontend", "name": "mapdash-frontend",
"private": true, "private": true,
"version": "0.2.8", "version": "0.2.9",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@ -533,6 +533,10 @@ export function createMapView(els: MapElements, apiKey: string): MapView {
objectManager = new ymaps.ObjectManager({ objectManager = new ymaps.ObjectManager({
clusterize: true, clusterize: true,
gridSize: 112, 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. // No Yandex balloons — clicks open our own panel. Clusters must not zoom.
clusterDisableClickZoom: true, clusterDisableClickZoom: true,
clusterHasBalloon: false, clusterHasBalloon: false,
@ -553,7 +557,9 @@ export function createMapView(els: MapElements, apiKey: string): MapView {
const cluster = objectManager.clusters.getById(e.get('objectId')); const cluster = objectManager.clusters.getById(e.get('objectId'));
const objs = cluster ? cluster.properties.geoObjects : []; const objs = cluster ? cluster.properties.geoObjects : [];
const list = objs.map((o: any) => drawn[o.id as number]).filter(Boolean); 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); objectManager.clusters.events.add(['mouseleave'], hideTip);
// Click opens our own panel (and hides the hover tip so it doesn't stick). // Click opens our own panel (and hides the hover tip so it doesn't stick).