From 5958fe0a69f5a3ee894ff307113162e58d8bb75d Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 25 May 2018 17:36:25 +0200 Subject: [PATCH] menu_view: change voffset of button immediately This patch changes the button widget to apply the vertical offset to its child widgets at draw time, not at the layout phase. This way, the visual feedback on button press/release changes is more direct because it sidesteps the geometry animation. --- repos/gems/src/app/menu_view/button_widget.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/repos/gems/src/app/menu_view/button_widget.h b/repos/gems/src/app/menu_view/button_widget.h index 8d61ffca57..708a5e4e54 100644 --- a/repos/gems/src/app/menu_view/button_widget.h +++ b/repos/gems/src/app/menu_view/button_widget.h @@ -83,13 +83,10 @@ struct Menu_view::Button_widget : Widget, Animator::Item _update_children(node); - bool const dy = selected ? 1 : 0; - _children.for_each([&] (Widget &child) { child.geometry(Rect(Point(margin.left + padding.left, - margin.top + padding.top + dy), - child.min_size())); - }); + margin.top + padding.top), + child.min_size())); }); } Area min_size() const override @@ -137,6 +134,9 @@ struct Menu_view::Button_widget : Widget, Animator::Item Icon_painter::paint(alpha_surface, Rect(at, _animated_geometry.area()), scratch.texture(), 255); + if (selected) + at = at + Point(0, 1); + _draw_children(pixel_surface, alpha_surface, at); }