Skip to content

Commit

Permalink
Fix #33 take notes_mode into account when computing event in page for…
Browse files Browse the repository at this point in the history
… link
  • Loading branch information
Cimbali committed Aug 9, 2017
1 parent 33fcb57 commit 8fc219a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pympress/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,17 @@ def on_link(self, widget, event):
# Normalize event coordinates and get link
x, y = event.get_coords()
ww, wh = widget.get_allocated_width(), widget.get_allocated_height()
x2, y2 = x/ww, y/wh

if not self.notes_mode:
# PDF_REGULAR page, the allocated size is the page size
x2, y2 = x/ww, y/wh
elif widget is self.p_da_notes:
# PDF_NOTES_PAGE, the allocated size is the right half of the page
x2, y2 = (ww + x) / (2 * ww), y / wh
else:
# PDF_CONTENT_PAGE, the allocated size is left half of the page
x2, y2 = x / (2 * ww), y / wh

link = page.get_link_at(x2, y2)

# Event type?
Expand Down

0 comments on commit 8fc219a

Please sign in to comment.