Skip to content

fix(layers): sample decoded raster tile images for hover - #3963

Merged
igorDykhta merged 1 commit into
masterfrom
fix/pmtiles-image-hover-20261102
Nov 2, 2026
Merged

igorDykhta merged 1 commit into
masterfrom
fix/pmtiles-image-hover-20261102

Conversation

@igorDykhta

Copy link
Copy Markdown
Collaborator

PMTiles returns decoded browser images, so enabled hover previously found no pixels despite a loaded tile. Read RGBA pixels lazily through a canvas and cache them weakly per immutable tile image. Raw/scientific bands are unchanged; unavailable or security-blocked readback stays unavailable.

Tests exercise the tile loader → viewport cache → hover path, coordinate selection, opt-in behavior, caching/replacement, transparent pixels, raw buffers and SecurityError. Canvas readback is mocked in the local Node suite; native ImageBitmap decoding has not been exercised.

Verification: PASS targeted Tape (387 assertions), changed-file ESLint/Prettier and diff whitespace. FAILED as expected against unchanged master (regression reproduction). PASS full yarn agent:verify on Node 24.21.0 (initial sandbox attempt failed because MCP test listeners could not bind localhost; rerun with test permissions passed). PASS independent read-only review; no actionable findings.

Review:

  • RGBA display values and readback/cache lifetime
  • Security/unavailable-canvas fallback and regression coverage

Signed-off-by: Igor Dykhta <igorDykhta@users.noreply.github.com>
@igorDykhta igorDykhta self-assigned this Nov 2, 2026
@igorDykhta
igorDykhta requested a review from lixun910 November 2, 2026 04:30
@igorDykhta
igorDykhta marked this pull request as ready for review November 2, 2026 05:53
Copilot AI balanced review requested due to automatic review settings November 2, 2026 05:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain, although tests were not run during review and native ImageBitmap decoding remains untested.

No open issues 🎉

What changed in this PR

Fixes raster-tile hover sampling for decoded PMTiles images by reading RGBA pixels through a canvas, while preserving raw/scientific band sampling.

Changes:

  • Reads pixels lazily and caches results weakly per image, including unavailable or security-blocked readbacks.
  • Adds regression coverage for the loader-to-hover flow, coordinate selection, opt-in behavior, caching, image replacement, transparency, and raw buffers.

Verification: NOT RUN during this review. Canvas readback is mocked in the added tests; native ImageBitmap decoding remains untested.

File Description
test/​browser/​layer-tests/​raster-tile-layer-specs.js Adds decoded-image hover and fallback regression tests.
src/​layers/​src/​raster-tile/​raster-tile-identify.ts Adds lazy canvas readback and weak per-image pixel caching.

Review effort: Balanced

@igorDykhta
igorDykhta merged commit 2d00409 into master Nov 2, 2026
8 checks passed
@igorDykhta
igorDykhta deleted the fix/pmtiles-image-hover-20261102 branch November 2, 2026 09:15
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