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.
This commit is contained in:
Norman Feske 2018-05-25 17:36:25 +02:00 committed by Christian Helmuth
parent 1af6bd1454
commit 5958fe0a69
1 changed files with 5 additions and 5 deletions

View File

@ -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);
}