From d64bcc86d8d10f6af9120c302d1939aece02f9e2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 31 Mar 2014 02:52:59 +0000 Subject: Use the same padding for arrange and zoom to fit. git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5352 a436a847-0d15-0410-975c-d299462d15a1 --- src/Canvas.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Canvas.cpp b/src/Canvas.cpp index b473f9b..757f26f 100644 --- a/src/Canvas.cpp +++ b/src/Canvas.cpp @@ -66,6 +66,8 @@ #define CANVAS_IDLE_PRIORITY (GDK_PRIORITY_REDRAW - 5) +static const double GANV_CANVAS_PAD = 8.0; + typedef struct { int x; int y; @@ -1462,12 +1464,11 @@ GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port) const int screen_height = gdk_screen_get_height(screen); const double drag_dx = mouse_x - control_start_x; const double drag_dy = mouse_y - control_start_y; - const double xpad = 8.0; // Pad from screen edge const double ythresh = 0.2; // Minimum y fraction for fine const double range_x = ((drag_dx > 0) ? (screen_width - control_start_x) - : control_start_x) - xpad; + : control_start_x) - GANV_CANVAS_PAD; const double range_y = ((drag_dy > 0) ? (screen_height - control_start_y) @@ -2069,7 +2070,7 @@ ganv_canvas_zoom_full(GanvCanvas* canvas) } } - static const double pad = 8.0; + static const double pad = GANV_CANVAS_PAD; const double new_zoom = std::min( ((double)win_width / (double)(right - left + pad*2.0)), @@ -2538,7 +2539,7 @@ ganv_canvas_arrange(GanvCanvas* canvas) } nodes.cleanup(); - static const double border_width = canvas->impl->font_size * 2.0; + static const double border_width = GANV_CANVAS_PAD; canvas->impl->move_contents_to_internal(border_width, border_width, least_x, least_y); ganv_canvas_scroll_to(GANV_CANVAS(canvas->impl->_gcanvas), 0, 0); -- cgit v1.2.1