[sushi] main-window: position the toolbar with a bottom margin
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sushi] main-window: position the toolbar with a bottom margin
- Date: Fri, 20 Apr 2012 00:40:40 +0000 (UTC)
commit 02979228e29973a92280330bebbfde98a0fd9e13
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Apr 19 20:36:41 2012 -0400
main-window: position the toolbar with a bottom margin
Instead of using a constraint; also refactor MainGroup to be just a
ClutterActor, using a bin layout to position the children.
src/js/ui/mainWindow.js | 25 +++++++++----------------
src/js/util/constants.js | 2 +-
2 files changed, 10 insertions(+), 17 deletions(-)
---
diff --git a/src/js/ui/mainWindow.js b/src/js/ui/mainWindow.js
index ff9945b..b182192 100644
--- a/src/js/ui/mainWindow.js
+++ b/src/js/ui/mainWindow.js
@@ -116,7 +116,9 @@ MainWindow.prototype = {
green: 0,
blue: 0,
alpha: 255 }));
- this._mainGroup = new Clutter.Group();
+
+ this._mainLayout = new Clutter.BinLayout();
+ this._mainGroup = new Clutter.Actor({ layout_manager: this._mainLayout });
this._stage.add_actor(this._mainGroup);
this._mainGroup.set_opacity(0);
},
@@ -147,7 +149,7 @@ MainWindow.prototype = {
new Clutter.BindConstraint({ source: this._stage,
coordinate: Clutter.BindCoordinate.SIZE }));
- this._mainGroup.add_actor(this._background);
+ this._mainGroup.add_child(this._background);
this._background.lower_bottom();
},
@@ -173,7 +175,7 @@ MainWindow.prototype = {
new Clutter.BindConstraint({ source: this._stage,
coordinate: Clutter.BindCoordinate.SIZE }));
- this._mainGroup.add_actor(this._background);
+ this._mainGroup.add_child(this._background);
this._background.lower_bottom();
},
@@ -361,7 +363,7 @@ MainWindow.prototype = {
this._texture.add_constraint(this._textureYAlign);
this.refreshSize();
- this._mainGroup.add_actor(this._texture);
+ this._mainGroup.add_child(this._texture);
},
/**************************************************************************
@@ -519,22 +521,13 @@ MainWindow.prototype = {
this._toolbarActor.set_reactive(true);
this._toolbarActor.set_opacity(0);
- this._mainGroup.add_actor(this._toolbarActor);
-
this._toolbarActor.add_constraint(
new Clutter.AlignConstraint({ source: this._stage,
factor: 0.5 }));
- let yConstraint =
- new Clutter.BindConstraint({ source: this._stage,
- coordinate: Clutter.BindCoordinate.Y,
- offset: this._stage.height - Constants.TOOLBAR_SPACING });
- this._toolbarActor.add_constraint(yConstraint);
-
- this._stage.connect('notify::height',
- Lang.bind(this, function() {
- yConstraint.set_offset(this._stage.height - Constants.TOOLBAR_SPACING);
- }));
+ this._toolbarActor.margin_bottom = Constants.TOOLBAR_SPACING;
+ this._mainLayout.add(this._toolbarActor,
+ Clutter.BinAlignment.FIXED, Clutter.BinAlignment.END);
},
_removeToolbarTimeout: function() {
diff --git a/src/js/util/constants.js b/src/js/util/constants.js
index dfebe20..408bbbe 100644
--- a/src/js/util/constants.js
+++ b/src/js/util/constants.js
@@ -31,4 +31,4 @@ let VIEW_PADDING_Y = 28;
let VIEW_PADDING_X = 2;
let VIEW_MAX_W = 800;
let VIEW_MAX_H = 600;
-let TOOLBAR_SPACING = 60;
+let TOOLBAR_SPACING = 32;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]