feat: ski runs layer in map-external-layer sample#116
Open
lpernelle-woosmap wants to merge 2 commits intomasterfrom
Open
feat: ski runs layer in map-external-layer sample#116lpernelle-woosmap wants to merge 2 commits intomasterfrom
lpernelle-woosmap wants to merge 2 commits intomasterfrom
Conversation
…nal-layer sample - Swap default third-party layer from ArcGIS satellite to OpenSnowMap ski runs - Default style set to Light Grey, view centered on Oz-en-Oisans - OpenWeather layers (temperature, precipitation) fly to a US view - Refactor: replace if/else chains with Record-based STYLE_PRESETS and LAYER_CONFIGS - Fix overlay stacking bug (clear before insertAt) - Fix opacity validation (handle NaN, dedupe parseFloat) - Split layer/opacity handlers so opacity changes no longer reset bounds - TypeScript cleanup: split combined declarations, String -> string, === Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
- Add panel title and stack labels above selects (was cramped at 100px width) - Replace opacity number input with range slider + live percentage readout - Style selects and slider with consistent borders, focus state, accent color - Wrap controls in <label> so clicking the label activates the input - Apply mapTypeControl: true to the initial map (was only set after style change) - Drop opacity alert — the slider HTML attributes already enforce the 0..1 bounds Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
map-external-layersampleflyTo; opacity change no longer recreates the mapCode quality
While in there, fixed several issues in the existing sample code:
changeLayerusedinsertAt(0, …)without clearing previous overlays. After N changes, N raster layers were stacked with cumulative opacity. NowapplyLayercallsoverlayMapTypes.clear()first.parseFloat(opacityInput.value)was called twice andNaN(empty/non-numeric input) silently passed validation. Centralized inreadOpacity()with a properisNaNcheck.changeStyleon every event, recreating the map even on opacity changes. Split intoonStyleChange/onLayerChange/onOpacityChange.Record<string, …>lookups (STYLE_PRESETS,LAYER_CONFIGS,LAYER_VIEWS). Reduces cognitive complexity and makes adding a new layer/style a one-line change.let styleSelect, layerSelect: HTMLSelectElement(where onlylayerSelectwas actually typed),String→string,==→===, consistent indentation, semicolons.Follow-up (out of scope)
samples/map-external-layer/index.ts:1(pre-existing onmaster). Should be rotated and replaced with a placeholder.dist/samples/map-external-layer/**is intentionally not included in this PR — CI regenerates it via thechore: update dist folder [skip ci]job.Test plan
🤖 Generated with Claude Code