From 3715109ebe26ed1c7b037aef611cf157773ef7a7 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 27 Apr 2010 09:46:19 -0400 Subject: [PATCH] [panel] Fix allocation positioning for boxes This change doesn't actually affect anything visibly, but using the absolute coordinates of our allocation box in allocate() is wrong; we should be positioning our children at 0,0 and using width/height as a reference. https://bugzilla.gnome.org/show_bug.cgi?id=616951 --- js/ui/panel.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/js/ui/panel.js b/js/ui/panel.js index 31007fbf1..5485d3061 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -310,34 +310,34 @@ Panel.prototype = { let x; let childBox = new Clutter.ActorBox(); - childBox.x1 = box.x1; - childBox.y1 = box.y1; + childBox.x1 = 0; + childBox.y1 = 0; childBox.x2 = x = childBox.x1 + leftWidth; - childBox.y2 = box.y2; + childBox.y2 = allocHeight; this._leftBox.allocate(childBox, flags); - let centerNaturalX = Math.floor((box.x2 - box.x1) / 2 - (centerWidth / 2)); + let centerNaturalX = Math.floor(allocWidth / 2 - (centerWidth / 2)); /* Check left side */ if (x < centerNaturalX) { /* We didn't overflow the left, use the natural. */ x = centerNaturalX; } /* Check right side */ - if (x + centerWidth > (box.x2 - rightWidth)) { - x = box.x2 - rightWidth - centerWidth; + if (x + centerWidth > (allocWidth - rightWidth)) { + x = allocWidth - rightWidth - centerWidth; } childBox = new Clutter.ActorBox(); childBox.x1 = x; - childBox.y1 = box.y1; + childBox.y1 = 0; childBox.x2 = x = childBox.x1 + centerWidth; - childBox.y2 = box.y2; + childBox.y2 = allocHeight; this._centerBox.allocate(childBox, flags); childBox = new Clutter.ActorBox(); - childBox.x1 = box.x2 - rightWidth; - childBox.y1 = box.y1; - childBox.x2 = box.x2; - childBox.y2 = box.y2; + childBox.x1 = allocWidth - rightWidth; + childBox.y1 = 0; + childBox.x2 = allocWidth; + childBox.y2 = allocHeight; this._rightBox.allocate(childBox, flags); }));