[gnome-boxes] revealer: learn to resize actor allocation too
- From: Marc-Andre Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] revealer: learn to resize actor allocation too
- Date: Thu, 9 Aug 2012 12:01:48 +0000 (UTC)
commit 495126ed2f39b7af39517f0449555f86232bdaf0
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date: Wed Jul 25 23:02:31 2012 +0200
revealer: learn to resize actor allocation too
https://bugzilla.gnome.org/show_bug.cgi?id=681089
src/revealer.vala | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/revealer.vala b/src/revealer.vala
index 5065acd..2ddfbbb 100644
--- a/src/revealer.vala
+++ b/src/revealer.vala
@@ -5,6 +5,7 @@ public class Boxes.Revealer: Clutter.Actor {
private bool horizontal;
private bool revealed;
public uint duration;
+ public bool resize;
public Revealer (bool horizontal) {
this.horizontal = horizontal;
@@ -31,6 +32,14 @@ public class Boxes.Revealer: Clutter.Actor {
}
public void reveal () {
+ if (resize) {
+ if (horizontal)
+ height = 0.0f;
+ else
+ width = 0.0f;
+ }
+
+ var max = 0.0f;
foreach (var child in get_children ()) {
if (!revealed)
child.show ();
@@ -39,6 +48,7 @@ public class Boxes.Revealer: Clutter.Actor {
float height;
child.get_preferred_height (-1, null, out height);
child.y = -height;
+ max = float.max (max, height);
}
child.animate (Clutter.AnimationMode.EASE_IN_QUAD, duration, "y", 0f);
} else {
@@ -46,10 +56,19 @@ public class Boxes.Revealer: Clutter.Actor {
float width;
child.get_preferred_width (-1, null, out width);
child.x = -width;
+ max = float.max (max, width);
}
child.animate (Clutter.AnimationMode.EASE_IN_QUAD, duration, "x", 0f);
}
}
+
+ if (resize) {
+ if (horizontal)
+ animate (Clutter.AnimationMode.EASE_IN_QUAD, duration, "height", max);
+ else
+ animate (Clutter.AnimationMode.EASE_IN_QUAD, duration, "width", max);
+ }
+
revealed = true;
}
@@ -71,6 +90,13 @@ public class Boxes.Revealer: Clutter.Actor {
revealed = false;
});
}
+
+ if (resize) {
+ if (horizontal)
+ animate (Clutter.AnimationMode.EASE_OUT_QUAD, duration, "height", 0.0f);
+ else
+ animate (Clutter.AnimationMode.EASE_OUT_QUAD, duration, "width", 0.0f);
+ }
}
public void unreveal () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]