map: show preview of coarse

pull/396/head
Varun Patil 2023-02-08 23:36:31 -08:00
parent b7dcf4786a
commit 85f3d635c6
3 changed files with 4 additions and 4 deletions

View File

@ -60,8 +60,7 @@ class MapController extends ApiBase
$clusters = $this->timelineQuery->getMapClusters($gridLen, $bounds, $root);
// Merge clusters that are close together
$distanceThreshold = $gridLen / 2;
$clusters = $this->mergeClusters($clusters, $distanceThreshold);
$clusters = $this->mergeClusters($clusters, $gridLen / 2);
return new JSONResponse($clusters);
} catch (\Exception $e) {

View File

@ -47,8 +47,9 @@ trait TimelineQueryMap
->from('memories_map_clusters', 'c')
;
if ($gridLen > 0.2) {
if ($gridLen > 0.02) {
// Coarse grouping
$query->addSelect($query->createFunction('MAX(c.id) as id'));
$query->addGroupBy($query->createFunction("CAST(c.lat / {$gridLen} AS INT)"));
$query->addGroupBy($query->createFunction("CAST(c.lon / {$gridLen} AS INT)"));
} else {

View File

@ -116,7 +116,7 @@ export default defineComponent({
zoomTo(center: [number, number]) {
const map = this.$refs.map as LMap;
const zoom = Math.max(map.mapObject.getZoom() + 2, 14);
const zoom = map.mapObject.getZoom() + 2;
map.mapObject.setView(center, zoom, { animate: true });
},
},