From 78d62ae36c2246efdaa08bdd9eb6da989f8b805a Mon Sep 17 00:00:00 2001 From: aaverbitskiy Date: Sat, 15 Aug 2026 09:04:27 +0000 Subject: [PATCH] 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 --- frontend/package.json | 2 +- frontend/src/map.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 9b6558c..c15ee38 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "mapdash-frontend", "private": true, - "version": "0.2.8", + "version": "0.2.9", "type": "module", "scripts": { "dev": "vite", diff --git a/frontend/src/map.ts b/frontend/src/map.ts index c0cd7bf..3cecb74 100644 --- a/frontend/src/map.ts +++ b/frontend/src/map.ts @@ -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).