userWidget: Handle non-square icons gracefully
We currently assume that user icons are square, which is the case when set by the users settings panel, but not enforced by AccountsService. Handle that case by moving the pixel size back to the actor and using an appropriate background-size style property of 'cover' (which means the smallest dimension of the image is scaled to fit the desired size). https://gitlab.gnome.org/GNOME/gnome-shell/issues/1144
This commit is contained in:
parent
007d305736
commit
5fc456d9d9
@ -46,9 +46,13 @@ var Avatar = class {
|
|||||||
|
|
||||||
if (iconFile) {
|
if (iconFile) {
|
||||||
this.actor.child = null;
|
this.actor.child = null;
|
||||||
|
let { scaleFactor } = St.ThemeContext.get_for_stage(global.stage);
|
||||||
|
this.actor.set_size(
|
||||||
|
this._iconSize * scaleFactor,
|
||||||
|
this._iconSize * scaleFactor);
|
||||||
this.actor.style = `
|
this.actor.style = `
|
||||||
background-image: url("${iconFile}");
|
background-image: url("${iconFile}");
|
||||||
background-size: ${this._iconSize}px`;
|
background-size: cover;`;
|
||||||
} else {
|
} else {
|
||||||
this.actor.style = null;
|
this.actor.style = null;
|
||||||
this.actor.child = new St.Icon({ icon_name: 'avatar-default-symbolic',
|
this.actor.child = new St.Icon({ icon_name: 'avatar-default-symbolic',
|
||||||
|
Loading…
Reference in New Issue
Block a user