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 // contain the handles correctly - we cannot set |
27 // a bug in firefox makes it use the wrong format |
28 // containment: parent because it wouldn't allow to select the |
28 if (!IriSP.jQuery.browser.mozilla) { |
29 // whole slice, so we have to compute a box in which the slice is |
29 // contain the handles correctly - we cannot set |
30 // allowed to move. |
30 // containment: parent because it wouldn't allow to select the |
31 var containment = [left - 8, top, this.selector.width() + left, top]; |
31 // whole slice, so we have to compute a box in which the slice is |
32 // var containment = [left - 16, top, this.selector.width() + left - 8, top]; |
32 // allowed to move. |
33 this.leftHandle.draggable({axis: "x", |
33 var containment = [left - 8, top, this.selector.width() + left, top]; |
34 drag: IriSP.wrap(this, this.leftHandleDragged), |
34 console.log(containment); |
35 containment: containment |
35 //if (browser. |
36 }); |
36 // var containment = [left - 16, top, this.selector.width() + left - 8, top]; |
|
37 this.leftHandle.draggable({axis: "x", |
|
38 drag: IriSP.wrap(this, this.leftHandleDragged), |
|
39 containment: containment |
|
40 }); |
37 |
41 |
38 containment = [left, top, this.selector.width() + left, top]; |
42 containment = [left, top, this.selector.width() + left, top]; |
39 // containment = [left, top, this.selector.width() + left - 8, top]; |
43 // containment = [left, top, this.selector.width() + left - 8, top]; |
40 this.rightHandle.draggable({axis: "x", |
44 this.rightHandle.draggable({axis: "x", |
41 drag: IriSP.wrap(this, this.rightHandleDragged), |
45 drag: IriSP.wrap(this, this.rightHandleDragged), |
42 containment: containment |
46 containment: containment |
43 }); |
47 }); |
|
48 } else { /* firefox */ |
44 |
49 |
|
50 this.leftHandle.draggable({axis: "x", |
|
51 drag: IriSP.wrap(this, this.leftHandleDragged), |
|
52 containment: parent |
|
53 }); |
|
54 |
|
55 this.rightHandle.draggable({axis: "x", |
|
56 drag: IriSP.wrap(this, this.rightHandleDragged), |
|
57 containment: parent |
|
58 }); |
|
59 } |
|
60 |
45 this.leftHandle.css("position", "absolute"); |
61 this.leftHandle.css("position", "absolute"); |
46 this.rightHandle.css("position", "absolute"); |
62 this.rightHandle.css("position", "absolute"); |
47 |
63 |
48 this._Popcorn.listen("IriSP.SliceWidget.position", |
64 this._Popcorn.listen("IriSP.SliceWidget.position", |
49 IriSP.wrap(this, this.positionSliceHandler)); |
65 IriSP.wrap(this, this.positionSliceHandler)); |