]> git.sur5r.net Git - glabels/commitdiff
Make sure canvas item representing selection region has a finite size.
authorJim Evins <evins@snaught.com>
Sat, 29 Nov 2003 15:58:36 +0000 (15:58 +0000)
committerJim Evins <evins@snaught.com>
Sat, 29 Nov 2003 15:58:36 +0000 (15:58 +0000)
git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@360 f5e0f49d-192f-0410-a22d-a8d8700d0965

glabels2/src/view.c

index 35bfc1839ae31b937ce742c98145e7a999e3fc93..7c0adde99ed9c625bc788ac7231cda89bc8b0168 100644 (file)
@@ -65,6 +65,8 @@
 
 #define POINTS_PER_MM    2.83464566929
 
+#define DELTA 0.01
+
 /*==========================================================================*/
 /* Private types.                                                           */
 /*==========================================================================*/
@@ -3380,8 +3382,10 @@ canvas_event_arrow_mode (GnomeCanvas *canvas,
                                item =
                                    gnome_canvas_item_new (group,
                                                           gnome_canvas_rect_get_type (),
-                                                          "x1", x, "y1", y,
-                                                          "x2", x, "y2", y,
+                                                          "x1", x-DELTA,
+                                                          "y1", y-DELTA,
+                                                          "x2", x+DELTA,
+                                                          "y2", y+DELTA,
                                                           "width_pixels", 2,
                                                           "outline_color_rgba",
                                                           SEL_LINE_COLOR,
@@ -3439,11 +3443,14 @@ canvas_event_arrow_mode (GnomeCanvas *canvas,
                                              event->motion.x,
                                              event->motion.y, &x, &y);
                if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) {
+                       gl_debug (DEBUG_VIEW,
+                                 "Dragging: (x0=%g, y0=%g), (x=%g, y=%g)", x0, y0, x, y);
                        gnome_canvas_item_set (item,
-                                              "x1", MIN (x, x0),
-                                              "y1", MIN (y, y0),
-                                              "x2", MAX (x, x0),
-                                              "y2", MAX (y, y0), NULL);
+                                              "x1", MIN (x, x0) - DELTA,
+                                              "y1", MIN (y, y0) - DELTA,
+                                              "x2", MAX (x, x0) + DELTA,
+                                              "y2", MAX (y, y0) + DELTA,
+                                              NULL);
                        return TRUE;
                } else {
                        return FALSE;