Skip to content

Commit

Permalink
Initial sprite generation code. [#238, #167] (#243)
Browse files Browse the repository at this point in the history
* Initial sprite generation code. [#238, #167]

* update townspot themes [#167]

* support 1x and 2x ratios

* pin pmtiles dependency; fix style diffing when changing themes
  • Loading branch information
bdon authored May 8, 2024
1 parent ea39589 commit 1f03a4b
Show file tree
Hide file tree
Showing 15 changed files with 1,870 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"maplibre-gl": "^4.1.3",
"pixelmatch": "^5.3.0",
"pmtiles": "^3.0.5",
"pmtiles": "3.0.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
Expand Down
10 changes: 2 additions & 8 deletions app/src/MapViewComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ function getMaplibreStyle(
} else {
style.layers = style.layers.concat(layers("protomaps", theme));
}

return style;
}

Expand Down Expand Up @@ -174,12 +173,7 @@ function MapLibreView(props: {
const map = new maplibregl.Map({
hash: "map",
container: "map",
style: getMaplibreStyle(
props.theme,
props.localSprites,
props.tiles,
props.npmLayers,
),
style: getMaplibreStyle("", false),
});

map.addControl(new maplibregl.NavigationControl());
Expand Down Expand Up @@ -223,7 +217,7 @@ function MapLibreView(props: {
maplibregl.removeProtocol("pmtiles");
map.remove();
};
}, [props.npmLayers, props.theme, props.tiles, props.localSprites]);
}, []);

useEffect(() => {
if (protocolRef.current) {
Expand Down
3 changes: 3 additions & 0 deletions sprites/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/*.png
dist/*.json
target
Loading

0 comments on commit 1f03a4b

Please sign in to comment.