Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 3d176f7

Browse files
authored
Merge pull request #1899 from matrix-org/dbkr/dbkr/fix_sticker_size_jumping_2
Fix stickers briefly being 2x the size
2 parents ac297d1 + b6e3176 commit 3d176f7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/components/views/messages/MStickerBody.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ export default class MStickerBody extends MImageBody {
107107
placeholderFixupHeight = content.info.h + 'px';
108108
}
109109

110+
// The pixel size of sticker images is generally larger than their intended display
111+
// size so they render at native reolution on HiDPI displays. We therefore need to
112+
// explicity set the size so they render at the intended size.
113+
// XXX: This will be clobberred when we run fixupHeight(), but we need to do it
114+
// here otherwise the stickers are momentarily displayed at the pixel size.
115+
const imageStyle = {
116+
height: content.info.h,
117+
// leave the browser the calculate the width automatically
118+
};
119+
110120
placeholderSize = placeholderSize + 'px';
111121

112122
// Body 'ref' required by MImageBody
@@ -132,6 +142,7 @@ export default class MStickerBody extends MImageBody {
132142
<img
133143
className={'mx_MStickerBody_image ' + this.state.imageClasses}
134144
src={contentUrl}
145+
style={imageStyle}
135146
ref='image'
136147
alt={content.body}
137148
onLoad={this._onImageLoad}

0 commit comments

Comments
 (0)