Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Wentao-Kuang committed Jul 18, 2024
1 parent 0ed4533 commit 71bcbcf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
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.7.0-2-g99b800e --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
35 changes: 18 additions & 17 deletions packages/landing/src/components/debug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,18 @@ export class Debug extends Component<{ map: maplibregl.Map }, DebugState> {

if (Config.map.debug['debug.screenshot']) {
async function addLoadedDiv(): Promise<void> {
// Ensure hillshade source is loaded
const hillShadeSourceId = `${HillShadePrefix}${Config.map.debug['debug.hillshade']}`;
if (Config.map.debug['debug.hillshade']) {
if (map.getSource(hillShadeSourceId) == null) return;
if (!map.isSourceLoaded(hillShadeSourceId)) return;
}
// Ensure terrain source is loaded
if (Config.map.debug['debug.terrain']) {
if (map.getSource(Config.map.debug['debug.terrain']) == null) return;
if (!map.isSourceLoaded(Config.map.debug['debug.terrain'])) return;
}
// Ensure the attribution data has loaded
// // Ensure hillshade source is loaded
// const hillShadeSourceId = `${HillShadePrefix}${Config.map.debug['debug.hillshade']}`;
// if (Config.map.debug['debug.hillshade']) {
// if (map.getSource(hillShadeSourceId) == null) return;
// if (!map.isSourceLoaded(hillShadeSourceId)) return;
// }
// // Ensure terrain source is loaded
// if (Config.map.debug['debug.terrain']) {
// if (map.getSource(Config.map.debug['debug.terrain']) == null) return;
// if (!map.isSourceLoaded(Config.map.debug['debug.terrain'])) return;
// }
// // Ensure the attribution data has loaded
await MapAttrState.getCurrentAttribution();
await new Promise((r) => setTimeout(r, 250));
// Jam a div into the page once the map has loaded so tools like playwright can see the map has finished loading
Expand All @@ -129,12 +129,13 @@ export class Debug extends Component<{ map: maplibregl.Map }, DebugState> {
document.body.appendChild(loadedDiv);
}

void map.on('sourcedata', (e) => {
if (e.source.type !== 'raster-dem') return;
void addLoadedDiv();
});
// void map.on('sourcedata', (e) => {
// if (e.source.type !== 'raster-dem') return;
// void addLoadedDiv();
// });

void map.on('idle', () => {
void map.once('idle', () => {
// Ensure hillshade and terrain source is loaded
this.updateFromConfig();
void addLoadedDiv();
});
Expand Down

0 comments on commit 71bcbcf

Please sign in to comment.