From 1f73043224256571ebbbbad8b7e8be4bbc09f9ed Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Wed, 30 Jan 2008 20:05:58 +0000 Subject: 2nd part of the fix for bug #167500: correctly update the rulers when they change size (bzr r4621) --- src/display/sp-canvas.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/display/sp-canvas.cpp') diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index 2033f8a69..cce43825a 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -1199,7 +1199,7 @@ sp_canvas_size_allocate (GtkWidget *widget, GtkAllocation *allocation) } widget->allocation = *allocation; - + if (GTK_WIDGET_REALIZED (widget)) { gdk_window_move_resize (widget->window, widget->allocation.x, widget->allocation.y, @@ -2084,7 +2084,7 @@ sp_canvas_root (SPCanvas *canvas) } /** - * Scrolls canvas to specific position. + * Scrolls canvas to specific position (cx and cy are measured in screen pixels) */ void sp_canvas_scroll_to (SPCanvas *canvas, double cx, double cy, unsigned int clear, bool is_scrolling) @@ -2092,12 +2092,12 @@ sp_canvas_scroll_to (SPCanvas *canvas, double cx, double cy, unsigned int clear, g_return_if_fail (canvas != NULL); g_return_if_fail (SP_IS_CANVAS (canvas)); - int ix = (int) round(cx); //cx might be negative, so (int)(cx + 0.5) will not do! - int iy = (int) round(cy); - int dx = ix - canvas->x0; - int dy = iy - canvas->y0; + int ix = (int) round(cx); // ix and iy are the new canvas coordinates (integer screen pixels) + int iy = (int) round(cy); // cx might be negative, so (int)(cx + 0.5) will not do! + int dx = ix - canvas->x0; // dx and dy specify the displacement (scroll) of the + int dy = iy - canvas->y0; // canvas w.r.t its previous position - canvas->dx0 = cx; + canvas->dx0 = cx; // here the 'd' stands for double, not delta! canvas->dy0 = cy; canvas->x0 = ix; canvas->y0 = iy; -- cgit v1.2.3