Commit a0045a97 authored by Tobias Deiminger's avatar Tobias Deiminger

Fix line annotation leader line angle

Summary:
For "Straight Line" annotations, the "Leader Lines" (if any) shall be perpendicular to the main line segment. Current code missed to consider page aspect ratio when calculating the main segment angle, which caused non-perpendicular leader lines.

Note: Bug is only visible with non-PDF documents (i.e. where Okular draws line annotation, instead of generator).

Before:
{F6818453}

After:
{F6818452}

Test Plan:
- open a txt file, the generated page will have aspect ratio 3:4
- configure a "Straight Line" annotation with long leader line
- create a line annotation at 45 degree angle
- check the leader line, it shall be perpendicular to the main line

Reviewers: sander

Reviewed By: sander

Subscribers: aacid, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D21136
parent ae96db80
......@@ -478,7 +478,7 @@ void PagePainter::paintCroppedPageOnPainter( QPainter * destPainter, const Okula
if ( path.count() == 2 && fabs( la->lineLeadingForwardPoint() ) > 0.1 )
{
Okular::NormalizedPoint delta( la->transformedLinePoints().last().x - la->transformedLinePoints().first().x, la->transformedLinePoints().first().y - la->transformedLinePoints().last().y );
double angle = atan2( delta.y, delta.x );
double angle = atan2( delta.y * page->height(), delta.x * page->width() );
if ( delta.y < 0 )
angle += 2 * M_PI;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment