From 8fc219acbdc7f74d2fed2551ca51e7b0bff07c08 Mon Sep 17 00:00:00 2001 From: Cimbali Date: Thu, 10 Aug 2017 01:51:01 +0200 Subject: [PATCH] Fix #33 take notes_mode into account when computing event in page for link --- pympress/ui.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pympress/ui.py b/pympress/ui.py index 71719b07..f8307fb5 100644 --- a/pympress/ui.py +++ b/pympress/ui.py @@ -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?