fix(web): respect fill in Canvas hit testing - #576
Draft
jpenilla wants to merge 1 commit into
Draft
Conversation
Patch Leaflet's Canvas hit testing so unfilled circles and polygons only capture pointer events along their visible strokes. This allows interactions with overlapping markers through transparent interiors and keeps circle, polygon, rectangle, and ellipse behavior consistent. Fixes #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Patch Leaflet 1.9.4's Canvas hit testing so:
This fixes interactions with markers underneath circular borders and makes
Circle/Polygon behavior consistent with squaremap's existing Ellipse behavior.
Behavior changes
fill: falsefill: falsefill: falseFilled shapes, ellipses, polylines, and icons are unchanged.
Integrations that intentionally need an invisible whole-area hit target can
use
fill: truewithfillOpacity: 0.Implementation
Uses Bun's patched-dependency support for Leaflet 1.9.4. The patch updates
Leaflet's source and shipped ESM/UMD builds.
Leaflet 2.0 currently retains the same Canvas hit-testing behavior, so this
will need to be reevaluated when upgrading.
Verification
bun run formatbun run lintbun run buildbun install --frozen-lockfileFixes #15