mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-22 16:46:28 +01:00
Another aspect ratio style fix
This commit is contained in:
parent
88accb2a78
commit
1887a34fc5
2 changed files with 15 additions and 6 deletions
|
@ -116,12 +116,16 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
|||
if (smaller) setImageSmallerThanParent(smaller);
|
||||
}, [width, height]);
|
||||
|
||||
const maxAspectHeight = window.innerHeight * 0.33;
|
||||
const maxAspectHeight =
|
||||
window.innerHeight * (orientation === 'portrait' ? 0.45 : 0.33);
|
||||
const maxHeight = orientation === 'portrait' ? 0 : 160;
|
||||
const mediaStyles = {
|
||||
'--width': `${width}px`,
|
||||
'--height': `${height}px`,
|
||||
// Calculate '--aspectWidth' based on aspect ratio calculated from '--width' and '--height', max height has to be 160px
|
||||
'--aspectWidth': `${(width / height) * Math.max(160, maxAspectHeight)}px`,
|
||||
'--aspectWidth': `${
|
||||
(width / height) * Math.max(maxHeight, maxAspectHeight)
|
||||
}px`,
|
||||
aspectRatio: `${width} / ${height}`,
|
||||
};
|
||||
|
||||
|
|
|
@ -618,16 +618,21 @@
|
|||
max-height: min(var(--height), 33vh);
|
||||
}
|
||||
.status .media-container.media-eq1 .media[data-orientation='portrait'] {
|
||||
width: auto;
|
||||
/* width: auto;
|
||||
height: min(var(--height), 45vh);
|
||||
max-height: none;
|
||||
max-height: none; */
|
||||
max-height: min(var(--height), 45vh);
|
||||
}
|
||||
.status.large .media-container.media-eq1 {
|
||||
max-height: min(var(--height), 60vh);
|
||||
}
|
||||
.status.large .media-container.media-eq1 .media[data-orientation='portrait'] {
|
||||
height: min(var(--height), 60vh);
|
||||
.status.large .media-container.media-eq1 .media {
|
||||
width: min(var(--width), 100%);
|
||||
max-height: min(var(--height), 80vh);
|
||||
}
|
||||
/* .status.large .media-container.media-eq1 .media[data-orientation='portrait'] {
|
||||
height: min(var(--height), 60vh);
|
||||
} */
|
||||
.status-carousel .status .media-container.media-eq1 .media {
|
||||
width: min(var(--width), 100%);
|
||||
height: auto;
|
||||
|
|
Loading…
Reference in a new issue