Keep zoom() at top level in route-stop circle expressions (#1927)#1929
Merged
Conversation
MapLibre 13.3.1 rejects a zoom() expression nested inside anything but a
top-level step/interpolate ("zoom expression may only be used as input to
a top-level step or interpolate expression"). The route-stop circle layer
wrapped its zoom()-driven radius interpolation in product() to derive the
outer stroke width and the selected inner-circle radius, so those two
layers failed validation under MapLibre 13 — circles lost their stroke
ring and selected stops lost zoom-scaled highlighting. MapLibre 11.5.2
tolerated the nesting.
Fold the scale factor into each interpolation stop's output instead of
wrapping the whole interpolation, keeping zoom() at the top level. For a
linear interpolation, scaling each endpoint is mathematically identical to
scaling the interpolation, including the clamped regions outside the band.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe route-stop circle layer now applies outer stroke and inner-circle scaling within interpolation stop outputs, preserving a top-level ChangesStop-circle expression scaling
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
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.
Fixes #1927
Problem
After the MapLibre 11 → 13 upgrade,
MapLibreRouteStopCircleLayerfails runtime style-expression validation at launch:The layer built a
zoom()-driven radius interpolation once, then wrapped that whole interpolation insideproduct()to derive two properties:circleStrokeWidth(radius × stroke/radius ratio)circleRadius(radius × inner scale)MapLibre 11.5.2 tolerated a
zoom()nested insideproduct(); 13.3.1 rejects it. The top-levelcircleRadius()interpolation still validated, so only those two nested usages broke — route-stop circles rendered without their stroke ring, and selected stops lost their zoom-scaled radius highlighting.Fix
radiusExpression(scale)now folds the scale factor into each interpolation stop output rather than wrapping the interpolation:zoom()stays at the top level (valid). Because the interpolation is linear, scaling each endpoint is mathematically identical to scaling the whole interpolation — including the clamped regions outside the zoom band. The defaultscale = 1freproduces the original bare-get()outputs for the outer radius.Testing
./gradlew :onebusaway-android:compileObaMaplibreDebugKotlin -PwarningsAsErrors=trueobaMaplibreDebugbuild on a device.🤖 Generated with Claude Code
Summary by CodeRabbit