From d116b9a8c659b618d21508b01456e14059142f38 Mon Sep 17 00:00:00 2001 From: Rodrigo Tobar Date: Sat, 17 Dec 2022 20:41:59 +0800 Subject: PDFViewer: Move to page when outline item is selected --- Userland/Applications/PDFViewer/PDFViewerWidget.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Userland/Applications') diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp index eb6fc348ce..c779a3604f 100644 --- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp +++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp @@ -10,6 +10,7 @@ #include "AK/DeprecatedString.h" #include "AK/Format.h" #include "LibGUI/Forward.h" +#include "LibPDF/Document.h" #include #include #include @@ -167,6 +168,13 @@ PDFViewerWidget::PDFViewerWidget() m_sidebar = h_splitter.add(); m_sidebar->set_preferred_width(200); m_sidebar->set_visible(false); + m_sidebar->on_destination_selected = [&](PDF::Destination const& destination) { + auto maybe_page = destination.page; + if (!maybe_page.has_value()) + return; + auto page = maybe_page.release_value(); + m_viewer->set_current_page(page); + }; auto& v_splitter = h_splitter.add(); v_splitter.layout()->set_spacing(4); -- cgit v1.2.3