Replace _position with _x and _y for simplicity
authorBenjamin Smedberg <benjamin@smedbergs.us>
Mon, 14 Apr 2008 10:30:38 -0400
changeset 13 a74f146eb2de46aede0e6d387b197e5eefd9cca7
parent 12 de26e8c9b7350e2c50f7002203245a8958c99d3b
child 14 92e5cfcae5553de1597e237e271e62e39185f380
push id1
push userbsmedberg@mozilla.com
push dateMon, 14 Apr 2008 15:21:26 +0000
Replace _position with _x and _y for simplicity
www/navigate.js
--- a/www/navigate.js
+++ b/www/navigate.js
@@ -79,17 +79,18 @@ function Revision(node)
   this.node = node;
   this.revnode = "??: " + this.shortnode();
   this.revnodelen = measure(this.revnode);
 }
 
 Revision.prototype = {
   parents: [],
   children: [],
-  _position: null,
+  _x: null,
+  _y: null,
 
   loaded: function r_loaded()
   {
     return 'rev' in this;
   },
 
   update: function r_update(data)
   {
@@ -114,27 +115,27 @@ Revision.prototype = {
     this.descSplit = [line for (line in splitText(data.description))];
 
     this.children = [getRevision(node) for each (node in data.children)];
     this.parents = [getRevision(node) for each (node in data.parents)];
   },
 
   /* x and y are the center of the revision */
   x: function r_x() {
-    if (!this._position)
+    if (this._x == null)
       throw Error("Revision " + this.node + " is not positioned.");
 
-    return this._position.x;
+    return this._x;
   },
 
   y: function r_y() {
-    if (!this._position)
+    if (this._y == null)
       throw Error("Revision " + this.node + " is not positioned.");
 
-    return this._position.y;
+    return this._y;
   },
 
   /* height */
   height: function r_height() {
     if (this.loaded()) {
       return 12 * (3 + this.descSplit.length) + 4;
     }
     
@@ -146,17 +147,18 @@ Revision.prototype = {
    */
   moveTo: function r_move(x, y) {
     if (isNaN(x))
       throw Error("x is NaN");
 
     if (isNaN(y))
       throw Error("y is NaN");
 
-    this._position = {'x': x, 'y': y};
+    this._x = x;
+    this._y = y;
   },
 
   shortnode: function r_shortnode()
   {
     return this.node.slice(0, 12);
   },
 
   hittest: function r_hittest(x, y)
@@ -176,17 +178,17 @@ Revision.prototype = {
 
     return false;
   },
 
   toString: function r_toString()
   {
     return "Revision:" +
     "\nnode: " + this.node +
-    "\nposition: " + uneval(this._position) +
+    "\nposition: " + this._x + ", " + this._y +
     "\ndescSplit: " + uneval(this.descSplit);
   }
 };
 
 function limit(str, len)
 {
   if (str.length < len)
     return str;