Stop over-filtering visible posts by bounds
This commit is contained in:
parent
1e4807e6f2
commit
d854da7c1b
|
|
@ -877,8 +877,6 @@ export function usePostsEngine({
|
||||||
const isClusterFocus = !!(clustersEnabled && Array.isArray(clusterFocus?.ids) && clusterFocus.ids.length > 0);
|
const isClusterFocus = !!(clustersEnabled && Array.isArray(clusterFocus?.ids) && clusterFocus.ids.length > 0);
|
||||||
let v = vAll;
|
let v = vAll;
|
||||||
if (!isClusterFocus) {
|
if (!isClusterFocus) {
|
||||||
v = filterByBounds(vAll, map);
|
|
||||||
if (v.length > MAX_VISIBLE_POSTS) {
|
|
||||||
const center = map?.getCenter?.();
|
const center = map?.getCenter?.();
|
||||||
let bounds = null;
|
let bounds = null;
|
||||||
try {
|
try {
|
||||||
|
|
@ -889,6 +887,7 @@ export function usePostsEngine({
|
||||||
bounds = { minLat: sw?.lat, minLon: sw?.lng, maxLat: ne?.lat, maxLon: ne?.lng };
|
bounds = { minLat: sw?.lat, minLon: sw?.lng, maxLat: ne?.lat, maxLon: ne?.lng };
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
|
if (v.length > MAX_VISIBLE_POSTS) {
|
||||||
v = prunePosts(v, [center?.lng, center?.lat], MAX_VISIBLE_POSTS, bounds);
|
v = prunePosts(v, [center?.lng, center?.lat], MAX_VISIBLE_POSTS, bounds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue