1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:58:11 +00:00

PDFViewer: Add zoom in/out/reset menu actions

Make PDFViewer::zoom_in() & ::zoom_out() public and add menu and toolbar
actions. Also add an action for zoom reset.
This commit is contained in:
Marcus Nilsson 2022-01-02 21:58:51 +01:00 committed by Andreas Kling
parent 45085122ee
commit 3af71c406d
4 changed files with 50 additions and 8 deletions

View file

@ -109,9 +109,8 @@ void PDFViewer::mousewheel_event(GUI::MouseEvent& event)
scrollbar.decrease_slider_by(20);
}
}
update();
}
update();
}
void PDFViewer::timer_event(Core::TimerEvent&)
@ -125,14 +124,24 @@ void PDFViewer::timer_event(Core::TimerEvent&)
void PDFViewer::zoom_in()
{
if (m_zoom_level < number_of_zoom_levels - 1)
if (m_zoom_level < number_of_zoom_levels - 1) {
m_zoom_level++;
update();
}
}
void PDFViewer::zoom_out()
{
if (m_zoom_level > 0)
if (m_zoom_level > 0) {
m_zoom_level--;
update();
}
}
void PDFViewer::reset_zoom()
{
m_zoom_level = initial_zoom_level;
update();
}
RefPtr<Gfx::Bitmap> PDFViewer::render_page(const PDF::Page& page)