Discussion:
[Okular-devel] [okular] [Bug 342003] New: Trim margins confuses ordering of zoom steps while zooming out
Jonas
2014-12-18 15:46:25 UTC
Permalink
https://bugs.kde.org/show_bug.cgi?id=342003

Bug ID: 342003
Summary: Trim margins confuses ordering of zoom steps while
zooming out
Product: okular
Version: 0.20.2
Platform: Debian unstable
OS: Linux
Status: UNCONFIRMED
Severity: normal
Priority: NOR
Component: general
Assignee: okular-***@kde.org
Reporter: ***@online.de

While trim margins is active it is no longer possible to Zoom Out past the Fit
Width state. Instead pressing Zoom Out (or Strg- -) repeatedly alternates
between the next smaller zoom level and the Fit Width zoom level. This
regression appeared recently, when Fit Width zoom level was sorted into the
list of zoom states one reaches with Zoom In and Zoom Out.

Reproducible: Always

Steps to Reproduce:
1. Activate Trim margins
2. Zoom to Fit Width
3. Zoom Out (Strg - -) repeatedly

Actual Results:
Zoom level alternates between Fit Width and the next smaller one (f.ex. 75%).

Expected Results:
Zoom out continuously.

I quite like the behaviour without Trim Margins.
--
You are receiving this mail because:
You are the assignee for the bug.
Daniel Pastushchak
2014-12-24 16:57:07 UTC
Permalink
https://bugs.kde.org/show_bug.cgi?id=342003

Daniel Pastushchak <***@gmail.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |***@gmail.co
| |m

--- Comment #1 from Daniel Pastushchak <***@gmail.com> ---
Comment from GCI student:
I use Kubuntu 14.10 and Okular 0.20.2, I faced the same problem and I think
that this bug https://bugs.kde.org/show_bug.cgi?id=319637 is quite similar
--
You are receiving this mail because:
You are the assignee for the bug.
stefan
2015-01-14 16:38:06 UTC
Permalink
https://bugs.kde.org/show_bug.cgi?id=342003

stefan <***@gmx.de> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |***@gmx.de

--- Comment #2 from stefan <***@gmx.de> ---
Exactly same problem on Gentoo with Okular 0.20.3 (KDE Version 4.14.3). Problem
did not exist for 0.17.x Version used before.
--
You are receiving this mail because:
You are the assignee for the bug.
a***@gmail.com
2015-03-01 20:17:21 UTC
Permalink
https://bugs.kde.org/show_bug.cgi?id=342003

***@gmail.com changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |***@gmail.com

--- Comment #3 from ***@gmail.com ---
I have exactly the same problem on OpenSUSE 13.2, KDE 4.14.4 and Okular 0.21.1.
Disabling trim margins allows zooming out beyond the "Fit width" level.
--
You are receiving this mail because:
You are the assignee for the bug.
jimbo1qaz
2018-10-05 08:12:14 UTC
Permalink
https://bugs.kde.org/show_bug.cgi?id=342003

jimbo1qaz <***@protonmail.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |***@protonmail.com
Version|0.20.2 |1.3.1

--- Comment #4 from jimbo1qaz <***@protonmail.com> ---
STEPS TO REPRODUCE
1. open pdf
2. enable "trim margins"
3. zoom in until (page-width > window-width)
4. zoom out repeatedly

I've been able to reproduce bug regardless of window size.

OBSERVED RESULT
- When zooming in OR out, PDF snaps to "Fit Width" when the *untrimmed* margins
cross 100% of screen width.
- When zooming in, this sometimes causes PDF to skip a zoom level (eg. 100%).
- When zooming out, this causes PDF to zoom *in* when snapping to "Fit Width".

EXPECTED RESULT
PDF snaps to "Fit Width" when the *trimmed* margins cross 100% of screen width.

SOFTWARE VERSIONS
(available in About System)
KDE Plasma Version: 5.12.6
KDE Frameworks Version: 5.44.0
Qt Version: 5.9.5

Also bugged in Flatpak Okular 1.5.1.

-----------

How do I submit a patch to fix this bug?
--
You are receiving this mail because:
You are the assignee for the bug.
jimbo1qaz
2018-10-05 23:42:19 UTC
Permalink
https://bugs.kde.org/show_bug.cgi?id=342003

--- Comment #5 from jimbo1qaz <***@protonmail.com> ---
I'm not a maintainer, but I've done some digging and I think this is the issue.

void PageView::updateItemSize( PageViewItem * item, int colWidth, int rowHeight
)
- defines Okular::Page *page
- okularPage->width() and okularPage->height()
reflect the "uncropped unzoomed" dimensions of the page (in some units,
IDK).

- finds the unzoomed dimensions
- if cropping enabled, crops them (multiplying by Okular::NormalizedRect[0,1]
coordinates) (cropped unzoomed dimensions)
- multiplies by the zoom factor
- calls PageViewItem::setWHZC(cropped_w, cropped_h) with cropped w,h.

- PageViewItem::setWHZC sets m_croppedGeometry.
- PageViewItem::setWHZC divides by crop boundaries and sets m_uncroppedGeometry

-----------

// compute the zoom factor value for FitWidth and FitPage mode
double PageView::zoomFactorFitMode( ZoomMode mode )
- const double width = okularPage->width(), height = okularPage->height();

This is the bug. width()/height() are uncropped, but FitWidth and FitPage end
up zooming the cropped page region.

We need to use the cropped unzoomed dimensions. But they are not exposed by the
code, instead buried as local variables within PageView::updateItemSize(), and
overwritten by the cropped zoomed versions when calling PageViewItem::setWHZC.

Consequently, currentItem->croppedWidth()/croppedHeight() is not a proper
workaround. How should this bug be fixed?

-----------

Sidenote: Why is Okular written in Qt-flavored C++03 without std::?
--
You are receiving this mail because:
You are the assignee for the bug.
David Hurka
2018-10-06 18:49:35 UTC
Permalink
https://bugs.kde.org/show_bug.cgi?id=342003

--- Comment #6 from David Hurka <***@mailbox.org> ---
Small hint if difficult to reproduce:
The trimmed margins must be large enough. If this is not the case in your PDF,
try to use "trim to selection" instead of "trim margins"
--
You are receiving this mail because:
You are the assignee for the bug.
Christoph Feck
2018-10-27 15:31:59 UTC
Permalink
https://bugs.kde.org/show_bug.cgi?id=342003

Christoph Feck <***@kde.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://bugs.kde.org/show_b
| |ug.cgi?id=368598
--
You are receiving this mail because:
You are the assignee for the bug.
Magnus Aagaard Sørensen
2018-11-17 12:41:02 UTC
Permalink
https://bugs.kde.org/show_bug.cgi?id=342003

Magnus Aagaard Sørensen <***@aagaardsorensen.dk> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|REPORTED |CONFIRMED
CC| |***@aagaardsorensen.dk
Keywords| |investigated, triaged
Ever confirmed|0 |1

--- Comment #7 from Magnus Aagaard Sørensen <***@aagaardsorensen.dk> ---
Steps taken to reproduce:
* Open pdf file.
* Select trim to margins (View -> Trim View -> Trim Margins).
* Zoom in past the "Fit Width" label.
* Zooming out with GUI/mousewheel/keyboard shortcuts shifts between the "Fit
Width" and the next zoom step.
* Normal, expected zoom behaviour returns after deselecting trim margins.

I'm not the developer, updating as part of the Okular Bug Day for the Bugsquad.

Application Version: 1.5.3
KDE Plasma Version: 5.14.3
KDE Frameworks Version: 5.52.0
Qt Version: 5.11.2
--
You are receiving this mail because:
You are the assignee for the bug.
Magnus Aagaard Sørensen
2018-11-17 13:40:39 UTC
Permalink
https://bugs.kde.org/show_bug.cgi?id=342003

Magnus Aagaard Sørensen <***@aagaardsorensen.dk> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |***@gmail.com

--- Comment #8 from Magnus Aagaard Sørensen <***@aagaardsorensen.dk> ---
*** Bug 366449 has been marked as a duplicate of this bug. ***
--
You are receiving this mail because:
You are the assignee for the bug.
Loading...