Stop over-filtering visible posts by bounds
This commit is contained in:
parent
1e4807e6f2
commit
d854da7c1b
|
|
@ -877,18 +877,17 @@ 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);
|
const center = map?.getCenter?.();
|
||||||
|
let bounds = null;
|
||||||
|
try {
|
||||||
|
const b = map?.getBounds?.();
|
||||||
|
if (b) {
|
||||||
|
const sw = b.getSouthWest();
|
||||||
|
const ne = b.getNorthEast();
|
||||||
|
bounds = { minLat: sw?.lat, minLon: sw?.lng, maxLat: ne?.lat, maxLon: ne?.lng };
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
if (v.length > MAX_VISIBLE_POSTS) {
|
if (v.length > MAX_VISIBLE_POSTS) {
|
||||||
const center = map?.getCenter?.();
|
|
||||||
let bounds = null;
|
|
||||||
try {
|
|
||||||
const b = map?.getBounds?.();
|
|
||||||
if (b) {
|
|
||||||
const sw = b.getSouthWest();
|
|
||||||
const ne = b.getNorthEast();
|
|
||||||
bounds = { minLat: sw?.lat, minLon: sw?.lng, maxLat: ne?.lat, maxLon: ne?.lng };
|
|
||||||
}
|
|
||||||
} catch {}
|
|
||||||
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