src/js/widgets/sliceWidget.js
branchpopcorn-port
changeset 619 2abc7d900f5e
parent 581 e13380588930
child 689 dfd601bd2ea8
equal deleted inserted replaced
618:79c9a05ddaed 619:2abc7d900f5e
    34   this.leftHandle.css("position", "absolute");
    34   this.leftHandle.css("position", "absolute");
    35   this.rightHandle.css("position", "absolute");
    35   this.rightHandle.css("position", "absolute");
    36   
    36   
    37   this._Popcorn.listen("IriSP.SliceWidget.position", 
    37   this._Popcorn.listen("IriSP.SliceWidget.position", 
    38                         IriSP.wrap(this, this.positionSliceHandler));
    38                         IriSP.wrap(this, this.positionSliceHandler));
    39   this._Popcorn.trigger("IriSP.SliceWidget.position", [57, 24]);
    39   
       
    40   this._Popcorn.listen("IriSP.SliceWidget.show", IriSP.wrap(this, this.show));
       
    41   this._Popcorn.listen("IriSP.SliceWidget.hide", IriSP.wrap(this, this.hide));
       
    42   this.selector.hide();
    40 };
    43 };
    41 
    44 
       
    45 /** responds to an "IriSP.SliceWidget.position" message
       
    46     @param params an array with the first element being the left distance in
       
    47            percents and the second element the width of the slice in pixels
       
    48 */        
    42 IriSP.SliceWidget.prototype.positionSliceHandler = function(params) {
    49 IriSP.SliceWidget.prototype.positionSliceHandler = function(params) {
    43   left = params[0];
    50   left = params[0];
    44   width = params[1];
    51   width = params[1];
    45   
    52   
    46   this.zoneLeft = left;
    53   this.zoneLeft = left;
   106   var leftPercent = (this.zoneLeft / this.selector.width()) * 100;
   113   var leftPercent = (this.zoneLeft / this.selector.width()) * 100;
   107   var zonePercent = (this.zoneWidth / this.selector.width()) * 100;
   114   var zonePercent = (this.zoneWidth / this.selector.width()) * 100;
   108   
   115   
   109   this._Popcorn.trigger("IriSP.SliceWidget.zoneChange", [leftPercent, zonePercent]);  
   116   this._Popcorn.trigger("IriSP.SliceWidget.zoneChange", [leftPercent, zonePercent]);  
   110 };
   117 };
       
   118 
       
   119 IriSP.SliceWidget.prototype.show = function() {
       
   120   this.selector.show();
       
   121 };
       
   122 
       
   123 IriSP.SliceWidget.prototype.hide = function() {
       
   124   this.selector.hide();
       
   125 };