mirror of https://github.com/vector-im/riot-web
Merge pull request #1899 from matrix-org/dbkr/dbkr/fix_sticker_size_jumping_2
Fix stickers briefly being 2x the sizepull/21833/head
commit
3d176f7105
|
@ -107,6 +107,16 @@ export default class MStickerBody extends MImageBody {
|
||||||
placeholderFixupHeight = content.info.h + 'px';
|
placeholderFixupHeight = content.info.h + 'px';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The pixel size of sticker images is generally larger than their intended display
|
||||||
|
// size so they render at native reolution on HiDPI displays. We therefore need to
|
||||||
|
// explicity set the size so they render at the intended size.
|
||||||
|
// XXX: This will be clobberred when we run fixupHeight(), but we need to do it
|
||||||
|
// here otherwise the stickers are momentarily displayed at the pixel size.
|
||||||
|
const imageStyle = {
|
||||||
|
height: content.info.h,
|
||||||
|
// leave the browser the calculate the width automatically
|
||||||
|
};
|
||||||
|
|
||||||
placeholderSize = placeholderSize + 'px';
|
placeholderSize = placeholderSize + 'px';
|
||||||
|
|
||||||
// Body 'ref' required by MImageBody
|
// Body 'ref' required by MImageBody
|
||||||
|
@ -132,6 +142,7 @@ export default class MStickerBody extends MImageBody {
|
||||||
<img
|
<img
|
||||||
className={'mx_MStickerBody_image ' + this.state.imageClasses}
|
className={'mx_MStickerBody_image ' + this.state.imageClasses}
|
||||||
src={contentUrl}
|
src={contentUrl}
|
||||||
|
style={imageStyle}
|
||||||
ref='image'
|
ref='image'
|
||||||
alt={content.body}
|
alt={content.body}
|
||||||
onLoad={this._onImageLoad}
|
onLoad={this._onImageLoad}
|
||||||
|
|
Loading…
Reference in New Issue