Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

bug/fix-screenshot-image-cutt-off-bug #5

Merged
merged 4 commits into from
Jun 26, 2020

Conversation

adrianrivers
Copy link
Contributor

What's changed and why

  • Get margin top and margin bottom of element in order to adjust clip path, getBoundingClientRect retrieves the elements dimensions plus padding, some of our elements rely on margins to be displayed correctly hence why some of the screenshots were cut off at the bottom.
  • Add stories to test large elements with padding and margins

Adjusts the clip path to start at the margin top of the element

y: Math.ceil(top - marginTop),

Adjusts the clip path to take a screenshot of the full height of the element including its margins

height: Math.ceil(height + marginTop + marginBottom),

@adrianrivers adrianrivers requested a review from mkai June 25, 2020 11:39
@adrianrivers adrianrivers changed the title Fix cut off screenshot issue, add large element stories for all viewp… bug/fix-screenshot-image-cutt-off-bug Jun 25, 2020
Copy link
Collaborator

@preventdefault preventdefault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@adrianrivers adrianrivers merged commit 7ca95d3 into master Jun 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants