Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Enable 3d screenshots in the basemaps. BM-1054 #3317

Merged
merged 20 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/screenshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
# Wait for the server to start
timeout 30 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:5000/v1/version)" != "200" ]]; do sleep 0.5; done' || false

docker run --rm --network="host" -v $PWD:$PWD ghcr.io/linz/basemaps-screenshot/cli:v1.5.0 --url http://localhost:5000 --output $PWD/.artifacts/visual-snapshots
docker run --rm --network="host" -v $PWD:$PWD ghcr.io/linz/basemaps-screenshot/cli:v1 --url http://localhost:5000 --output $PWD/.artifacts/visual-snapshots

- name: Save snapshots
uses: getsentry/action-visual-snapshot@v2
Expand Down
14 changes: 11 additions & 3 deletions packages/landing/src/components/debug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,17 @@ export class Debug extends Component<{ map: maplibregl.Map }, DebugState> {
loadedDiv.style.height = '1px';
document.body.appendChild(loadedDiv);
}

void map.once('idle', () => {
void addLoadedDiv();
const isTerrainOn = Config.map.debug['debug.terrain'] != null && Config.map.debug['debug.terrain'] !== 'off';
const isHSOn = Config.map.debug['debug.hillshade'] != null && Config.map.debug['debug.hillshade'] !== 'off';
if (isTerrainOn || isHSOn) {
// Ensure hillshade and terrain source is loaded and wait for 2s
this.updateFromConfig();
setTimeout(() => void addLoadedDiv(), 2000);
} else {
void addLoadedDiv();
}
});
}
});
Expand Down Expand Up @@ -321,7 +330,6 @@ export class Debug extends Component<{ map: maplibregl.Map }, DebugState> {
if (currentLayer) map.removeLayer(HillShadeLayerId);
return;
}

if (currentLayer?.source === sourceId) return;

// Hillshading from an existing raster-dem source gives very mixed results and looks very blury
Expand Down Expand Up @@ -479,7 +487,7 @@ export class Debug extends Component<{ map: maplibregl.Map }, DebugState> {
);
}

getSourcesIds(type: string): string[] {
getSourcesIds(type: 'raster' | 'raster-dem'): string[] {
const style = this.props.map.getStyle();
if (type === 'raster-dem') {
return Object.keys(style.sources).filter(
Expand Down
Loading