Skip to content

Fix glitchy labels layer when zoom changes, make labels sublayer ids unique per tile - #44

Merged
xinaesthete merged 2 commits into
mainfrom
codex/fix-label-layer-transform-glitch
Jun 11, 2026
Merged

Fix glitchy labels layer when zoom changes, make labels sublayer ids unique per tile#44
xinaesthete merged 2 commits into
mainfrom
codex/fix-label-layer-transform-glitch

Conversation

@xinaesthete

@xinaesthete xinaesthete commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

multiscale labels bitmask sublayers could reuse the same deck layer id across different tile resolutions when their world bounds matched. During viewState changes, deck could transfer stale tile/texture state between those layers, leading to intermittent bad transformations.

Summary by CodeRabbit

  • Bug Fixes
    • Improved label rendering precision by enhancing tile coordinate handling in layer identification, ensuring correct label display across different zoom levels and map positions.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@xinaesthete, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 57 minutes and 11 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 44d55723-c3f2-4620-86a9-96cf78c39820

📥 Commits

Reviewing files that changed from the base of the PR and between 84cb76d and f8b82f0.

📒 Files selected for processing (1)
  • .changeset/steady-labels-transform.md
📝 Walkthrough

Walkthrough

The PR updates labels bitmask sub-layer ID generation to incorporate tile coordinates (z, x, y) alongside existing bounds and parent layer ID, ensuring unique identifiers across zoom levels and tile positions. A new test validates this behavior; three test suites are refactored to use a centralized ID constant instead of hardcoded duplicates.

Changes

Labels Bitmask Sub-Layer ID Enhancement

Layer / File(s) Summary
ID generation and validation test
packages/layers/src/LabelsLayer.ts, packages/layers/tests/labelsLayer.spec.ts
renderSubBitmaskLayers now embeds tile coordinates into the sub-layer id string. A new test case verifies that tiles at different zoom levels (differing tile.index.z) produce distinct sub-layer IDs.
Test constant refactoring
packages/vis/tests/featureTooltipHover.spec.ts
A new LABELS_BITMASK_LAYER_ID constant consolidates the labels bitmask sub-layer ID value previously hardcoded in multiple test assertions, reducing duplication across three test cases that handle layer resolution, bitmask-to-logical normalization, and targeted picking with duplicate overlays.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops through layer heights,
Each tile gets coords shining bright,
No duplicate ID strings roam,
Constants make the tests feel home. 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: making labels sublayer IDs unique per tile to fix glitches during zoom changes. It directly corresponds to the primary modifications across all three files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-label-layer-transform-glitch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@xinaesthete
xinaesthete merged commit 2e74bea into main Jun 11, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 11, 2026
xinaesthete added a commit that referenced this pull request Jun 29, 2026
…71)

The MultiscaleLabelsTileLayer was created with minZoom: -20, so deck.gl
kept subdividing the tile grid below the deepest available resolution
level. Past that level getTileData clamps to the deepest loader and
returns the same data, but the tile bbox keeps doubling — so the bounds
formula stretched that fixed data across an ever-larger world rect, far
beyond the image extent. This is the "labels switch to an obviously wrong
transformation at certain zoom levels" bug (PR #44 only masked a related
texture-reuse artifact via unique sublayer ids).

Cap minZoom at -(loader.length - 1), matching Viv's MultiscaleImageLayer,
so the coarsest real tiles stay correctly placed at any zoom-out. Also add
the bbox-culling guards Viv's renderSubLayers applies (skip negative-edge
or zero-sized tiles) for defense in depth.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot mentioned this pull request Jun 29, 2026
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.

1 participant