map: show preview of coarse
parent
b7dcf4786a
commit
85f3d635c6
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 });
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue