mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-21 07:29:53 +00:00
LibWebView+UI: Generate the zoom menu
This commit is contained in:
parent
7d6ea99d0d
commit
9684e6dbc5
Notes:
github-actions[bot]
2025-09-11 18:24:52 +00:00
Author: https://github.com/trflynn89
Commit: 9684e6dbc5
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6062
20 changed files with 104 additions and 210 deletions
|
@ -553,6 +553,18 @@ void ViewImplementation::did_allocate_iosurface_backing_stores(i32 front_id, Cor
|
|||
}
|
||||
#endif
|
||||
|
||||
void ViewImplementation::update_zoom()
|
||||
{
|
||||
if (m_zoom_level != 1.0f) {
|
||||
m_reset_zoom_action->set_text(MUST(String::formatted("{}%", round_to<int>(m_zoom_level * 100))));
|
||||
m_reset_zoom_action->set_visible(true);
|
||||
} else {
|
||||
m_reset_zoom_action->set_visible(false);
|
||||
}
|
||||
|
||||
client().async_set_device_pixels_per_css_pixel(m_client_state.page_index, m_device_pixel_ratio * m_zoom_level);
|
||||
}
|
||||
|
||||
void ViewImplementation::handle_resize()
|
||||
{
|
||||
client().async_set_viewport_size(page_id(), this->viewport_size());
|
||||
|
@ -807,6 +819,12 @@ void ViewImplementation::initialize_context_menus()
|
|||
m_navigate_back_action->set_enabled(false);
|
||||
m_navigate_forward_action->set_enabled(false);
|
||||
|
||||
m_reset_zoom_action = Action::create("100%"sv, ActionID::ResetZoomViaToolbar, [this]() {
|
||||
reset_zoom();
|
||||
});
|
||||
m_reset_zoom_action->set_tooltip("Reset zoom level"sv);
|
||||
m_reset_zoom_action->set_visible(false);
|
||||
|
||||
m_search_selected_text_action = Action::create("Search Selected Text"sv, ActionID::SearchSelectedText, [this]() {
|
||||
auto const& search_engine = Application::settings().search_engine();
|
||||
if (!search_engine.has_value())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue