Author: jmorliaguet
Date: Tue Mar  7 22:38:34 2006
New Revision: 2558

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

- drag-and-drop controller: made it possible to specify drag handles



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 
22:38:34 2006
@@ -610,12 +610,19 @@
 
   register: function(view) {
     var dragEvent = this.dragEvent;
-    (this.def.draggable || []).each(function(d) {
-      $$(d).each(function(el) {
+    var handle = this.def.handle;
+    var draggable = this.def.draggable || [];
+
+    if (!handle) { handle = draggable; }
+    handle.each(function(h) {
+      $$(h).each(function(el) {
         Event.observe(el, "mousedown", dragEvent);
-        el._cpsskins_draggable = true;
+        el.setStyle({'cursor': 'move'});
       });
     });
+    draggable.each(function(d) {
+      $$(d).each(function(el) { el._cpsskins_draggable = true; });
+    });
   },
 
   _findDraggable: function(e) {
@@ -627,12 +634,13 @@
   },
 
   dragEvent: function(e) {
-    this.moved = this._findDraggable(e);
-    var pos = Position.page(this.moved);
+    var draggable = this._findDraggable(e);
+    var pos = Position.page(draggable);
     this.x0 = Event.pointerX(e) - pos[0];
     this.y0 = Event.pointerY(e) - pos[1];
     Event.observe(document, "mousemove", this.moveEvent);
     Event.observe(document, "mouseup", this.dropEvent);
+    this.moved = draggable;
   },
 
   moveEvent: function(e) {
@@ -1402,8 +1410,6 @@
     this.def = def;
 
     this.setup();
-
-    this.widget._is_cpsskins_widget = true;
   },
 
   hash: function() {
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to