From 33ec398a0e28111c464c6a01c3ea51d267539e0d Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Thu, 3 May 2012 11:36:26 +0200 Subject: [PATCH] Calculate correct annotation position --- page-widget.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/page-widget.c b/page-widget.c index fb0afd2..fe09e3a 100644 --- a/page-widget.c +++ b/page-widget.c @@ -777,11 +777,15 @@ cb_menu_annotation_add(GtkMenuItem* item, ZathuraPage* page) return; } + /* calculate position */ + zathura_document_t* document = zathura_page_get_document(priv->page); + double scale = zathura_document_get_scale(document); + zathura_rectangle_t position = { - priv->events.mouse_click.x, - priv->events.mouse_click.y, - priv->events.mouse_click.x, - priv->events.mouse_click.y + priv->events.mouse_click.x / scale, + priv->events.mouse_click.y / scale, + priv->events.mouse_click.x / scale, + priv->events.mouse_click.y / scale }; zathura_annotation_set_position(annotation, position);