Bug Tracker

Changeset 460

Show
Ignore:
Timestamp:
10/21/06 17:54:13 (2 years ago)
Author:
stefan
Message:

Fixed support for multiple handlers and destroy draggables

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • plugins/interface/idrag.js

    r458 r460  
    2121            { 
    2222                if (this.isDraggable) { 
    23                     //--[OLD] 
    24                     //this.dragElem = null; 
    25                     //jQuery(this).unbind('mousedown', jQuery.iDrag.dragstart); 
    26                     //--[/OLD] 
    27  
    28                     // - First, unbind the mousedown code from the "dragElem" (handle or object itself). 
    29                     // - This is NOT dragstart, but draginit 
    30                     this.dragElem.unbind('mousedown', jQuery.iDrag.draginit); 
    31  
    32                     // Next, free the dragelement 
    33                     this.dragElem = null; 
    34  
    35                     // And unset the "isDraggable" flag, so you can restart the drag later on. 
     23                    this.dragCfg.dhe.unbind('mousedown', jQuery.iDrag.draginit); 
     24                    this.dragCfg = null; 
    3625                    this.isDraggable = false; 
    3726                } 
     
    480469                    this.ondragstart = function(){return false;}; 
    481470                } 
     471                var el = this; 
    482472                var dhe = o.handle ? jQuery(this).find(o.handle) : jQuery(this); 
    483473                this.dragCfg = { 
     474                    dhe: dhe, 
    484475                    revert : o.revert ? true : false, 
    485476                    ghosting : o.ghosting ? true : false, 
     
    523514 
    524515                this.isDraggable = true; 
    525                 dhe.get(0).dragElem = this; 
    526                 //--[OLD] 
    527                 //dhe.bind('mousedown', jQuery.iDrag.draginit); 
    528                 //--[/OLD] 
    529  
    530                 // This line makes sure the DraggableDestroy knows the handler (or object) to undind the event from. 
    531                 this.dragElem = dhe; 
    532                 this.dragElem.bind('mousedown', jQuery.iDrag.draginit); 
     516                dhe.each( 
     517                    function(){ 
     518                        this.dragElem = el; 
     519                    } 
     520                ); 
     521                dhe.bind('mousedown', jQuery.iDrag.draginit); 
    533522            } 
    534523        )