Improved support for images with extreme ratios

This commit is contained in:
Scott Nonnenberg 2020-09-23 09:07:27 -07:00 committed by GitHub
parent 04d3769bd4
commit 4e223def29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 5 deletions

View File

@ -56,6 +56,7 @@ const styles = {
display: 'flex',
flexDirection: 'column',
outline: 'none',
width: '100%',
padding: 0,
} as React.CSSProperties,
mainContainer: {
@ -84,6 +85,18 @@ const styles = {
objectFit: 'contain',
outline: 'none',
} as React.CSSProperties,
img: {
position: 'absolute',
left: '50%',
top: '50%',
transform: 'translate(-50%, -50%)',
width: 'auto',
height: 'auto',
maxWidth: '100%',
maxHeight: '100%',
objectFit: 'contain',
outline: 'none',
} as React.CSSProperties,
caption: {
position: 'absolute',
bottom: 0,
@ -361,7 +374,7 @@ export class Lightbox extends React.Component<Props, State> {
>
<img
alt={i18n('lightboxImageAlt')}
style={styles.object}
style={styles.img}
src={objectURL}
/>
</button>

View File

@ -12951,7 +12951,7 @@
"rule": "React-createRef",
"path": "ts/components/Lightbox.js",
"line": " this.containerRef = react_1.default.createRef();",
"lineNumber": 148,
"lineNumber": 161,
"reasonCategory": "usageTrusted",
"updated": "2019-11-06T19:56:38.557Z",
"reasonDetail": "Used to double-check outside clicks"
@ -12960,7 +12960,7 @@
"rule": "React-createRef",
"path": "ts/components/Lightbox.js",
"line": " this.videoRef = react_1.default.createRef();",
"lineNumber": 149,
"lineNumber": 162,
"reasonCategory": "usageTrusted",
"updated": "2020-09-14T23:03:44.863Z"
},
@ -12968,7 +12968,7 @@
"rule": "React-createRef",
"path": "ts/components/Lightbox.js",
"line": " this.focusRef = react_1.default.createRef();",
"lineNumber": 150,
"lineNumber": 163,
"reasonCategory": "usageTrusted",
"updated": "2019-11-06T19:56:38.557Z",
"reasonDetail": "Used to manage focus"
@ -13327,4 +13327,4 @@
"reasonCategory": "falseMatch",
"updated": "2020-09-08T23:07:22.682Z"
}
]
]