diff options
| author | Gord Allott <gord.allott@canonical.com> | 2010-09-16 21:21:29 +0100 |
|---|---|---|
| committer | Gord Allott <gord.allott@canonical.com> | 2010-09-16 21:21:29 +0100 |
| commit | 50769766bfe48c2dffd11918819869637621a4f2 (patch) | |
| tree | ae235ce9ab2943fda4f52a0813ac4aa8f944d256 | |
| parent | c945751ebdb3e07d16757af5dfe180067b972560 (diff) | |
fix for lp:601093 icons now zoom in and out
(bzr r505.4.6)
| -rw-r--r-- | unity-private/launcher/scroller-model.vala | 1 | ||||
| -rw-r--r-- | unity-private/launcher/scroller-view.vala | 63 | ||||
| -rw-r--r-- | unity-private/launcher/scrollerchild.vala | 55 | ||||
| -rw-r--r-- | unity/icon-postprocessor.vala | 2 |
4 files changed, 79 insertions, 42 deletions
diff --git a/unity-private/launcher/scroller-model.vala b/unity-private/launcher/scroller-model.vala index 178d4c6d8..82f36686d 100644 --- a/unity-private/launcher/scroller-model.vala +++ b/unity-private/launcher/scroller-model.vala @@ -155,7 +155,6 @@ namespace Unity.Launcher children.remove (child); child_removed (tempchild); - order_changed (); } public void insert (ScrollerChild child, int i) diff --git a/unity-private/launcher/scroller-view.vala b/unity-private/launcher/scroller-view.vala index 437ebe2ed..89e1a6dff 100644 --- a/unity-private/launcher/scroller-view.vala +++ b/unity-private/launcher/scroller-view.vala @@ -804,10 +804,30 @@ namespace Unity.Launcher child.set_parent (this); // we only animate if the added child is not at the end - if (model.index_of (child) == model.size -1) - order_children (true); - else - order_children (false); + float[] prev_positions = {};//new float [model.size]; + float[] prev_rotations = {};//new float [model.size]; + + foreach (ScrollerChild modelchild in model) + { + prev_positions += modelchild.position; + prev_rotations += modelchild.rotation; + } + order_children (true); + + int index = 0; + foreach (ScrollerChild modelchild in model) + { + if (child != modelchild) + { + change_child_position_rotation (modelchild, + prev_positions[index], + prev_rotations[index], + true); + } + index++; + } + + order_children (false); queue_relayout (); child.notify["position"].connect (() => { queue_relayout (); @@ -818,17 +838,30 @@ namespace Unity.Launcher private void model_child_removed (ScrollerChild child) { - child_refs.add (child); // we need to keep a reference on it for now - var anim = child.animate (Clutter.AnimationMode.EASE_OUT_QUAD, - SHORT_DELAY, - "opacity", 0); - anim.completed.connect (() => { - child.unparent (); - child_refs.remove (child); - }); - - order_children (false); - queue_relayout (); + var drag_controller = Drag.Controller.get_default (); + if (drag_controller.is_dragging) + { + order_children (false); + queue_relayout (); + } + else + { + child_refs.add (child); // we need to keep a reference on it for now + var anim = child.animate (Clutter.AnimationMode.EASE_OUT_QUAD, + SHORT_DELAY, + "opacity", 0); + + var icon_scale_anim = child.processed_icon.animate (Clutter.AnimationMode.EASE_OUT_QUAD, + SHORT_DELAY, + "scale-x", 0.0, + "scale-y", 0.0); + anim.completed.connect (() => { + child.unparent (); + child_refs.remove (child); + order_children (false); + queue_relayout (); + }); + } } private void model_order_changed () diff --git a/unity-private/launcher/scrollerchild.vala b/unity-private/launcher/scrollerchild.vala index 607364cf7..41a8613d3 100644 --- a/unity-private/launcher/scrollerchild.vala +++ b/unity-private/launcher/scrollerchild.vala @@ -85,7 +85,7 @@ namespace Unity.Launcher opacity); } - private UnityIcon processed_icon; + public UnityIcon processed_icon; private ThemeImage close_symbol; private ThemeImage active_indicator; private ThemeImage running_indicator_notify; @@ -221,27 +221,27 @@ namespace Unity.Launcher } } - private bool previous_close_state = false; - private void on_enable_close_state_changed () - { - if (enable_close_state == true && previous_close_state == false) - { - close_symbol.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, - 300, - "opacity", 0xff, - "scale-x", 1.0, - "scale-y", 1.0); - } - else if (enable_close_state == false && previous_close_state == true) - { - close_symbol.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, - 300, - "opacity", 0x00, - "scale-x", 0.0, - "scale-y", 0.0); - } - previous_close_state = enable_close_state; - } + private bool previous_close_state = false; + private void on_enable_close_state_changed () + { + if (enable_close_state == true && previous_close_state == false) + { + close_symbol.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, + 300, + "opacity", 0xff, + "scale-x", 1.0, + "scale-y", 1.0); + } + else if (enable_close_state == false && previous_close_state == true) + { + close_symbol.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, + 300, + "opacity", 0x00, + "scale-x", 0.0, + "scale-y", 0.0); + } + previous_close_state = enable_close_state; + } /* alpha helpers */ private static float get_ease_out_sine (float alpha) @@ -465,7 +465,12 @@ namespace Unity.Launcher effect_drop_shadow.set_opacity (0.4f); this.effect_drop_shadow.set_margin (5); this.processed_icon.add_effect (effect_drop_shadow); - + this.processed_icon.set_scale (0.0f, 0.0f); + this.processed_icon.scale_gravity = Clutter.Gravity.CENTER; + this.processed_icon.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, + 300, + "scale-x", 1.0, + "scale-y", 1.0); do_queue_redraw (); } } @@ -631,9 +636,7 @@ namespace Unity.Launcher running_indicator.get_preferred_height (58, out n_height, out height); midpoint = (processed_icon.stored_height - height) / 2.0f; if (rotation > 0) - { - midpoint = box.get_height () - midpoint - processed_icon.stored_ymod; - } + midpoint = box.get_height () - midpoint - processed_icon.stored_ymod; child_box.x1 = 0; child_box.y1 = midpoint; diff --git a/unity/icon-postprocessor.vala b/unity/icon-postprocessor.vala index 2d211c1c5..f4c21f58d 100644 --- a/unity/icon-postprocessor.vala +++ b/unity/icon-postprocessor.vala @@ -391,6 +391,8 @@ namespace Unity public static void paint_real (Clutter.Actor actor) { UnityIcon self = actor as UnityIcon; + if (self.icon is Clutter.Texture == false) + return; float p1_x, p1_y; float p2_x, p2_y; float p3_x, p3_y; |
