summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-03-31 02:52:59 +0000
committerDavid Robillard <d@drobilla.net>2014-03-31 02:52:59 +0000
commitd64bcc86d8d10f6af9120c302d1939aece02f9e2 (patch)
tree454e956f15f92587c9aa36effe26a34d5866095f
parent583834a097b3491f8bf07bb0ee531935d10ce16d (diff)
downloadganv-d64bcc86d8d10f6af9120c302d1939aece02f9e2.tar.gz
ganv-d64bcc86d8d10f6af9120c302d1939aece02f9e2.tar.bz2
ganv-d64bcc86d8d10f6af9120c302d1939aece02f9e2.zip
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
-rw-r--r--src/Canvas.cpp9
1 files 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);