Index: graph_displayer_canvas-event.cc
===================================================================
--- graph_displayer_canvas-event.cc	(revision 96)
+++ graph_displayer_canvas-event.cc	(revision 98)
@@ -148,9 +148,9 @@
         double coord_y = new_y - (clicked_y - (mytab.mapstorage).coords[active_node].y);
 
+        // write back the new coordinates to the coords map
+        (mytab.mapstorage).coords.set(active_node, xy<double>(coord_x, coord_y));
+
         clicked_x=new_x;
         clicked_y=new_y;
-
-        // write back the new coordinates to the coords map
-        (mytab.mapstorage).coords.set(active_node, xy<double>(coord_x, coord_y));
 
         // reposition the coordinates text
@@ -184,25 +184,23 @@
         for(OutEdgeIt ei((mytab.mapstorage).graph,active_node);ei!=INVALID;++ei)
         {
-            Gnome::Canvas::Points coos;
-            double x1, x2, y1, y2;
-
-            nodesmap[(mytab.mapstorage).graph.source(ei)]->get_bounds(x1, y1, x2, y2);
-            coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
-
-            nodesmap[(mytab.mapstorage).graph.target(ei)]->get_bounds(x1, y1, x2, y2);
-            coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
-
+            XY moved_node_1(coord_x - dx, coord_y - dy);
+            XY moved_node_2(coord_x, coord_y);
+            Node target = mytab.mapstorage.graph.target(ei);
+            XY fix_node(mytab.mapstorage.coords[target].x,
+                        mytab.mapstorage.coords[target].y);
+            XY old_arrow_pos(mytab.mapstorage.arrow_pos[ei]);
+
+            XY arrow_pos;
 	    if(isbutton==3)
-	      {
-		edgesmap[ei]->setPoints(coos);
-	      }
+              arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, false);
 	    else
-	      {
-		edgesmap[ei]->setPoints(coos,true);
-	      }
+              arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, true);
+
+            mytab.mapstorage.arrow_pos.set(ei, arrow_pos);
+            edgesmap[ei]->draw();
 
 	    //reposition of edgetext
-	    xy<double> text_pos=edgesmap[ei]->getArrowPos();
-	    text_pos+=(xy<double>(10,10));
+	    XY text_pos=mytab.mapstorage.arrow_pos[ei];
+	    text_pos+=(XY(10,10));
 	    edgetextmap[ei]->property_x().set_value(text_pos.x);
 	    edgetextmap[ei]->property_y().set_value(text_pos.y);
@@ -211,24 +209,23 @@
         for(InEdgeIt ei((mytab.mapstorage).graph,active_node);ei!=INVALID;++ei)
         {
-            Gnome::Canvas::Points coos;
-            double x1, x2, y1, y2;
-
-            nodesmap[(mytab.mapstorage).graph.source(ei)]->get_bounds(x1, y1, x2, y2);
-            coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
-
-            nodesmap[(mytab.mapstorage).graph.target(ei)]->get_bounds(x1, y1, x2, y2);
-            coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
-
+            XY moved_node_1(coord_x - dx, coord_y - dy);
+            XY moved_node_2(coord_x, coord_y);
+            Node source = mytab.mapstorage.graph.source(ei);
+            XY fix_node(mytab.mapstorage.coords[source].x,
+                        mytab.mapstorage.coords[source].y);
+            XY old_arrow_pos(mytab.mapstorage.arrow_pos[ei]);
+
+            XY arrow_pos;
 	    if(isbutton==3)
-	      {
-		edgesmap[ei]->setPoints(coos);
-	      }
+              arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, false);
 	    else
-	      {
-		edgesmap[ei]->setPoints(coos,true);
-	      }
-
-	    xy<double> text_pos=edgesmap[ei]->getArrowPos();
-	    text_pos+=(xy<double>(10,10));
+              arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, true);
+
+            mytab.mapstorage.arrow_pos.set(ei, arrow_pos);
+            edgesmap[ei]->draw();
+
+	    //reposition of edgetext
+	    XY text_pos=mytab.mapstorage.arrow_pos[ei];
+	    text_pos+=(XY(10,10));
 	    edgetextmap[ei]->property_x().set_value(text_pos.x);
 	    edgetextmap[ei]->property_y().set_value(text_pos.y);
@@ -239,4 +236,56 @@
 
   return false;
+}
+
+XY GraphDisplayerCanvas::calcArrowPos(XY moved_node_1, XY moved_node_2, XY fix_node, XY old_arrow_pos, bool move)
+{
+  if(!move)
+  {
+    return XY((moved_node_2.x + fix_node.x) / 2.0, (moved_node_2.y + fix_node.y) / 2.0);
+  }
+  else
+  {
+    //////////////////////////////////////////////////////////////////////////////////////////////////////
+    /////////// keeps shape-with scalar multiplication - version 2.
+    //////////////////////////////////////////////////////////////////////////////////////////////////////
+
+    //old vector from one to the other node - a
+    xy<double> a_v(moved_node_1.x-fix_node.x,moved_node_1.y-fix_node.y);
+    //new vector from one to the other node - b
+    xy<double> b_v(moved_node_2.x-fix_node.x,moved_node_2.y-fix_node.y);
+
+    double absa=sqrt(a_v.normSquare());
+    double absb=sqrt(b_v.normSquare());
+
+    if ((absa == 0.0) || (absb == 0.0))
+    {
+      return old_arrow_pos;
+    }
+    else
+    {
+      //old vector from one node to the breakpoint - c
+      xy<double> c_v(old_arrow_pos.x-fix_node.x,old_arrow_pos.y-fix_node.y);
+
+      //unit vector with the same direction to a_v
+      xy<double> a_v_u(a_v.x/absa,a_v.y/absa);
+
+      //normal vector of unit vector with the same direction to a_v
+      xy<double> a_v_u_n(((-1)*a_v_u.y),a_v_u.x);
+
+      //unit vector with the same direction to b_v
+      xy<double> b_v_u(b_v.x/absb,b_v.y/absb);
+
+      //normal vector of unit vector with the same direction to b_v
+      xy<double> b_v_u_n(((-1)*b_v_u.y),b_v_u.x);
+
+      //vector c in a_v_u and a_v_u_n co-ordinate system
+      xy<double> c_a(c_v*a_v_u,c_v*a_v_u_n);
+
+      //new vector from one node to the breakpoint - d - we have to calculate this one
+      xy<double> d_v=absb/absa*(c_a.x*b_v_u+c_a.y*b_v_u_n);
+
+      return XY(d_v.x+fix_node.x,d_v.y+fix_node.y);
+    }
+  }
 }
 
@@ -406,5 +455,5 @@
 
               //drawing new edge
-              edgesmap[active_edge]=new BrokenEdge(displayed_graph, coos,
+              edgesmap[active_edge]=new BrokenEdge(displayed_graph, active_edge,
                   *this);
               *(edgesmap[active_edge]) <<
@@ -415,6 +464,6 @@
 
               //initializing edge-text as well, to empty string
-              xy<double> text_pos=edgesmap[active_edge]->getArrowPos();
-              text_pos+=(xy<double>(10,10));
+              XY text_pos=mytab.mapstorage.arrow_pos[active_edge];
+              text_pos+=(XY(10,10));
 
               edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph,
