changeset 48:f472fdcc4027

The top window now properly repositions itself whenever the window is resized.
author Atul Varma <varmaa@toolness.com>
date Fri, 16 May 2008 00:43:45 -0700
parents 1effb310d6ee
children 2c4d6b171f60
files trivial-zui.js
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/trivial-zui.js	Fri May 16 00:35:06 2008 -0700
+++ b/trivial-zui.js	Fri May 16 00:43:45 2008 -0700
@@ -2,9 +2,6 @@
 var RETURN_KEYCODE = 13;
 
 function TrivialZui() {
-  var contentLeft = $("#content").get(0).offsetLeft + "px";
-  $("#top-window").get(0).style.left = contentLeft;
-
   this._size = [80, 255];
   this._console = null;
   this._activeWindow = 0;
@@ -88,6 +85,11 @@
       }
     },
 
+    _windowResize: function() {
+      var contentLeft = $("#content").get(0).offsetLeft + "px";
+      $("#top-window").get(0).style.left = contentLeft;
+    },
+
     _eraseBottomWindow: function() {
       $("#content").html("");
     },
@@ -170,7 +172,10 @@
     }
   };
 
+  self._windowResize();
+
   $(window).keypress(self._windowKeypress);
+  $(window).resize(self._windowResize);
 
   // We want to make sure that all key events don't bubble up, so
   // that anything listening in--such as Firefox's "Search for text