Make avatars in pills occupy the entire space using cropping
Signed-off-by: Sergey Shpikin <rkfg@rkfg.me>
This commit is contained in:
parent
a3f4244dc0
commit
a97a3cea51
1 changed files with 7 additions and 2 deletions
|
@ -252,7 +252,11 @@ class RoomPillPart extends PillPart {
|
||||||
|
|
||||||
setAvatar(node) {
|
setAvatar(node) {
|
||||||
let initialLetter = "";
|
let initialLetter = "";
|
||||||
let avatarUrl = Avatar.avatarUrlForRoom(this._room, 16 * window.devicePixelRatio, 16 * window.devicePixelRatio);
|
let avatarUrl = Avatar.avatarUrlForRoom(
|
||||||
|
this._room,
|
||||||
|
16 * window.devicePixelRatio,
|
||||||
|
16 * window.devicePixelRatio,
|
||||||
|
"crop");
|
||||||
if (!avatarUrl) {
|
if (!avatarUrl) {
|
||||||
initialLetter = Avatar.getInitialLetter(this._room ? this._room.name : this.resourceId);
|
initialLetter = Avatar.getInitialLetter(this._room ? this._room.name : this.resourceId);
|
||||||
avatarUrl = `../../${Avatar.defaultAvatarUrlForString(this._room ? this._room.roomId : this.resourceId)}`;
|
avatarUrl = `../../${Avatar.defaultAvatarUrlForString(this._room ? this._room.roomId : this.resourceId)}`;
|
||||||
|
@ -290,7 +294,8 @@ class UserPillPart extends PillPart {
|
||||||
let avatarUrl = Avatar.avatarUrlForMember(
|
let avatarUrl = Avatar.avatarUrlForMember(
|
||||||
this._member,
|
this._member,
|
||||||
16 * window.devicePixelRatio,
|
16 * window.devicePixelRatio,
|
||||||
16 * window.devicePixelRatio);
|
16 * window.devicePixelRatio,
|
||||||
|
"crop");
|
||||||
let initialLetter = "";
|
let initialLetter = "";
|
||||||
if (avatarUrl === defaultAvatarUrl) {
|
if (avatarUrl === defaultAvatarUrl) {
|
||||||
// the url from defaultAvatarUrlForString is meant to go in an img element,
|
// the url from defaultAvatarUrlForString is meant to go in an img element,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue