aboutsummaryrefslogtreecommitdiff
path: root/src/tool_select.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-10-05 18:01:36 +0200
committerThomas White <taw@physics.org>2011-10-05 18:01:36 +0200
commitc89e22542ffd440e646b9217c963ca98c5c7a5ad (patch)
treee78b5445690cc1e348b7e4ac7de9b8b6d4395837 /src/tool_select.c
parent48cbffa2da42612a242f96fa0fd09683e9d1442b (diff)
Redraw and drag logic
Diffstat (limited to 'src/tool_select.c')
-rw-r--r--src/tool_select.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tool_select.c b/src/tool_select.c
index 2e9aa37..6a67ee9 100644
--- a/src/tool_select.c
+++ b/src/tool_select.c
@@ -65,10 +65,20 @@ static void drag_object(struct toolinfo *tip, struct presentation *p,
struct object *o, double x, double y)
{
struct select_toolinfo *ti = (struct select_toolinfo *)tip;
+ double eright, ebottom;
o->x = x + ti->drag_offs_x;
o->y = y + ti->drag_offs_y;
+ /* Enforce margins */
+ eright = o->parent->parent->slide_width - o->style->margin_right;
+ ebottom = o->parent->parent->slide_height - o->style->margin_bottom;
+ if ( o->x < o->style->margin_left ) o->x = o->style->margin_left;
+ if ( o->y < o->style->margin_top ) o->y = o->style->margin_top;
+ if ( o->x+o->bb_width > eright ) o->x = eright - o->bb_width;
+ if ( o->y+o->bb_height > ebottom ) o->y = ebottom - o->bb_height;
+
+ o->update_object(o);
p->view_slide->object_seq++;
gdk_window_invalidate_rect(p->drawingarea->window, NULL, FALSE);