mirror of
https://github.com/maputnik/editor.git
synced 2026-12-05 16:24:20 +00:00
Fixes #1028. The PMTiles source editor only had a URL field, so there was no way to set `minzoom` or `maxzoom` on a PMTiles source from Maputnik. That matters when the file's header says one thing and you want another, for example to overzoom past the last zoom level in the file. It now has Min Zoom and Max Zoom fields, the same ones the tile URL editor uses. MapLibre already lets a key in the source override the value it reads from the PMTiles TileJSON (`load_tilejson.ts` uses `fromOptions.maxzoom ?? fromTileJSON.maxzoom`). Unlike the tile URL editor, the fields stay empty until you set them, rather than showing 0 and 22. That way a source you don't touch keeps the zoom range from the PMTiles header. **Before / after** (Data Sources → Add New Source → Vector (PMTiles)): | Before | After | |---|---| | <img src="https://raw.githubusercontent.com/KhadeerBasha1232/maputnik/pr-assets/pr-1028/before-pmtiles-source.png" width="400"> | <img src="https://raw.githubusercontent.com/KhadeerBasha1232/maputnik/pr-assets/pr-1028/after-pmtiles-source.png" width="400"> | **Performance:** no impact. This adds two inputs to the source modal; nothing runs on the map's render path. ## Launch Checklist - [x] Briefly describe the changes in this PR. - [x] Link to related issues: fixes #1028. - [x] Include before/after visuals or gifs if this PR includes visual changes. - [x] Write tests for all new functionality: `add new pmtiles source with a max zoom` in `modals.spec.ts`. It fails on `main`. - [x] Add an entry to `CHANGELOG.md` under the `## main` section. Tested locally: `npm run lint` clean, `npx tsc --noEmit` clean, `npx vitest run` (57 passed) and the full `npx playwright test` suite (221 passed). The new test fails when I put back `main`'s `ModalSourcesTypeEditor.tsx`. Assisted-By: Claude Opus 5.5 (Claude Code). It helped write the change, the test and this description. I've reviewed and tested the change and can answer questions about it.