mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
Mandelbrot: Add a View menu with zoom actions
This commit is contained in:
parent
19068945de
commit
5c3440c5db
Notes:
sideshowbarker
2024-07-18 06:54:46 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/5c3440c5db4 Pull-request: https://github.com/SerenityOS/serenity/pull/9414 Reviewed-by: https://github.com/awesomekling
@ -407,6 +407,31 @@ int main(int argc, char** argv)
|
|||||||
}));
|
}));
|
||||||
file_menu.add_separator();
|
file_menu.add_separator();
|
||||||
file_menu.add_action(GUI::CommonActions::make_quit_action([&](auto&) { app->quit(); }));
|
file_menu.add_action(GUI::CommonActions::make_quit_action([&](auto&) { app->quit(); }));
|
||||||
|
|
||||||
|
auto zoom_in_action = GUI::CommonActions::make_zoom_in_action(
|
||||||
|
[&](auto&) {
|
||||||
|
mandelbrot.zoom(Mandelbrot::Zoom::In, mandelbrot.relative_rect().center());
|
||||||
|
},
|
||||||
|
window);
|
||||||
|
|
||||||
|
auto reset_zoom_action = GUI::CommonActions::make_reset_zoom_action(
|
||||||
|
[&](auto&) {
|
||||||
|
// FIXME: Ideally, this would only reset zoom. Currently, it resets pan too.
|
||||||
|
mandelbrot.reset();
|
||||||
|
},
|
||||||
|
window);
|
||||||
|
|
||||||
|
auto zoom_out_action = GUI::CommonActions::make_zoom_out_action(
|
||||||
|
[&](auto&) {
|
||||||
|
mandelbrot.zoom(Mandelbrot::Zoom::Out, mandelbrot.relative_rect().center());
|
||||||
|
},
|
||||||
|
window);
|
||||||
|
|
||||||
|
auto& view_menu = window->add_menu("&View");
|
||||||
|
view_menu.add_action(zoom_in_action);
|
||||||
|
view_menu.add_action(reset_zoom_action);
|
||||||
|
view_menu.add_action(zoom_out_action);
|
||||||
|
|
||||||
window->show();
|
window->show();
|
||||||
|
|
||||||
auto app_icon = GUI::Icon::default_icon("app-mandelbrot");
|
auto app_icon = GUI::Icon::default_icon("app-mandelbrot");
|
||||||
|
Loading…
Reference in New Issue
Block a user