mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
PDFViewer: Move to page when outline item is selected
This commit is contained in:
parent
d739877807
commit
d116b9a8c6
Notes:
sideshowbarker
2024-07-17 03:03:19 +09:00
Author: https://github.com/rtobar Commit: https://github.com/SerenityOS/serenity/commit/d116b9a8c6 Pull-request: https://github.com/SerenityOS/serenity/pull/16550
1 changed files with 8 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
|||
#include "AK/DeprecatedString.h"
|
||||
#include "AK/Format.h"
|
||||
#include "LibGUI/Forward.h"
|
||||
#include "LibPDF/Document.h"
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <AK/Variant.h>
|
||||
|
@ -167,6 +168,13 @@ PDFViewerWidget::PDFViewerWidget()
|
|||
m_sidebar = h_splitter.add<SidebarWidget>();
|
||||
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<GUI::VerticalSplitter>();
|
||||
v_splitter.layout()->set_spacing(4);
|
||||
|
|
Loading…
Reference in a new issue