diff --git a/CHANGELOG.md b/CHANGELOG.md index 51bd16e6..f448fc86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ - Add german translation - Use same version number for web and desktop versions - Add scheme type options for vector/raster tile +- Add `tileSize` field for raster and raster-dem tile sources +- Update Protomaps Light gallery style to v4 - _...Add new stuff here..._ ### 🐞 Bug fixes diff --git a/cypress/e2e/modals.cy.ts b/cypress/e2e/modals.cy.ts index b14b0175..aade75fe 100644 --- a/cypress/e2e/modals.cy.ts +++ b/cypress/e2e/modals.cy.ts @@ -82,6 +82,21 @@ describe("modals", () => { scheme: "tms", }); }); + + it("add new raster source", () => { + let sourceId = "rastertest"; + when.setValue("modal:sources.add.source_id", sourceId); + when.select("modal:sources.add.source_type", "tile_raster"); + when.select("modal:sources.add.scheme_type", "xyz"); + when.setValue("modal:sources.add.tile_size", "128"); + when.click("modal:sources.add.add_source"); + when.wait(200); + then( + get.styleFromLocalStorage().then((style) => style.sources[sourceId]) + ).shouldInclude({ + tileSize: 128, + }); + }); }); describe("inspect", () => { diff --git a/desktop/Makefile b/desktop/Makefile index 85d30c8c..9ac28eec 100644 --- a/desktop/Makefile +++ b/desktop/Makefile @@ -32,9 +32,9 @@ $(GOBIN)/rice: # Embed the current version number in the executable by writing version.go .PHONY: version.go version.go: - @echo "// DO NOT EDIT: Autogenerated by Makefile\n" > version.go - @echo "package main\n" >> version.go - @echo "const Version = \"$(VERSION)\"" >> version.go + @printf "// DO NOT EDIT: Autogenerated by Makefile\n" > version.go + @printf "package main\n" >> version.go + @printf "const Version = \"$(VERSION)\"\n" >> version.go rice-box.go: $(GOBIN)/rice editor/pull_release $(GOBIN)/rice embed-go diff --git a/package-lock.json b/package-lock.json index ebb9c9bb..a168f7fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3797,9 +3797,9 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "dependencies": { "path-key": "^3.1.0", diff --git a/src/components/ModalSources.tsx b/src/components/ModalSources.tsx index 6884e57e..eabb5a8b 100644 --- a/src/components/ModalSources.tsx +++ b/src/components/ModalSources.tsx @@ -155,10 +155,11 @@ class AddSource extends React.Component { } case 'tile_raster': return { type: 'raster', - tiles: (source as RasterSourceSpecification).tiles || [`${protocol}//localhost:3000/{x}/{y}/{z}.pbf`], + tiles: (source as RasterSourceSpecification).tiles || [`${protocol}//localhost:3000/{x}/{y}/{z}.png`], minzoom: (source as RasterSourceSpecification).minzoom || 0, maxzoom: (source as RasterSourceSpecification).maxzoom || 14, - scheme: (source as RasterSourceSpecification).scheme || 'xyz' + scheme: (source as RasterSourceSpecification).scheme || 'xyz', + tileSize: (source as RasterSourceSpecification).tileSize || 512, } case 'tilejson_raster-dem': return { type: 'raster-dem', @@ -166,9 +167,10 @@ class AddSource extends React.Component { } case 'tilexyz_raster-dem': return { type: 'raster-dem', - tiles: (source as RasterDEMSourceSpecification).tiles || [`${protocol}//localhost:3000/{x}/{y}/{z}.pbf`], + tiles: (source as RasterDEMSourceSpecification).tiles || [`${protocol}//localhost:3000/{x}/{y}/{z}.png`], minzoom: (source as RasterDEMSourceSpecification).minzoom || 0, - maxzoom: (source as RasterDEMSourceSpecification).maxzoom || 14 + maxzoom: (source as RasterDEMSourceSpecification).maxzoom || 14, + tileSize: (source as RasterDEMSourceSpecification).tileSize || 512 } case 'image': return { type: 'image', diff --git a/src/components/ModalSourcesTypeEditor.tsx b/src/components/ModalSourcesTypeEditor.tsx index bc1944bb..da4f7a3c 100644 --- a/src/components/ModalSourcesTypeEditor.tsx +++ b/src/components/ModalSourcesTypeEditor.tsx @@ -308,9 +308,30 @@ class ModalSourcesTypeEditorInternal extends React.Component case 'tile_vector': return case 'tilejson_raster': return - case 'tile_raster': return + case 'tile_raster': return + this.props.onChange({ + ...this.props.source, + tileSize: tileSize + })} + value={this.props.source.tileSize || latest.source_raster.tileSize.default} + data-wd-key="modal:sources.add.tile_size" + /> + case 'tilejson_raster-dem': return case 'tilexyz_raster-dem': return + this.props.onChange({ + ...this.props.source, + tileSize: tileSize + })} + value={this.props.source.tileSize || latest.source_raster_dem.tileSize.default} + data-wd-key="modal:sources.add.tile_size" + />