From b6e317647a847041c216bfaf3fc88b82c3b64442 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 14 May 2018 13:41:41 +0100 Subject: [PATCH] Fix stickers briefly being 2x the size fixupHeight was the only thing actually fixing the size of the sticker image to be the size we want it rather than the pixel size of the image, and this was only getting run after the image loaded, causing a flash of 2x image. --- src/components/views/messages/MStickerBody.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/components/views/messages/MStickerBody.js b/src/components/views/messages/MStickerBody.js index 501db5e22b..3a412fc2e2 100644 --- a/src/components/views/messages/MStickerBody.js +++ b/src/components/views/messages/MStickerBody.js @@ -107,6 +107,16 @@ export default class MStickerBody extends MImageBody { 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'; // Body 'ref' required by MImageBody @@ -132,6 +142,7 @@ export default class MStickerBody extends MImageBody {