Draw arrows from revisions that aren't loaded yet.
authorBenjamin Smedberg <benjamin@smedbergs.us>
Mon, 14 Apr 2008 13:33:22 -0400
changeset 19 26235cd436e1808ecc83f9232b8fee936c273c76
parent 18 d4ea0f486b60485e08715df03a1f5a9ed4988535
child 20 a7a50641c6306dae46c677d470bf6bb54767a1a4
push id2
push userbsmedberg@mozilla.com
push dateMon, 14 Apr 2008 21:07:23 +0000
Draw arrows from revisions that aren't loaded yet.
www/navigate.js
--- a/www/navigate.js
+++ b/www/navigate.js
@@ -79,22 +79,16 @@ function splitText(t, cx)
 
     yield str;
     unplaced = placed;
   }
 }
 
 /**
  * map from long node strings to Revision objects
- * The following mappings are added to the JSON:
- *   .element from the node to the element
- *   .parentArrows is a map of arrows pointing to this element, keyed on
- *                 parent node
- *   .childArrows  is a map of arrows pointing from this element, keyed on
- *                 child node
  */
 
 var revs = {};
 
 function getRevision(node)
 {
   if (!(node in revs)) {
     revs[node] = new Revision(node);
@@ -482,16 +476,33 @@ function redraw()
         childx = child.ax() - REVWIDTH / 2;
         childy = child.ay();
       }
       cx.beginPath();
       cx.moveTo(r.ax(), r.ay());
       cx.lineTo(childx, childy);
       cx.stroke();
     }
+
+    /* draw arrows to this revision from nodes which aren't loaded yet,
+     and therefore don't have a usable "children" property */
+    for each (let parent in r.parents) {
+      if (!parent.loaded()) {
+        let parentx = r.ax() - 100;
+        let parenty = r.ay();
+        if (parent.gc) {
+          parentx = parent.ax() + REVWIDTH / 2;
+          parenty = parent.ay();
+        }
+        cx.beginPath();
+        cx.moveTo(parentx, parenty);
+        cx.lineTo(r.ax(), r.ay());
+        cx.stroke();
+      }
+    }
   }
 
   cx.clearRect(0, 0, gWidth, gHeight);
 
   cx.save();
   cx.lineWidth = 2;
   for each (let rev in revs) {
     if (rev.gc)