diff options
Diffstat (limited to 'src/gui/ScrollablePage.cpp')
-rw-r--r-- | src/gui/ScrollablePage.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/gui/ScrollablePage.cpp b/src/gui/ScrollablePage.cpp index 7394ec3..de036b9 100644 --- a/src/gui/ScrollablePage.cpp +++ b/src/gui/ScrollablePage.cpp @@ -11,10 +11,17 @@ namespace gsr { const mgl::vec2f draw_pos = position + offset; offset = draw_pos + mgl::vec2f(0.0f, get_border_size(window)).floor(); + if(selected_child_widget) { + if(!selected_child_widget->on_event(event, window, offset)) + return false; + } + // Process widgets by visibility (backwards) for(auto it = widgets.rbegin(), end = widgets.rend(); it != end; ++it) { - if(!(*it)->on_event(event, window, offset)) - return false; + if(it->get() != selected_child_widget) { + if(!(*it)->on_event(event, window, offset)) + return false; + } } return true; @@ -44,15 +51,12 @@ namespace gsr { window.draw(border); for(auto &widget : widgets) { - if(widget->move_to_top) { - widget->move_to_top = false; - std::swap(widget, widgets.back()); - } + if(widget.get() != selected_child_widget) + widget->draw(window, offset); } - for(auto &widget : widgets) { - widget->draw(window, offset); - } + if(selected_child_widget) + selected_child_widget->draw(window, offset); mgl_window_set_scissor(window.internal_window(), &prev_scissor); } |