mirror of
https://github.com/maputnik/editor.git
synced 2026-06-29 10:37:37 +00:00
Add tileSize field for raster and raster-dem tile sources (#946)
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
- Add german translation
|
- Add german translation
|
||||||
- Use same version number for web and desktop versions
|
- Use same version number for web and desktop versions
|
||||||
- Add scheme type options for vector/raster tile
|
- Add scheme type options for vector/raster tile
|
||||||
|
- Add `tileSize` field for raster and raster-dem tile sources
|
||||||
- _...Add new stuff here..._
|
- _...Add new stuff here..._
|
||||||
|
|
||||||
### 🐞 Bug fixes
|
### 🐞 Bug fixes
|
||||||
|
|||||||
@@ -82,6 +82,21 @@ describe("modals", () => {
|
|||||||
scheme: "tms",
|
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", () => {
|
describe("inspect", () => {
|
||||||
|
|||||||
@@ -158,7 +158,8 @@ class AddSource extends React.Component<AddSourceProps, AddSourceState> {
|
|||||||
tiles: (source as RasterSourceSpecification).tiles || [`${protocol}//localhost:3000/{x}/{y}/{z}.pbf`],
|
tiles: (source as RasterSourceSpecification).tiles || [`${protocol}//localhost:3000/{x}/{y}/{z}.pbf`],
|
||||||
minzoom: (source as RasterSourceSpecification).minzoom || 0,
|
minzoom: (source as RasterSourceSpecification).minzoom || 0,
|
||||||
maxzoom: (source as RasterSourceSpecification).maxzoom || 14,
|
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 {
|
case 'tilejson_raster-dem': return {
|
||||||
type: 'raster-dem',
|
type: 'raster-dem',
|
||||||
@@ -168,7 +169,8 @@ class AddSource extends React.Component<AddSourceProps, AddSourceState> {
|
|||||||
type: 'raster-dem',
|
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}.pbf`],
|
||||||
minzoom: (source as RasterDEMSourceSpecification).minzoom || 0,
|
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 {
|
case 'image': return {
|
||||||
type: 'image',
|
type: 'image',
|
||||||
|
|||||||
@@ -308,9 +308,30 @@ class ModalSourcesTypeEditorInternal extends React.Component<ModalSourcesTypeEdi
|
|||||||
case 'tilejson_vector': return <TileJSONSourceEditor {...commonProps} />
|
case 'tilejson_vector': return <TileJSONSourceEditor {...commonProps} />
|
||||||
case 'tile_vector': return <TileURLSourceEditor {...commonProps} />
|
case 'tile_vector': return <TileURLSourceEditor {...commonProps} />
|
||||||
case 'tilejson_raster': return <TileJSONSourceEditor {...commonProps} />
|
case 'tilejson_raster': return <TileJSONSourceEditor {...commonProps} />
|
||||||
case 'tile_raster': return <TileURLSourceEditor {...commonProps} />
|
case 'tile_raster': return <TileURLSourceEditor {...commonProps}>
|
||||||
|
<FieldNumber
|
||||||
|
label={t("Tile Size")}
|
||||||
|
fieldSpec={latest.source_raster.tileSize}
|
||||||
|
onChange={tileSize => 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"
|
||||||
|
/>
|
||||||
|
</TileURLSourceEditor>
|
||||||
case 'tilejson_raster-dem': return <TileJSONSourceEditor {...commonProps} />
|
case 'tilejson_raster-dem': return <TileJSONSourceEditor {...commonProps} />
|
||||||
case 'tilexyz_raster-dem': return <TileURLSourceEditor {...commonProps}>
|
case 'tilexyz_raster-dem': return <TileURLSourceEditor {...commonProps}>
|
||||||
|
<FieldNumber
|
||||||
|
label={t("Tile Size")}
|
||||||
|
fieldSpec={latest.source_raster_dem.tileSize}
|
||||||
|
onChange={tileSize => 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"
|
||||||
|
/>
|
||||||
<FieldSelect
|
<FieldSelect
|
||||||
label={t("Encoding")}
|
label={t("Encoding")}
|
||||||
fieldSpec={latest.source_raster_dem.encoding}
|
fieldSpec={latest.source_raster_dem.encoding}
|
||||||
|
|||||||
Reference in New Issue
Block a user