changeset 2:f7ed81674650

fixed buggy mouse support
author Atul Varma <avarma@mozilla.com>
date Sun, 02 May 2010 04:30:06 -0700
parents 66a402d86094
children d7b17c17bfeb
files index.html
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/index.html	Sun May 02 04:23:55 2010 -0700
+++ b/index.html	Sun May 02 04:30:06 2010 -0700
@@ -161,11 +161,11 @@
       startX = event.clientX;
       startY = event.clientY;
       isMouseDown = true;
-      $(this).addClass("active");
+      $(node).addClass("active");
       updateInfo();
     });
 
-    $(node).bind("mousemove", function(event) {
+    $(node.ownerDocument).bind("mousemove", function(event) {
       if (isMouseDown) {
         currX = event.clientX;
         currY = event.clientY;
@@ -176,17 +176,14 @@
       }
     });
 
-    function maybeDeactivate(event) {
+    $(node.ownerDocument).bind("mouseup", function(event) {
       if (isMouseDown) {
         event.preventDefault();
         isMouseDown = false;
-        $(this).removeClass("active");
+        $(node).removeClass("active");
         updateInfo();
       }
-    }
-
-    $(node).bind("mouseout", maybeDeactivate);
-    $(node).bind("mouseup", maybeDeactivate);
+    });
   } else {
     $(node).bind("touchstart", function(event) {
       event.preventDefault();