summaryrefslogtreecommitdiff
path: root/winrt/mupdf_cpp/MainPage.xaml.cpp
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2013-05-28 00:12:55 -0700
committerRobin Watts <robin.watts@artifex.com>2013-06-03 15:23:27 +0100
commit16b8e2856cdfed478039dc29f6a2c6645c14fe69 (patch)
treeba3113d24cb47698ed90bfb8ac7887877cfb8b61 /winrt/mupdf_cpp/MainPage.xaml.cpp
parenteeac55c6d5df2f841ae72327fa5347feecbdba60 (diff)
downloadmupdf-16b8e2856cdfed478039dc29f6a2c6645c14fe69.tar.xz
Fix for issue of link rectangle display when device is rotated.
The links rectangles need to be recomputed when we have a device orientation change occur. When a change in orientation occurs, the current rects are marked as being invalid and will be redrawn when needed.
Diffstat (limited to 'winrt/mupdf_cpp/MainPage.xaml.cpp')
-rw-r--r--winrt/mupdf_cpp/MainPage.xaml.cpp36
1 files changed, 24 insertions, 12 deletions
diff --git a/winrt/mupdf_cpp/MainPage.xaml.cpp b/winrt/mupdf_cpp/MainPage.xaml.cpp
index d5fb96b5..86d06f49 100644
--- a/winrt/mupdf_cpp/MainPage.xaml.cpp
+++ b/winrt/mupdf_cpp/MainPage.xaml.cpp
@@ -1017,10 +1017,13 @@ void mupdf_cpp::MainPage::GridSizeChanged()
if (m_num_pages > 0 && old_flip != m_curr_flipView && old_flip != nullptr)
{
- if ((this->m_curr_flipView->SelectedIndex == this->m_currpage) && this->m_links_on)
- FlipView_SelectionChanged(nullptr, nullptr);
- else
- this->m_curr_flipView->SelectedIndex = this->m_currpage;
+ /* If links are on or off, we need to invalidate */
+ ClearLinks();
+ InvalidateLinks();
+ auto doc = this->m_docPages->GetAt(m_currpage);
+ doc->Content = OLD_RESOLUTION; /* To force a rerender */
+ this->m_curr_flipView->SelectedIndex = this->m_currpage;
+ FlipView_SelectionChanged(nullptr, nullptr);
}
}
@@ -1057,22 +1060,31 @@ void mupdf_cpp::MainPage::Linker(Platform::Object^ sender, Windows::UI::Xaml::Ro
if (m_links_on)
AddLinkCanvas();
else
+ ClearLinks();
+}
+
+void mupdf_cpp::MainPage::ClearLinks()
+{
+ /* Make sure surrounding render pages lose their links */
+ for (int k = m_currpage - LOOK_AHEAD; k <= m_currpage + LOOK_AHEAD; k++)
{
- /* Make sure surrounding render pages lose their links */
- for (int k = m_currpage - LOOK_AHEAD; k <= m_currpage + LOOK_AHEAD; k++)
+ if (k >= 0 && k < m_num_pages)
{
- if (k >= 0 && k < m_num_pages)
+ auto doc_page = this->m_docPages->GetAt(k);
+ if (doc_page->Content == FULL_RESOLUTION)
{
- auto doc_page = this->m_docPages->GetAt(k);
- if (doc_page->Content == FULL_RESOLUTION)
- {
- doc_page->LinkBox = nullptr;
- }
+ doc_page->LinkBox = nullptr;
}
}
}
}
+void mupdf_cpp::MainPage::InvalidateLinks()
+{
+ for (int k = 0; k < m_num_pages; k++)
+ m_linkset->SetAt(k, false);
+}
+
/* Add in the link rects. If we have not already computed them then do that now */
void mupdf_cpp::MainPage::AddLinkCanvas()
{