Skip to content

Commit

Permalink
fix: fix diff bubbles in side-by-side fit screen mode (#614)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowusr authored Nov 14, 2024
1 parent f70e78b commit 569d4a2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@

.image {
max-height: max(var(--desired-height), calc(var(--natural-height) * 1px / 2));
width: var(--img-width);
height: var(--img-height);
}
4 changes: 3 additions & 1 deletion lib/static/new-ui/components/DiffViewer/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import {ImageSize} from '@/types';

export const getImageSizeCssVars = (size: ImageSize): React.CSSProperties => ({
'--natural-width': size.width,
'--natural-height': size.height
'--natural-height': size.height,
'--img-width': size.width > size.height ? '100%' : 'auto',
'--img-height': size.width > size.height ? 'auto' : '100%'
} as React.CSSProperties);

export const getDisplayedDiffPercentValue = (diffRatio: number): string => {
Expand Down
4 changes: 1 addition & 3 deletions lib/static/new-ui/components/Screenshot/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

.image {
aspect-ratio: var(--natural-width) / var(--natural-height);
max-width: calc(var(--natural-width) * 1px);
max-width: calc(min(var(--natural-width) * 1px, 100%));
width: 100%;
object-fit: contain;
object-position: top left;
filter: drop-shadow(1px 0 0 #ccc) drop-shadow(-1px 0 0 #ccc) drop-shadow(0 1px 0 #ccc) drop-shadow(0 -1px 0 #ccc);
}

0 comments on commit 569d4a2

Please sign in to comment.