Author: jmorliaguet
Date: Tue Mar  7 16:12:59 2006
New Revision: 2555

Modified:
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
   cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/data2.txt
Log:

- added an option to the tooltip widget to make it follow mouse moves



Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Tue Mar  7 
16:12:59 2006
@@ -2004,6 +2004,7 @@
 
     this.showEvent = this.showEvent.bindAsEventListener(this);
     this.hideEvent = this.hideEvent.bindAsEventListener(this);
+    this.moveEvent = this.moveEvent.bindAsEventListener(this);
     Event.observe(this.area || document, "mouseover", this.showEvent);
     Event.observe(this.area || document, "mouseout", this.hideEvent);
   },
@@ -2033,13 +2034,27 @@
     this.mouseY = Event.pointerY(e);
     this.selected = selected;
 
+    if (this.def.widget.follow) {
+      Event.observe(this.area || document, "mousemove", this.moveEvent);
+    }
+
     this.show();
   },
 
+  moveEvent: function(e) {
+    var mouseX = Event.pointerX(e);
+    var mouseY = Event.pointerY(e);
+    CPSSkins.Canvas.moveTo(this.widget, mouseX+10, mouseY+10);
+  },
+
   hideEvent: function(e) {
     var selected = Event.element(e);
     if (selected != this.selected) return;
 
+    if (this.def.widget.follow) {
+      Event.stopObserving(this.area || document, "mousemove", this.moveEvent);
+    }
+
     this.hide();
   }
 

Modified: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/data2.txt
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/data2.txt  
(original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/data2.txt  
Tue Mar  7 16:12:59 2006
@@ -1,15 +1,15 @@
 
 {"id": "tooltip",
  "widget": {
-   "type": "tooltip"
+   "type": "tooltip",
+   "follow": true
  },
-
  "controllers": ["show-hide-tooltip"],
-
  "show_effect": {
-   "transition": "fadein"
+   "transition": "fadein",
+   "delay": 30
  },
-
  "hide_effect": {
-   "transition": "fadeout"
+   "transition": "fadeout",
+   "delay": 500
 }}
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to