src/js/widgets/sliderWidget.js
branchpopcorn-port
changeset 731 e02f43299022
parent 488 ab73470647cb
child 739 d28b9acfc445
equal deleted inserted replaced
730:357fc047503b 731:e02f43299022
    59      the position Marker */
    59      the position Marker */
    60   var pixels_to_percents = 100 / this.selector.width(); /* how much is a pixel in percents */
    60   var pixels_to_percents = 100 / this.selector.width(); /* how much is a pixel in percents */
    61   var positionMarker_width = this.positionMarker.width();
    61   var positionMarker_width = this.positionMarker.width();
    62   var correction = (pixels_to_percents * positionMarker_width) / 2;
    62   var correction = (pixels_to_percents * positionMarker_width) / 2;
    63 
    63 
       
    64   /* check that we don't leave the left side */
    64   var newPos = percent - correction;
    65   var newPos = percent - correction;
    65   if (newPos <= 0)
    66   if (newPos <= 0)
    66     newPos = 0;
    67     newPos = 0;
       
    68   
       
    69   /* check that we don't leave the right side */
       
    70   var outPos = percent + correction;
       
    71   if (outPos > 100)
       
    72     newPos = 100;
    67   
    73   
    68 	this.sliderForeground.css("width", percent + "%");
    74 	this.sliderForeground.css("width", percent + "%");
    69 	this.positionMarker.css("left", newPos + "%");
    75 	this.positionMarker.css("left", newPos + "%");
    70 
    76 
    71 };
    77 };