Skip to content

Keep the selection outline while dragging and zooming the map - #112

Merged
ryanbarlow97 merged 1 commit into
mainfrom
selection-rim-on-pan
Oct 7, 2026
Merged

ryanbarlow97 merged 1 commit into
mainfrom
selection-rim-on-pan

Conversation

@ryanbarlow97

Copy link
Copy Markdown
Contributor

Problem

Dragging or zooming the map with a realm selected removed its white outline and the slight brightening until the map settled. A CSS rule ([data-gesturing] .map-selected-region { filter: none }) turned the highlight filter off for the whole of every gesture, because the filter was assumed too costly to redraw each frame.

Change

  • The rule is gone, and so is the data-gesturing attribute that only existed to drive it. The selection and hover highlights now stay up through drags and zooms.
  • The rim width is calc(rimPx / var(--map-rim-scale)). React sets --map-rim-scale to the settled scale. Mid-gesture the transform runs ahead of React, so onLiveTransform writes the live scale onto each .map-selected-region, and the rim keeps its on-screen width through a pinch or wheel zoom instead of growing or shrinking and then snapping back. React writes the same value once the gesture commits.
  • Safari is unchanged: it never gets these filters (mapFiltersSupportedHere).

Measurements (headless Chromium against tfminecraft.net, 1440×900)

  • Drag: trace sums (raster, pipeline, draw, paint) with the filter kept were within the run-to-run spread of the filter off, over three interleaved runs. Promoting the element with will-change: transform was worse.
  • Wheel zoom: raster sums were up to about 30% higher in two of three runs. rAF frame-time p50/p90 and long-frame counts showed no consistent difference; tile loading dominates. Worth a pinch on a real phone or PC on dev.
  • Local build mid-zoom: the rim measured 2.5 px on screen at rest, mid-zoom-in and mid-zoom-out. The live site has the filter off at the same moment.

Checks

  • tsc --noEmit passes.
  • vitest run: 1,948 tests pass. RecipeVehiclePreview.test.tsx timed out once under load and passes alone.

🤖 Generated with Claude Code

The selected realm's rim and brightening are a CSS filter that stood down
for the whole of any drag or zoom, so the realm lost its border and dimmed
until the map settled. Measured on the live site, keeping it costs nothing
on a drag and showed no frame-time difference on a zoom, so it now stays up.

Mid-gesture the scale runs ahead of React, so the viewport writes the live
scale into --map-rim-scale on each highlighted element and the rim keeps its
on-screen width through a zoom instead of growing and snapping back.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 30 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a4cb139f-6084-48df-a3d1-7b30b059e584
📥 Commits

Reviewing files that changed from the base of the PR and between 5672587 and c7c6bda.

📒 Files selected for processing (3)
  • frontend/app/components/map/MapCanvas.tsx
  • frontend/app/hooks/useMapViewport.ts
  • frontend/app/internal/globals.css
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@ryanbarlow97
ryanbarlow97 merged commit 37078ff into main Oct 7, 2026
2 checks passed
@ryanbarlow97
ryanbarlow97 deleted the selection-rim-on-pan branch October 7, 2026 21:46
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