Skip to content

Commit

Permalink
optimised the tile styling
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Sep 29, 2024
1 parent d6dafd5 commit 408e1f2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dist/*",
"src/"
],
"version": "0.0.17",
"version": "0.0.18",
"scripts": {
"test": "jest .",
"lint": "eslint src --fix && tsc --noEmit && prettier --write .",
Expand Down
2 changes: 1 addition & 1 deletion src/IndoorLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class IndoorLayer {

_closestMap() {
// TODO enhance this condition
if (this._map.getZoom() < 17) {
if (this._map.getZoom() < 16.5) {
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions src/MapServerHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type RemoteMap = {
url: string;
};

const MIN_ZOOM_TO_DOWNLOAD = 16.5;
const MIN_ZOOM_TO_DOWNLOAD = 16.25;
const MIN_DISTANCE_TO_DOWNLOAD_METERS = 200;

class MapServerHandler {
Expand Down Expand Up @@ -89,7 +89,7 @@ class MapServerHandler {
viewPort.getSouthEast().toArray(),
{ units: "meters" },
);
// It is not necessary to compute others as we are at zoom >= 17, the approximation is enough.
// It is not necessary to compute others as we are at zoom >= 16.25, the approximation is enough.
const maxXYViewportDistanceMeters =
Math.max(distanceEastWestMeters, distanceNorthSouthMeters) / 2;
const verticalDistanceMeters = Math.max(
Expand Down
1 change: 0 additions & 1 deletion src/style/Layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const OSM_FILTER_MAPBOX_MAKI_LIST: FilterMakiEntry[] = [
maki: "bank",
},
{ filter: ["==", ["get", "natural"], "tree"], maki: "park" },
{ filter: ["==", ["get", "highway"], "steps"], maki: "entrance" },
...OSM_SHOPS.map(
({ maki, shop }) =>
({ filter: ["==", ["get", "shop"], shop], maki }) as FilterMakiEntry,
Expand Down
21 changes: 16 additions & 5 deletions src/style/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,17 @@ export const defaultLayers: Array<LayerSpecification> = [
["*", 2, ["^", 2, 3]],
],
},
paint: {
"icon-opacity": [
"interpolate",
["linear"],
["zoom"],
16.5,
0,
18,
1
],
},
source: "indoor",
type: "symbol",
},
Expand Down Expand Up @@ -777,9 +788,9 @@ export const defaultLayers: Array<LayerSpecification> = [
"interpolate",
["linear"],
["zoom"],
17,
18,
0,
17.5,
18.5,
0.5,
19,
1,
Expand Down Expand Up @@ -828,15 +839,15 @@ export const defaultLayers: Array<LayerSpecification> = [
],
"icon-size": ["interpolate", ["linear"], ["zoom"], 17, 0.5, 20, 1],
},
minzoom: 17,
minzoom: 18,
paint: {
"icon-opacity": [
"interpolate",
["linear"],
["zoom"],
17,
18,
0,
17.5,
18.5,
0.5,
19,
1,
Expand Down

0 comments on commit 408e1f2

Please sign in to comment.