Use raster tiles for map overlays#1239
Merged
DavidMStraub merged 10 commits intoJun 12, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR switches the map view’s media overlays from single-image MapLibre “image” sources to raster tile overlays, adding a dedicated tile-layer web component and a new API URL helper to generate authenticated tile URLs.
Changes:
- Replace
<grampsjs-map-overlay>usage in the map view with a new<grampsjs-map-tile-layer>raster tile overlay component. - Add
getTileUrl(handle)to generate{z}/{x}/{y}raster tile URLs (optionally includingjwt). - Update
GrampsjsMapstyle-change handling to rely ontransformStylecontributions (and remove the previous overlay re-add flow).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/views/GrampsjsViewMap.js | Switches map overlays in the main map view to the new raster tile layer component. |
| src/components/GrampsjsMapTileLayer.js | Introduces a raster tile overlay component that contributes layers via transformStyle and can be toggled hidden/visible. |
| src/components/GrampsjsMap.js | Refactors style-change overlay handling to depend on transformStyle contributors. |
| src/api.js | Adds getTileUrl() helper for authenticated raster tile requests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+200
to
+206
| // Handles children added after the map's load event (e.g. async data layers). | ||
| _onSlotChange() { | ||
| if (!this._map?.isStyleLoaded()) return | ||
| this._slottedChildren | ||
| .filter(el => typeof el.addToMap === 'function') | ||
| .forEach(el => el.addToMap(this._map)) | ||
| } |
Comment on lines
+44
to
+48
| addToMap(map) { | ||
| this._map = map | ||
| map.on('style.load', this._onStyleLoad) | ||
| if (!this.handle) return | ||
| const layerId = this._layerId |
Comment on lines
+105
to
+108
| getTransformStyleContribution(_prev, next) { | ||
| if (!this.url || !this._layerId) return next | ||
| const coordinates = this._getCoordinates() | ||
| if (!coordinates) return next |
Comment on lines
+621
to
+625
| export function getTileUrl(handle) { | ||
| const jwt = localStorage.getItem('access_token') | ||
| const base = `${__APIHOST__}/api/media/${handle}/tile/{z}/{x}/{y}` | ||
| return jwt ? `${base}?jwt=${jwt}` : base | ||
| } |
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.
No description provided.