From f46a165886eb42723983ffaab88bcb504e118bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 12 Jul 2012 19:49:31 +0200 Subject: [PATCH] loginDialog: Scale focusBin instead of resizing it When setting an explicit size as we do currently, rounding errors (for instance introduced by padding not specified in pixels) may affect the parent's size allocation, e.g. making it shrink or grow each time the size is reset. Rather than taking care of possible rounding errors, set up focusBin to take up the available width and use scaling for the animation. https://bugzilla.gnome.org/show_bug.cgi?id=675076 --- js/gdm/loginDialog.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index 53005b7eb..fb4ad22c6 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -167,8 +167,9 @@ const UserListItem = new Lang.Class({ expand: true }); this._focusBin = new St.Bin({ style_class: 'login-dialog-user-list-item-focus-bin' }); + this._focusBin.scale_gravity = Clutter.Gravity.CENTER; this._verticalBox.add(this._focusBin, - { x_fill: false, + { x_fill: true, x_align: St.Align.MIDDLE, y_fill: false, expand: true }); @@ -256,15 +257,10 @@ const UserListItem = new Lang.Class({ showFocusAnimation: function(time) { let hold = new Batch.Hold(); - let node = this.actor.get_theme_node(); - let padding = node.get_horizontal_padding(); - - let box = this._verticalBox.get_allocation_box(); - Tweener.removeTweens(this._focusBin); - this._focusBin.width = 0; + this._focusBin.scale_x = 0.; Tweener.addTween(this._focusBin, - { width: (box.x2 - box.x1 - padding), + { scale_x: 1., time: time, transition: 'linear', onComplete: function() { @@ -370,7 +366,7 @@ const UserList = new Lang.Class({ let item = this._items[userName]; item.actor.can_focus = false; - item._focusBin.width = 0; + item._focusBin.scale_x = 0.; if (item != exception) tasks.push(function() { return _fadeOutActor(item.actor);