mirror of
https://github.com/webrecorder/browsertrix-crawler.git
synced 2025-10-19 14:33:17 +00:00
adjust browser viewport to avoid cutting off bottom of page (#614)
- subtract the browser ui height from default viewport computed from screen dimensions - hard-code height to 81px for now - fixes #613, bottom of page being cut-off as viewport height was too big
This commit is contained in:
parent
ff481855d5
commit
ac722cc856
1 changed files with 8 additions and 1 deletions
|
@ -42,6 +42,10 @@ type LaunchOpts = {
|
|||
recording: boolean;
|
||||
};
|
||||
|
||||
// fixed height of the browser UI (may need to be adjusted in the future)
|
||||
// todo: a way to determine this?
|
||||
const BROWSER_HEIGHT_OFFSET = 81;
|
||||
|
||||
// ==================================================================
|
||||
export class Browser {
|
||||
profileDir: string;
|
||||
|
@ -94,7 +98,10 @@ export class Browser {
|
|||
if (process.env.GEOMETRY) {
|
||||
const geom = process.env.GEOMETRY.split("x");
|
||||
|
||||
defaultViewport = { width: Number(geom[0]), height: Number(geom[1]) };
|
||||
defaultViewport = {
|
||||
width: Number(geom[0]),
|
||||
height: Number(geom[1]) - (recording ? 0 : BROWSER_HEIGHT_OFFSET),
|
||||
};
|
||||
}
|
||||
|
||||
const launchOpts: PuppeteerLaunchOptions = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue