From c89e22542ffd440e646b9217c963ca98c5c7a5ad Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 5 Oct 2011 18:01:36 +0200 Subject: Redraw and drag logic --- src/tool_select.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/tool_select.c') 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); -- cgit v1.2.3