mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-25 10:55:37 +00:00
Fix DjVu links pointing to pages with different dimensions
Summary: Currently the coordinates of a link rectangle in a DjVu document are computed with respect to the size of the page the link is pointing to. Because of that, links only appear in correct places if the dimensions of a target page are the same as of the page containing the link. The attached file demonstrating the issue contains two pages, one in portrait orientation and one in landscape, the first pointing to the second. The active zone for the link is different from where it is in other viewers. {F6443987} Reviewers: #okular Subscribers: okular-devel Tags: #okular Differential Revision: https://phabricator.kde.org/D17194
This commit is contained in:
parent
140638a0b3
commit
b04a2daa6b
|
@ -292,7 +292,6 @@ void DjVuGenerator::loadPages( QVector<Okular::Page*> & pagesVector, int rotatio
|
|||
|
||||
Okular::ObjectRect* DjVuGenerator::convertKDjVuLink( int page, KDjVu::Link * link ) const
|
||||
{
|
||||
int newpage = -1;
|
||||
Okular::Action *newlink = nullptr;
|
||||
Okular::ObjectRect *newrect = nullptr;
|
||||
switch ( link->type() )
|
||||
|
@ -309,10 +308,7 @@ Okular::ObjectRect* DjVuGenerator::convertKDjVuLink( int page, KDjVu::Link * lin
|
|||
{
|
||||
Okular::DocumentViewport vp;
|
||||
if ( !target.isEmpty() )
|
||||
{
|
||||
vp.pageNumber = ( target.at(0) == QLatin1Char( '+' ) || target.at(0) == QLatin1Char( '-' ) ) ? page + tmppage : tmppage - 1;
|
||||
newpage = vp.pageNumber;
|
||||
}
|
||||
newlink = new Okular::GotoAction( QString(), vp );
|
||||
}
|
||||
break;
|
||||
|
@ -327,9 +323,7 @@ Okular::ObjectRect* DjVuGenerator::convertKDjVuLink( int page, KDjVu::Link * lin
|
|||
}
|
||||
if ( newlink )
|
||||
{
|
||||
const KDjVu::Page* p = m_djvu->pages().value( newpage == -1 ? page : newpage );
|
||||
if ( !p )
|
||||
p = m_djvu->pages().at( page );
|
||||
const KDjVu::Page* p = m_djvu->pages().at( page );
|
||||
int width = p->width();
|
||||
int height = p->height();
|
||||
bool scape_orientation = false; // hack by tokoe, should always create default page
|
||||
|
|
Loading…
Reference in a new issue