Repository navigation
fix(extensions): BrushingExtension distance on GlobeView - #10661
chrisgervang wants to merge 8 commits into
Conversation
8ca4b80 to
d261046
Compare
2a0980b to
865b857
Compare
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
…nstead of Remarks Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9
865b857 to
c435f4b
Compare
…-globe-GveWO # Conflicts: # docs/whats-new.md
[Medium impact] The PR appears safe to merge; no actionable new issues were found. SummaryFixes
Reviews (7) · Last reviewed commit: "fix(extensions): measure the WebGPU brus..." · Reviewed by Greptile |
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9
…-globe-GveWO # Conflicts: # docs/whats-new.md
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ 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.
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9
ibgreen
left a comment
There was a problem hiding this comment.
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.
athomct
left a comment
There was a problem hiding this comment.
The shader change is correct for lnglat layers on GlobeView. Three points:
- The new
GlobeViewportcase inbrushing.spec.tschecks only thegetUniformsoutput, 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.mdentry is in the v9.4 section, but the fix is not on9.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.

Follow up of #10657
Background
brushing_isPointInRangeprojects the object and the pointer withproject_position(vec2)and measures the distance in xy. UnderPROJECTION_MODE_GLOBEcommon space is sphere XYZ, so the dropped z shrinks distances and far objects pass the radius test: a brushing circle onGlobeViewrenders as a tall, over-inclusive blob.brushing-source-globe:ScatterplotLayerwithbrushingRadius: 3000m, pointer at the canvas centre, San Francisco at zoom 11.5Standalone
GlobeView. The before image is the same case rendered on master; the after image is the new golden. Thebrushing-disabledcases and theMapViewcase pass on master and are coverage only.Change List
brushingshader module (GLSL and WGSL): measure the 3D chord distance withproject_position(vec3)andlength()over xyz, divided byproject.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 kmbrushing-extension.spec.tswithbrushing-sourceandbrushing-disabledunderMapViewandGlobeView, pointer injected at the canvas center (4 goldens; Brushing had none)GlobeViewportcase formousePosandenableddocs/whats-new.mdGlobeView compatibility bulletThe map circle is smaller than the globe circle by cos(latitude) because
MapViewbelow zoom 12 divides by the equatorialcommonUnitsPerMeter. Fixed separately in #10668.Ran the render spec headless on WebGL, the unit spec,
tscand 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
BrushingExtensionshaders (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 onGlobeViewby 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 forMapViewandGlobeView, 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