Add dedicated sample pages for Compass, Locate, BasemapToggle, and ScaleBar widgets#14
Open
Add dedicated sample pages for Compass, Locate, BasemapToggle, and ScaleBar widgets#14
Conversation
…aleBar widgets New pages: - /compass-widget: Map rotation controls with CompassWidget reset - /locate-widget: Geolocation with configurable zoom scale - /basemap-toggle-widget: Switchable basemap style pairs - /scale-bar-widget: Unit (Imperial/Metric/Dual) and style (Ruler/Line) toggles Also adds nav menu entries and fixes UniqueValueRenderers build error. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR expands the Core sample app by adding dedicated pages for several widgets (Compass, Locate, BasemapToggle, ScaleBar) that were previously only demonstrated in the Widgets overview, and includes a small fix to resolve a build error in the UniqueValueRenderers sample.
Changes:
- Added 4 new widget-specific sample pages with simple configuration controls.
- Updated the nav menu to include routes for the new pages.
- Adjusted
UniqueValueRendererslabel formatting logic to avoid the removed/invalidToUpperFirstChar()usage.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| samples/core/dymaptic.GeoBlazor.Core.Sample.Shared/Shared/NavMenu.razor.cs | Adds nav links for the four new widget sample pages. |
| samples/core/dymaptic.GeoBlazor.Core.Sample.Shared/Pages/UniqueValueRenderers.razor.cs | Replaces ToUpperFirstChar() usage with inline formatting to fix build. |
| samples/core/dymaptic.GeoBlazor.Core.Sample.Shared/Pages/CompassWidgetPage.razor | New Compass widget page with rotation controls. |
| samples/core/dymaptic.GeoBlazor.Core.Sample.Shared/Pages/LocateWidgetPage.razor | New Locate widget page with selectable zoom scale. |
| samples/core/dymaptic.GeoBlazor.Core.Sample.Shared/Pages/BasemapToggleWidgetPage.razor | New BasemapToggle widget page with selectable basemap pairs. |
| samples/core/dymaptic.GeoBlazor.Core.Sample.Shared/Pages/ScaleBarWidgetPage.razor | New ScaleBar widget page with unit/style controls. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| private void OnScaleChanged(ChangeEventArgs e) | ||
| { | ||
| _scale = int.Parse(e.Value?.ToString() ?? "1500"); |
|
|
||
| private void OnPairChanged(ChangeEventArgs e) | ||
| { | ||
| _pairIndex = int.Parse(e.Value?.ToString() ?? "0"); |
Comment on lines
+54
to
+60
| _unit = Enum.Parse<ScaleUnit>(e.Value?.ToString() ?? "Imperial"); | ||
| _widgetKey++; | ||
| } | ||
|
|
||
| private void OnStyleChanged(ChangeEventArgs e) | ||
| { | ||
| _style = Enum.Parse<ScaleBarWidgetStyle>(e.Value?.ToString() ?? "Ruler"); |
Comment on lines
62
to
64
| private readonly UniqueValueRenderer _uniqueValueRenderer = new(uniqueValueInfos: roadTypes | ||
| .Select(r => new UniqueValueInfo(r.Key.ToUpperFirstChar().Replace("_", " "), r.Value, r.Key)) | ||
| .Select(r => new UniqueValueInfo(string.Concat(r.Key[0].ToString().ToUpper(), r.Key.AsSpan(1)).Replace("_", " "), r.Value, r.Key)) | ||
| .ToArray(), |
| <span style="margin-left: 1rem; opacity: 0.7;">Current: @(_rotation)°</span> | ||
| </div> | ||
|
|
||
| <MapView @key="@_rotation" Longitude="-118.805" Latitude="34.027" Zoom="13" Rotation="@_rotation" Class="map-view"> |
- Add value="@_pairIndex" to BasemapToggle select - Add value="@_unit" and value="@_style" to ScaleBar selects - Add aria-hidden="true" and focusable="false" to locate icon SVG Co-Authored-By: Claude Opus 4.6 (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