Skip to content

Commit

Permalink
Add the ability to screenshot a part of the screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie5 committed Apr 12, 2023
1 parent ffab460 commit 2a544d5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/storycap/src/node/capturing-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ export class CapturingBrowser extends StoryPreviewBrowser {
fullPage: emittedScreenshotOptions.fullPage,
omitBackground: emittedScreenshotOptions.omitBackground,
captureBeyondViewport: emittedScreenshotOptions.captureBeyondViewport,
clip: emittedScreenshotOptions.clip ?? undefined,
});

let buffer: Buffer | null = null;
Expand Down
1 change: 1 addition & 0 deletions packages/storycap/src/shared/screenshot-options-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const defaultScreenshotOptions = {
variants: {},
omitBackground: false,
captureBeyondViewport: true,
clip: null,
} as const;

/**
Expand Down
1 change: 1 addition & 0 deletions packages/storycap/src/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface ScreenshotOptionFragments {
skip?: boolean;
omitBackground?: boolean;
captureBeyondViewport?: boolean;
clip?: { x: number; y: number; width: number; height: number } | null;
}

export interface ScreenshotOptionFragmentsForVariant extends ScreenshotOptionFragments {
Expand Down

0 comments on commit 2a544d5

Please sign in to comment.