You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to get a Dropdown inside a Dialog, but since there's only a single overlay allowed at a given time, setting the Dropdown overlay would remove the Dialog overlay (I think). It would be nice to have a stack of overlays so that this situation would work.
How this might work:
// show a dialog// - events are directed at the dialog// - tapping outside the dialog hides it// - when this overlay is hidden, control returns to the main sceneui::MainLoop::show_overlay(dialog_scene);
// show a dropdown on top of the dialog// - events are directed at the dropdown// - tapping outside the dropdown hides it (but does not hide the dialog)// - when this overlay is hidden, control returns to the dialogui::MainLoop::show_overlay(dropdown_scene);
In fact, it might work to just have a single scene stack, where keyboard is just another overlay, and main_scene is always on the bottom of the stack.
The main issue I can think of is that currently hiding the overlay doesn't remove it from MainLoop (so it always stays alive, since Scene is a shared_ptr). The simplest version of the scene stack would push scenes on a std::stack, and hiding would actually pop the shared_ptr from the stack, which would decrease the refcount . . . so if you wanted to hold onto a hidden scene you'd have to retain the pointer yourself. And toggle_scene wouldn't really make sense with this setup.
The text was updated successfully, but these errors were encountered:
i think every level needs to be redrawn in certain circumstances (or we make fb a little smarter). basically, as more levels are added, the perf will degrade.
added in b255e42. it works mostly as you describe:
main scene is still separate variable in main_loop. set_scene(Scene) is used to set this scene (different than proposal)
there is a stack of scenes available in main_loop
keyboard is a scene in this stack with the scene attribute clear_under set to true
toggle_scene is still there, but not sure if it's useful any longer
show_overlay(Scene s, bool stack=false) will push the scene onto the stack if stack == true. otherwise, it clears the stack and sets the overlay as the scene.
hide_overlay(Scene s) now always takes a scene.
test plan:
tested remux dialogs
tested remarkable puzzles
tested harmony
tested input_demo and added a nested overlay scene
I'm trying to get a Dropdown inside a Dialog, but since there's only a single overlay allowed at a given time, setting the Dropdown overlay would remove the Dialog overlay (I think). It would be nice to have a stack of overlays so that this situation would work.
How this might work:
In fact, it might work to just have a single scene stack, where keyboard is just another overlay, and main_scene is always on the bottom of the stack.
The main issue I can think of is that currently hiding the overlay doesn't remove it from MainLoop (so it always stays alive, since Scene is a shared_ptr). The simplest version of the scene stack would push scenes on a std::stack, and hiding would actually pop the shared_ptr from the stack, which would decrease the refcount . . . so if you wanted to hold onto a hidden scene you'd have to retain the pointer yourself. And toggle_scene wouldn't really make sense with this setup.
The text was updated successfully, but these errors were encountered: