[evince] center target box for /FitR jumping
- From: Jose Aliste <jaliste src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] center target box for /FitR jumping
- Date: Mon, 13 May 2013 13:28:04 +0000 (UTC)
commit 4071ebf2528b84508b671d46aab24553459428d0
Author: Simon Budig <simon budig de>
Date: Sun Mar 10 01:45:49 2013 +0100
center target box for /FitR jumping
https://bugzilla.gnome.org/show_bug.cgi?id=695524
libview/ev-view.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 5b755b3..e656db5 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -1624,7 +1624,7 @@ static void
goto_fitr_dest (EvView *view, EvLinkDest *dest)
{
EvPoint doc_point;
- gdouble zoom, left, top;
+ gdouble zoom, left, top, doc_width, doc_height;
gboolean change_left, change_top;
GtkAllocation allocation;
@@ -1633,14 +1633,21 @@ goto_fitr_dest (EvView *view, EvLinkDest *dest)
left = ev_link_dest_get_left (dest, &change_left);
top = ev_link_dest_get_top (dest, &change_top);
- zoom = zoom_for_size_fit_page (ev_link_dest_get_right (dest) - left,
- ev_link_dest_get_bottom (dest) - top,
+ doc_width = ev_link_dest_get_right (dest) - left;
+ doc_height = ev_link_dest_get_bottom (dest) - top;
+
+ zoom = zoom_for_size_fit_page (doc_width,
+ doc_height,
allocation.width,
allocation.height);
ev_document_model_set_sizing_mode (view->model, EV_SIZING_FREE);
ev_document_model_set_scale (view->model, zoom);
+ /* center the target box within the view */
+ left -= (allocation.width / zoom - doc_width) / 2;
+ top -= (allocation.height / zoom - doc_height) / 2;
+
doc_point.x = change_left ? left : 0;
doc_point.y = change_top ? top : 0;
view->pending_point = doc_point;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]