thSoft / eclipse-commons

Eclipse Commons

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PDF view sometimes resets alignment

thSoft opened this issue · comments

Sometimes the viewed PDF gets aligned top-left when scrolling it.

A behaviour I noticed:

  • Open the score view with link mode enabled
  • in score library select a score (with enough content, e.g. 2 full pages) not open in the score view
  • wait for all hyperlink creation jobs to be finished (the score should be aligned top left)
  • immediately open the new "Close score" submenu (with Close all, Close others)

In my case this causes an invokation of ScrollComposit#setOrigin (with an offset) called by Composite#setFocus. However, this method iterates through the children (I guess this involves the hyperlink annotations) and calls their setFocus methods.

This may be an explanation for the erratic scrolling behaviour (setFocus navigates to the first hyperlink).

Unfortunately I can reproduce this (again?): if the page can't be scrolled in horizontally/vertically, but I try to scroll it with the mouse, it gets aligned to the left/top respectively.

Having thought about it, it is not really a bug in ScrolledComposite. The problem is that in the reproducible case the page's origin is negative, but the minimal scrollbar selection values are 0. The scroll events set the origin to these values.

I fixed that problem by preventing the listener to receive the event in case the origin is negative.