Skip to content

Commit

Permalink
Let the progress bar fill the space at 100%,fixes videojs#1247
Browse files Browse the repository at this point in the history
  • Loading branch information
moshoujingli committed Dec 31, 2014
1 parent c939ab8 commit f13a8d9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/css/video-js.less
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ fonts to show/hide properly.
}

.vjs-default-skin .vjs-seek-handle {
width: 1.5em;
width: 1em;
height: 100%;
}

Expand Down
12 changes: 2 additions & 10 deletions src/js/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,8 @@ vjs.Slider.prototype.update = function(){
// The width of the handle in percent of the containing box
// In IE, widths may not be ready yet causing NaN
handlePercent = (handleWidth) ? handleWidth / boxWidth : 0,

// Get the adjusted size of the box, considering that the handle's center never touches the left or right side.
// There is a margin of half the handle's width on both sides.
boxAdjustedPercent = 1 - handlePercent,

// Adjust the progress that we'll use to set widths to the new adjusted box width
adjustedProgress = progress * boxAdjustedPercent;

// The bar does reach the left side, so we need to account for this in the bar's width
barProgress = adjustedProgress + (handlePercent / 2);
//make the center of the handler is align to the left side of the progress bar horizontally
adjustedProgress = progress - handlePercent/2;

// Move the handle from the left based on the adjected progress
handle.el().style.left = vjs.round(adjustedProgress * 100, 2) + '%';
Expand Down

0 comments on commit f13a8d9

Please sign in to comment.