diff --git a/res/css/views/messages/_MImageBody.scss b/res/css/views/messages/_MImageBody.scss index 0a199c1f45..f5d8131e6e 100644 --- a/res/css/views/messages/_MImageBody.scss +++ b/res/css/views/messages/_MImageBody.scss @@ -21,11 +21,7 @@ $timelineImageBorderRadius: 4px; } .mx_MImageBody_thumbnail { - position: absolute; - width: 100%; - height: 100%; - left: 0; - top: 0; + object-fit: contain; border-radius: $timelineImageBorderRadius; display: flex; diff --git a/src/components/views/messages/MImageBody.tsx b/src/components/views/messages/MImageBody.tsx index 81b6cd634a..e641582962 100644 --- a/src/components/views/messages/MImageBody.tsx +++ b/src/components/views/messages/MImageBody.tsx @@ -361,8 +361,6 @@ export default class MImageBody extends React.Component { const thumbnail = (
- { /* Calculate aspect ratio, using %padding will size _container correctly */ } -
{ showPlaceholder &&
{ ev.preventDefault(); if (!this.state.showImage) { this.showImage(); } - } + }; // MStickerBody doesn't need a wrapping ``, but it does need extra padding // which is added by mx_MStickerBody_wrapper - wrapImage(contentUrl, children) { + protected wrapImage(contentUrl: string, children: React.ReactNode): JSX.Element { let onClick = null; if (!this.state.showImage) { onClick = this.onClick; @@ -42,13 +42,13 @@ export default class MStickerBody extends MImageBody { // Placeholder to show in place of the sticker image if // img onLoad hasn't fired yet. - getPlaceholder(width, height) { + protected getPlaceholder(width: number, height: number): JSX.Element { if (this.props.mxEvent.getContent().info[BLURHASH_FIELD]) return super.getPlaceholder(width, height); return ; } // Tooltip to show on mouse over - getTooltip() { + protected getTooltip(): JSX.Element { const content = this.props.mxEvent && this.props.mxEvent.getContent(); if (!content || !content.body || !content.info || !content.info.w) return null; @@ -60,7 +60,7 @@ export default class MStickerBody extends MImageBody { } // Don't show "Download this_file.png ..." - getFileBody() { + protected getFileBody() { return null; } }