Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Scale dynamically sized points as the map zooms in so small values remain
* visible. The multiplier grows gradually above zoom 4 and is capped to keep
* large points from overwhelming the map.
* visible. Keep the configured size through zoom 4, then grow by 1 per zoom
* level up to an 8x cap.
*/
export const getDynamicPointZoomScale = (zoom: number): number => {
if (!Number.isFinite(zoom)) return 1;
return Math.min(3.5, 1 + Math.max(0, zoom - 4) * 0.25);
return Math.min(8, 1 + Math.max(0, zoom - 4));
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ describe('getDynamicPointZoomScale', () => {
});

it('gradually increases point size above zoom 4', () => {
expect(getDynamicPointZoomScale(6)).toBe(1.5);
expect(getDynamicPointZoomScale(8)).toBe(2);
expect(getDynamicPointZoomScale(6)).toBe(3);
expect(getDynamicPointZoomScale(8)).toBe(5);
});

it('caps the multiplier at 3.5', () => {
expect(getDynamicPointZoomScale(24)).toBe(3.5);
expect(getDynamicPointZoomScale(30)).toBe(3.5);
it('caps the multiplier at 8', () => {
expect(getDynamicPointZoomScale(24)).toBe(8);
expect(getDynamicPointZoomScale(30)).toBe(8);
});

it('falls back safely for an invalid zoom', () => {
Expand Down
Loading