[graph-gtk] Improved connection bezier curve look



commit bbead1e98aa43e33d6b6d76fd91cd6b07141270f
Author: Isaac Wagner <isaacbw src gnome org>
Date:   Tue Jul 31 09:19:19 2012 -0400

    Improved connection bezier curve look

 graph-gtk/graph-gtk-connection.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/graph-gtk/graph-gtk-connection.c b/graph-gtk/graph-gtk-connection.c
index 0afc722..f52ecaa 100644
--- a/graph-gtk/graph-gtk-connection.c
+++ b/graph-gtk/graph-gtk-connection.c
@@ -1,5 +1,6 @@
 #include "graph-gtk-connection.h"
 
+#include <math.h>
 
 static void graph_gtk_connection_dispose (GObject *object);
 static void graph_gtk_connection_finalize (GObject *object);
@@ -53,13 +54,17 @@ graph_gtk_connection_default_render(GraphGtkConnection* self, cairo_t* cr)
 
   cairo_move_to(cr, from_x, from_y);
 
-  if(to_x - from_x > 100)
+  gdouble offset = 
+    ((to_x > from_x) ? ((to_x-from_x)/2) : ((from_x-to_x)/2))
+    + abs(from_y-to_y)/6;
+
+  /*  if(to_x - from_x > 100)
     cairo_curve_to(cr, (from_x+to_x)/2, from_y,
 		   (from_x+to_x)/2, to_y,
 		   to_x, to_y);
-  else
-    cairo_curve_to(cr, from_x+50, from_y,
-		   to_x-50, to_y,
+		   else*/
+    cairo_curve_to(cr, from_x+offset, from_y,
+		   to_x-offset, to_y,
 		   to_x, to_y);
 
   //cairo_line_to(cr, to_x, to_y);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]