[KSS-checkins] r50976 - kukit/kukit.js/branch/extend-mouseover/kukit

jone at codespeak.net jone at codespeak.net
Thu Jan 24 17:22:28 CET 2008


Author: jone
Date: Thu Jan 24 17:22:27 2008
New Revision: 50976

Modified:
   kukit/kukit.js/branch/extend-mouseover/kukit/plugin.js
Log:
mouse events: added some information like positions or pressed buttons to event

Modified: kukit/kukit.js/branch/extend-mouseover/kukit/plugin.js
==============================================================================
--- kukit/kukit.js/branch/extend-mouseover/kukit/plugin.js	(original)
+++ kukit/kukit.js/branch/extend-mouseover/kukit/plugin.js	Thu Jan 24 17:22:27 2008
@@ -203,6 +203,50 @@
     pl.registerBrowserEvent(oper, null, name);
 };
 
+this.__bind_mouse__node = function(name, func_to_bind, oper) {
+;;; if (oper.node == null) {
+;;;     throw new Error('Native event [' + name + '] must be bound to a node.');
+;;; }
+    this.__bind_mouse__(name, func_to_bind, oper);
+};
+
+this.__bind_mouse__nodeordocument = function(name, func_to_bind, oper) {
+    if (oper.node == null) {
+        oper.node = document;
+    }
+    this.__bind_mouse__(name, func_to_bind, oper);
+};
+
+this.__bind_mouse__ = function(name, func_to_bind, oper) {
+;;; oper.componentName = 'native mouse event binding';
+    oper.evaluateParameters([], 
+        {'preventdefault': '', 'allowbubbling': '', 'preventbubbling': ''});
+    oper.evalBool('preventdefault');
+    oper.evalBool('allowbubbling');
+    oper.evalBool('preventbubbling');
+    var provideEventData = function(oper) {
+        oper.defaultParameters = {
+            screenX : oper.browserevent.screenX.toString(),
+            screenY : oper.browserevent.screenY.toString(),
+            clientX : oper.browserevent.clientX.toString(),
+            clientY : oper.browserevent.clientY.toString(),
+            layerX : oper.browserevent.layerX.toString(),
+            layerY : oper.browserevent.layerY.toString(),
+            pageX : oper.browserevent.pageX.toString(),
+            pageY : oper.browserevent.pageY.toString(),
+            controlKey : oper.browserevent.controlKey ? 'True' : 'False',
+            shiftKey : oper.browserevent.shiftKey ? 'True' : 'False',
+            altKey : oper.browserevent.altKey ? 'True' : 'False',
+            metaKey : oper.browserevent.metaKey ? 'True' : 'False',
+            button : oper.browserevent.button.toString(),
+        };
+        return true;
+    }
+    // we give the name parameter to the registration, so we
+    // really bind to the event name we want.
+    pl.registerBrowserEvent(oper, provideEventData);
+};
+
 this.__bind_key__ =
     function(name, func_to_bind, oper) {
 ;;; oper.componentName = 'native key event binding';
@@ -562,19 +606,19 @@
 kukit.eventsGlobalRegistry.register(null, 'resize', kukit.pl.NativeEventBinder,
     '__bind__nodeorwindow', null);
 kukit.eventsGlobalRegistry.register(null, 'click', kukit.pl.NativeEventBinder,
-    '__bind__nodeordocument', null);
+    '__bind_mouse__nodeordocument', null);
 kukit.eventsGlobalRegistry.register(null, 'dblclick',
     kukit.pl.NativeEventBinder, '__bind__node', null);
 kukit.eventsGlobalRegistry.register(null, 'mousedown',
-    kukit.pl.NativeEventBinder, '__bind__nodeordocument', null);
+    kukit.pl.NativeEventBinder, '__bind_mouse__nodeordocument', null);
 kukit.eventsGlobalRegistry.register(null, 'mouseup',
-    kukit.pl.NativeEventBinder, '__bind__nodeordocument', null);
+    kukit.pl.NativeEventBinder, '__bind_mouse__nodeordocument', null);
 kukit.eventsGlobalRegistry.register(null, 'mousemove',
-    kukit.pl.NativeEventBinder, '__bind__nodeordocument', null);
+    kukit.pl.NativeEventBinder, '__bind_mouse__nodeordocument', null);
 kukit.eventsGlobalRegistry.register(null, 'mouseover',
-    kukit.pl.NativeEventBinder, '__bind__node', null);
+    kukit.pl.NativeEventBinder, '__bind_mouse__node', null);
 kukit.eventsGlobalRegistry.register(null, 'mouseout',
-    kukit.pl.NativeEventBinder, '__bind__node', null);
+    kukit.pl.NativeEventBinder, '__bind_mouse__node', null);
 kukit.eventsGlobalRegistry.register(null, 'change',
     kukit.pl.NativeEventBinder, '__bind__node', null);
 kukit.eventsGlobalRegistry.register(null, 'reset',


More information about the Kukit-checkins mailing list