Skip to content

fix(extensions): BrushingExtension distance on GlobeView - #10661

Open
chrisgervang wants to merge 8 commits into
masterfrom
claude/fix-brushing-globe-GveWO
Open

chrisgervang wants to merge 8 commits into
masterfrom
claude/fix-brushing-globe-GveWO

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

Follow up of #10657

Background

brushing_isPointInRange projects the object and the pointer with project_position(vec2) and measures the distance in xy. Under PROJECTION_MODE_GLOBE common space is sphere XYZ, so the dropped z shrinks distances and far objects pass the radius test: a brushing circle on GlobeView renders as a tall, over-inclusive blob.

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

Standalone GlobeView. The before image is the same case rendered on master; the after image is the new golden. The brushing-disabled cases and the MapView case pass on master and are coverage only.

Change List

  • brushing shader module (GLSL and WGSL): measure the 3D chord distance with project_position(vec3) and length() over xyz, divided by project.commonUnitsPerMeter. Identical to before under Mercator and identity (z is 0); on the globe the chord matches the great-circle distance to within 0.03% for radii under 500 km
  • Render tests: new brushing-extension.spec.ts with brushing-source and brushing-disabled under MapView and GlobeView, pointer injected at the canvas center (4 goldens; Brushing had none)
  • Unit test: GlobeViewport case for mousePos and enabled
  • Documentation: docs/whats-new.md GlobeView compatibility bullet

The map circle is smaller than the globe circle by cos(latitude) because MapView below zoom 12 divides by the equatorial commonUnitsPerMeter. Fixed separately in #10668.

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


Note

Low Risk
Low risk, as the change preserves identical behavior for flat projections while correcting shader distance calculation on GlobeView, covered by new unit and render tests.

Overview
Updates BrushingExtension shaders (both GLSL and WGSL) to compute distances using 3D common space coordinates instead of 2D coordinates. While 2D planar projections remain unaffected because z is zero, this fixes distance calculations on GlobeView by evaluating the 3D chord distance instead of dropping the sphere's z coordinate.

Adds unit tests for uniform generation under GlobeViewport, new visual render tests for MapView and GlobeView, and updates the release documentation.

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


Generated by Claude Code

@coveralls

coveralls commented Sep 7, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 84.83% (+0.02%) from 84.815% — claude/fix-brushing-globe-GveWO into master

brushing_isPointInRange projected the object and the pointer with
project_position(vec2), which returns only the xy of the common-space
position. Under PROJECTION_MODE_GLOBE common space is sphere XYZ, so the
dropped z shrank distances (most strongly north-south at mid latitudes)
and far objects passed the radius test: a brushing circle rendered as a
tall over-inclusive blob on GlobeView.

Compute the 3D chord distance instead: project_position(vec3) for both
points and length() over all three components divided by the isotropic
project.commonUnitsPerMeter. Under the flat projection modes both z are
0, so Mercator/identity behaviour is unchanged; on the globe the chord
equals the great-circle distance to within 0.03% for radii under 500 km.
No flat-space helper is needed: brushing is a distance test, not a
texture/bounds lookup.

Tests: new render spec brushing-extension.spec.ts renders
brushing-source and brushing-disabled under MapView and GlobeView via
expandViewMatrix (pointer injected at the canvas centre through
context.mousePosition); the unit spec gains a GlobeViewport case
asserting the mousePos uniform is the lng/lat unprojection of the pixel
and that brushing is enabled inside the viewport.

Docs: Remarks section in brushing-extension.md.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9
@chrisgervang
chrisgervang force-pushed the claude/fix-brushing-globe-GveWO branch from 865b857 to c435f4b Compare October 23, 2026 00:33
@chrisgervang chrisgervang mentioned this pull request Oct 29, 2026
29 of 30 tasks
@chrisgervang
chrisgervang marked this pull request as ready for review November 3, 2026 00:02
@chrisgervang
chrisgervang requested a review from ibgreen November 3, 2026 00:03
…-globe-GveWO

# Conflicts:
#	docs/whats-new.md
@greptile-apps

greptile-apps Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable new issues were found.

Summary

Fixes BrushingExtension on GlobeView by measuring distance across all three projected coordinates.

  • Brushing filters globe points using their full 3D distance.

Reviews (7) · Last reviewed commit: "fix(extensions): measure the WebGPU brus..." · Reviewed by Greptile

@chrisgervang
chrisgervang added this pull request to stack #11042 November 5, 2026 00:46

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7b0c411. Configure here.

@ibgreen ibgreen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change to a 3D chord fixes the dropped axis in globe space while keeping flat positions at zero elevation. Please check the combined shader after the MapView meters PR is integrated, since both edit the same distance calculation.

@chrisgervang chrisgervang mentioned this pull request Nov 24, 2026
29 tasks

@athomct athomct left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shader change is correct for lnglat layers on GlobeView. Three points:

  • The new GlobeViewport case in brushing.spec.ts checks only the getUniforms output, and this PR does not change that code. The case passes with or without the shader fix. Please add a check of the shader distance, or rename the case.
  • The brushing render suite runs only on WebGL, so no test covers the WGSL change.
  • The whats-new.md entry is in the v9.4 section, but the fix is not on 9.4-release. Please backport it, or move the entry to the v10 section.

Pre-existing, optional: on GlobeView, a pointer over the space next to the globe still enables brushing, because GlobeViewport.unproject returns the nearest point on the limb when the ray misses the globe.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants