Author: jmorliaguet
Date: Sun Jan  1 20:13:23 2006
New Revision: 2110

Modified:
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
Log:

- added a fade-in effect to contextual menus



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 Sun Jan  1 
20:13:23 2006
@@ -292,8 +292,9 @@
     var x = Event.pointerX(e);
     var y = Event.pointerY(e);
 
+    var widget = this.widget;
     if (this.active) {
-      if (Position.within(this.widget, x, y)) {
+      if (Position.within(widget, x, y)) {
         var action = element.getAttribute("action");
         if (!action) return;
         var confirm = element.getAttribute("confirm");
@@ -306,7 +307,7 @@
           handler(this.selected, choice);
         }
       }
-      Element.hide(this.widget);
+      Element.hide(widget);
 
     } else {
       this.selected = Identifiable.getIdentifiable(element);
@@ -349,12 +350,22 @@
     });
 
     this._drawNode(widget, view);
-    Element.show(widget);
+
+    if (this.effect) this.effect.stop();
+    this.effect = new CPSSkins.Effect(widget, {
+      action: function(value) {
+        Canvas.setOpacity(widget, value);
+        },
+      onComplete: function() {
+        Element.show(widget);
+      }
+    });
+
   },
 
-  _drawNode: function(container, view) {
+  _drawNode: function(container, fragment) {
     var data = Canvas.getNodeData(this.selected);
-    var tags = view.childNodes;
+    var tags = fragment.childNodes;
 
     for (var i=0;i<tags.length;i++) {
       var tag = tags[i];
@@ -433,7 +444,18 @@
 
           var mouseOverEvent = function(e) {
             var menu = this._getSubmenu(e);
-            if (menu) Element.show(menu);
+            if (menu) {
+
+              if (this.effect) this.effect.stop();
+              this.effect = new CPSSkins.Effect(menu, {
+                action: function(value) {
+                  Canvas.setOpacity(menu, value);
+                },
+                onComplete: function() {
+                  Element.show(menu);
+                }
+              });
+            }
           }.bindAsEventListener(this);
           Event.observe(item, "mouseover", mouseOverEvent);
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to