src/js/widgets/sliceWidget.js
branchslicewidget-redo
changeset 780 2ae03b1d2797
parent 775 59927257f43b
child 781 d27d429597f4
equal deleted inserted replaced
779:52be94ec8e1c 780:2ae03b1d2797
    22   this.rightHandle = this.selector.find(".Ldt-sliceRightHandle");
    22   this.rightHandle = this.selector.find(".Ldt-sliceRightHandle");
    23 
    23 
    24   var left = this.selector.offset().left;
    24   var left = this.selector.offset().left;
    25   var top = this.selector.offset().top;
    25   var top = this.selector.offset().top;
    26 
    26 
    27   // a bug in firefox makes it use the wrong format
    27   var containment = [left - 8, top, this.selector.width() + left, top];
    28   if (!IriSP.jQuery.browser.mozilla) {
       
    29     // contain the handles correctly - we cannot set
       
    30     // containment: parent because it wouldn't allow to select the 
       
    31     // whole slice, so we have to compute a box in which the slice is
       
    32     // allowed to move.
       
    33     var containment = [left - 8, top, this.selector.width() + left, top];
       
    34 
    28 
    35     // var containment = [left - 16, top, this.selector.width() + left - 8, top];
    29   // var containment = [left - 16, top, this.selector.width() + left - 8, top];
    36     this.leftHandle.draggable({axis: "x",
    30   this.leftHandle.draggable({axis: "x",
    37     drag: IriSP.wrap(this, this.leftHandleDragged),  
    31   drag: IriSP.wrap(this, this.leftHandleDragged),  
    38     containment: containment
    32   containment: "parent"
    39     });
    33   });
    40 
    34 
    41     containment = [left, top, this.selector.width() + left, top];
    35   containment = [left, top, this.selector.width() + left, top];
    42     // containment = [left, top, this.selector.width() + left - 8, top];
    36   // containment = [left, top, this.selector.width() + left - 8, top];
    43     this.rightHandle.draggable({axis: "x",
    37   this.rightHandle.draggable({axis: "x",
    44     drag: IriSP.wrap(this, this.rightHandleDragged),    
    38   drag: IriSP.wrap(this, this.rightHandleDragged),    
    45     containment: containment
    39   containment: "parent"
    46     });
    40   });
    47   
    41   
    48   } else { // firefox
       
    49     // we need to define a containment specific to firefox.
       
    50     
       
    51     var containment = [left - 16, top, this.selector.width() + left - 8, top];
       
    52     this.leftHandle.draggable({axis: "x",
       
    53     drag: IriSP.wrap(this, this.leftHandleDragged),  
       
    54     containment: containment
       
    55     });
       
    56 
       
    57     containment = [left, top, this.selector.width() + left - 8, top];
       
    58     this.rightHandle.draggable({axis: "x",
       
    59     drag: IriSP.wrap(this, this.rightHandleDragged),    
       
    60     containment: containment
       
    61     });
       
    62   }
       
    63   
    42   
    64   this.leftHandle.css("position", "absolute");
    43   this.leftHandle.css("position", "absolute");
    65   this.rightHandle.css("position", "absolute");
    44   this.rightHandle.css("position", "absolute");
    66   
    45   
    67   this._Popcorn.listen("IriSP.SliceWidget.position", 
    46   this._Popcorn.listen("IriSP.SliceWidget.position",