diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-08-24 14:08:25 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-08-24 14:08:25 +0200 |
commit | b8e6949dfb8a88c832e82f8b7e853fe0ed462da0 (patch) | |
tree | 596f3f33b44aee1feb4d28477f4270ad826434b2 /src/gui/ScrollablePage.cpp | |
parent | 54c60d9a18d103011a12939c5029dd35a8e9e200 (diff) |
Remove scrollable page from gsr page, fix crash when navigating back
Diffstat (limited to 'src/gui/ScrollablePage.cpp')
-rw-r--r-- | src/gui/ScrollablePage.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gui/ScrollablePage.cpp b/src/gui/ScrollablePage.cpp index a2b6c8f..41ede41 100644 --- a/src/gui/ScrollablePage.cpp +++ b/src/gui/ScrollablePage.cpp @@ -19,14 +19,13 @@ namespace gsr { } // Process widgets by visibility (backwards) - for(auto it = widgets.rbegin(), end = widgets.rend(); it != end; ++it) { - if(it->get() != selected_widget) { - if(!(*it)->on_event(event, window, offset)) + return widgets.for_each_reverse([selected_widget, &window, &event, offset](std::unique_ptr<Widget> &widget) { + if(widget.get() != selected_widget) { + if(!widget->on_event(event, window, offset)) return false; } - } - - return true; + return true; + }); } void ScrollablePage::draw(mgl::Window &window, mgl::vec2f offset) { @@ -48,7 +47,8 @@ namespace gsr { Widget *selected_widget = selected_child_widget; - for(auto &widget : widgets) { + for(size_t i = 0; i < widgets.size(); ++i) { + auto &widget = widgets[i]; if(widget.get() != selected_widget) widget->draw(window, offset); } |