Skip to content

fix(extensions): measure brushingRadius in true meters on MapView - #10668

Open
chrisgervang wants to merge 5 commits into
claude/fix-brushing-globe-GveWOfrom
claude/fix-brushing-radius-meters-GveWO
Open

chrisgervang wants to merge 5 commits into
claude/fix-brushing-globe-GveWOfrom
claude/fix-brushing-radius-meters-GveWO

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

Follow up of #10661

Background

brushing_isPointInRange divides the distance by project.commonUnitsPerMeter. Below zoom 12 (PROJECTION_MODE_WEB_MERCATOR) that is the equatorial value, so brushingRadius on MapView is radius × cos(latitude) in real meters, while auto-offset mode and GlobeView already measure true meters. The same radius selects different objects across the zoom-12 boundary and between views.

Before After
brushing-source on MapView: brushingRadius: 3000 m, pointer at the canvas centre, San Francisco at zoom 11.5 before after

The before image is the golden from #10661; the after image is the regenerated golden. The circle grows by 1/cos(37.75°) and now matches the extent of brushing-source-globe.

Change List

  • brushing shader module: under WEB_MERCATOR + LNGLAT without pseudo-meters, divide the distance by project_size_at_latitude() at the mean latitude of the pointer and the object, mirroring project_size()
    • Behavior change on MapView below zoom 12: the circle grows by 1/cos(latitude), 1.26x at 37.75°, 2x at 60°
    • Makes brushingRadius mean meters as documented; there is no post-9.4 upgrade guide section to note it in yet
  • brushing-source.png regenerated: the map circle now matches its globe twin (about 140 px for 3 km at zoom 11.5); other brushing goldens unchanged
  • Documentation: brushingRadius property text states the measurement rule per view; docs/whats-new.md notes the MapView change

Ran the render spec headless on WebGL, tsc and lint.


Note

Medium Risk
Changes GPU distance logic for brushing on MapView below zoom 12, so apps may see a larger selection circle at higher latitudes; behavior is intentional to match documented meters.

Overview
BrushingExtension now treats brushingRadius as real meters on MapView at all zoom levels, matching GlobeView and the docs.

In the brushing shader, when Web Mercator + lng/lat is active without pseudo-meters, the pointer-to-object distance is scaled by project_size_at_latitude() at the mean latitude of the pointer and the feature—same idea as project_size(). Below zoom 12 the effective brush circle grows by 1/cos(latitude) (e.g. ~1.26× at San Francisco), so radius no longer jumps at the zoom-12 boundary or diverges from globe behavior.

Docs clarify that radius is in meters in every view; what’s new calls out the MapView fix. Render goldens for the brushing example were regenerated so map and globe circles align.

Reviewed by Cursor Bugbot for commit 2f2f1ac. Bugbot is set up for automated code reviews on this repo. Configure here.

@coveralls

coveralls commented Sep 7, 2026 •

Copy link
Copy Markdown

Coverage Status

Coverage is 82.555% — claude/fix-brushing-radius-meters-GveWO into claude/fix-brushing-globe-GveWO. No base build found for claude/fix-brushing-globe-GveWO.

@greptile-apps

greptile-apps Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Changes how brushing radius is measured on map views.

The PR appears safe to merge; no outstanding finding or new actionable issue was established.

Summary

The PR adjusts MapView brushing distances to account for latitude below the auto-offset threshold, updates the brushing documentation and golden image, and adds globe path-dash coverage.

  • The three previous findings are manually resolved; none is carried forward as outstanding.
  • No new actionable issue was established.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Pointer and object positions] --> B[Projected common-space distance]
  B --> C{Web Mercator lng/lat without pseudo-meters?}
  C -- Yes --> D[Adjust distance at mean latitude]
  C -- No --> E[Keep projected distance]
  D --> F[Compare with brushingRadius]
  E --> F
Loading

Reviews (7) · Last reviewed commit: "docs(extensions): qualify the brushingRa..."

Comment thread modules/extensions/src/brushing/shader-module.ts Outdated
Comment thread docs/api-reference/extensions/brushing-extension.md Outdated
@chrisgervang
chrisgervang force-pushed the claude/fix-brushing-radius-meters-GveWO branch from 39bdfea to 54fd922 Compare September 25, 2026 17:43
Comment thread docs/api-reference/extensions/brushing-extension.md Outdated
Comment thread modules/extensions/src/brushing/shader-module.ts Outdated
Comment thread docs/api-reference/extensions/brushing-extension.md Outdated
@chrisgervang
chrisgervang force-pushed the claude/fix-brushing-globe-GveWO branch from 6ffd440 to 2a0980b Compare October 3, 2026 22:10
@chrisgervang
chrisgervang force-pushed the claude/fix-brushing-radius-meters-GveWO branch from 2f2f1ac to fd53c93 Compare October 3, 2026 22:12
@chrisgervang
chrisgervang force-pushed the claude/fix-brushing-globe-GveWO branch from 2a0980b to 865b857 Compare October 3, 2026 22:31
claude added 5 commits October 3, 2026 22:31
brushing_isPointInRange divided the common-space distance by
project.commonUnitsPerMeter, which below the auto-offset zoom is the
equatorial Web Mercator value. brushingRadius was therefore effectively
radius * cos(latitude) in real meters on MapView (about 2.4 km for a
3 km radius in San Francisco), while at zoom >= 12 (auto-offset mode) and
on GlobeView it already measured true meters. The same radius thus
selected different objects across the zoom-12 boundary and between views.

Apply project_size_at_latitude() at the pointer's latitude under
PROJECTION_MODE_WEB_MERCATOR + LNGLAT + !pseudoMeters, mirroring what
project_size() does for geometry sizes. Auto-offset, globe and identity
modes are unchanged. The map render golden now shows the same circle as
its GlobeView twin.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9
…ter and object

Scaling the Web Mercator distance by the pointer's latitude alone gives
different effective radii north and south of the pointer for large radii.
Use the mean latitude of the two endpoints, which is symmetric and exact to
first order in the latitude difference, and describe the remaining
approximation in the docs instead of claiming exact meters.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9
… of Remarks

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9
@chrisgervang
chrisgervang force-pushed the claude/fix-brushing-radius-meters-GveWO branch from fd53c93 to c9abe1f Compare October 3, 2026 22:31
@chrisgervang chrisgervang added this to the v9.4 patch releases milestone Oct 10, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants