Hide the velocity vector if it is null.
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Wed, 03 Oct 2007 17:38:05 +0100
changeset 1667 469d3a87afa4
parent 1666 cbf163e47dfe
child 1668 2dfe3ae77990
Hide the velocity vector if it is null.
utils/mobility-visualizer-view.cc
--- a/utils/mobility-visualizer-view.cc	Wed Oct 03 17:33:45 2007 +0100
+++ b/utils/mobility-visualizer-view.cc	Wed Oct 03 17:38:05 2007 +0100
@@ -45,15 +45,24 @@
   {
     g_object_set (m_item, "center_x", x, "center_y", y, NULL);
     
-    GooCanvasPoints *points = goo_canvas_points_new (2);
+    if (vx == 0 && vy == 0)
+      {
+        GooCanvasPoints *points = goo_canvas_points_new (0);
+        g_object_set (m_vector, "points", points, NULL);
+        goo_canvas_points_unref (points);
+      }
+    else
+      {
+        GooCanvasPoints *points = goo_canvas_points_new (2);
 
-    points->coords[0] = x;
-    points->coords[1] = y;
-    points->coords[2] = x + vx;
-    points->coords[3] = y + vy;
+        points->coords[0] = x;
+        points->coords[1] = y;
+        points->coords[2] = x + vx;
+        points->coords[3] = y + vy;
 
-    g_object_set (m_vector, "points", points, NULL);
-    goo_canvas_points_unref (points);
+        g_object_set (m_vector, "points", points, NULL);
+        goo_canvas_points_unref (points);
+      }
   }
 };