From a75c948e2e2bc3869b0e1707f6993db9ceabfebe Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 21 May 2019 12:24:12 +0200 Subject: [PATCH] don't cache DRP --- src/editor/parts.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/editor/parts.js b/src/editor/parts.js index 59b62a21d5..dd62ff3c7b 100644 --- a/src/editor/parts.js +++ b/src/editor/parts.js @@ -18,8 +18,6 @@ import AutocompleteWrapperModel from "./autocomplete"; import Avatar from "../Avatar"; import MatrixClientPeg from "../MatrixClientPeg"; -const DPR = window.devicePixelRatio; - class BasePart { constructor(text = "") { this._text = text; @@ -252,7 +250,7 @@ export class RoomPillPart extends PillPart { setAvatar(node) { let initialLetter = ""; - let avatarUrl = Avatar.avatarUrlForRoom(this._room, 16 * DPR, 16 * DPR); + let avatarUrl = Avatar.avatarUrlForRoom(this._room, 16 * window.devicePixelRatio, 16 * window.devicePixelRatio); if (!avatarUrl) { initialLetter = Avatar.getInitialLetter(this._room.name); avatarUrl = `../../${Avatar.defaultAvatarUrlForString(this._room.roomId)}`; @@ -278,7 +276,7 @@ export class UserPillPart extends PillPart { setAvatar(node) { const name = this._member.name || this._member.userId; const defaultAvatarUrl = Avatar.defaultAvatarUrlForString(this._member.userId); - let avatarUrl = Avatar.avatarUrlForMember(this._member, 16 * DPR, 16 * DPR); + let avatarUrl = Avatar.avatarUrlForMember(this._member, 16 * window.devicePixelRatio, 16 * window.devicePixelRatio); let initialLetter = ""; if (avatarUrl === defaultAvatarUrl) { // the url from defaultAvatarUrlForString is meant to go in an img element,