mirror of
https://github.com/videojs/video.js.git
synced 2025-01-02 06:32:07 +02:00
@misternoneill fixed vertical slider issues. closes #2469
This commit is contained in:
parent
06f16d993e
commit
79e58884de
@ -98,6 +98,7 @@ CHANGELOG
|
||||
* @gkatsev fixed text track errors on dispose and in cross-browser testing ([view](https://github.com/videojs/video.js/pull/2466))
|
||||
* @mmcc added type=button to button components ([view](https://github.com/videojs/video.js/pull/2471))
|
||||
* @mmcc Fixed IE by using setAttribute to set 'type' property ([view](https://github.com/videojs/video.js/pull/2487))
|
||||
* @misternoneill fixed vertical slider issues ([view](https://github.com/videojs/video.js/pull/2469))
|
||||
|
||||
--------------------
|
||||
|
||||
|
@ -19,12 +19,11 @@ class Slider extends Component {
|
||||
constructor(player, options) {
|
||||
super(player, options);
|
||||
|
||||
// Set property names to bar and handle to match with the child Slider class is looking for
|
||||
this.bar = this.getChild(this.options_['barName']);
|
||||
this.handle = this.getChild(this.options_['handleName']);
|
||||
// Set property names to bar to match with the child Slider class is looking for
|
||||
this.bar = this.getChild(this.options_.barName);
|
||||
|
||||
// Set a horizontal or vertical class on the slider depending on the slider type
|
||||
this.vertical(!!this.options_['vertical']);
|
||||
this.vertical(!!this.options_.vertical);
|
||||
|
||||
this.on('mousedown', this.handleMouseDown);
|
||||
this.on('touchstart', this.handleMouseDown);
|
||||
@ -150,9 +149,8 @@ class Slider extends Component {
|
||||
let box = Dom.findElPosition(el);
|
||||
let boxW = el.offsetWidth;
|
||||
let boxH = el.offsetHeight;
|
||||
let handle = this.handle;
|
||||
|
||||
if (this.options_['vertical']) {
|
||||
if (this.vertical()) {
|
||||
let boxY = box.top;
|
||||
|
||||
let pageY;
|
||||
@ -162,13 +160,6 @@ class Slider extends Component {
|
||||
pageY = event.pageY;
|
||||
}
|
||||
|
||||
if (handle) {
|
||||
var handleH = handle.el().offsetHeight;
|
||||
// Adjusted X and Width, so handle doesn't go outside the bar
|
||||
boxY = boxY + (handleH / 2);
|
||||
boxH = boxH - handleH;
|
||||
}
|
||||
|
||||
// Percent that the click is through the adjusted area
|
||||
return Math.max(0, Math.min(1, ((boxY - pageY) + boxH) / boxH));
|
||||
|
||||
@ -182,14 +173,6 @@ class Slider extends Component {
|
||||
pageX = event.pageX;
|
||||
}
|
||||
|
||||
if (handle) {
|
||||
var handleW = handle.el().offsetWidth;
|
||||
|
||||
// Adjusted X and Width, so handle doesn't go outside the bar
|
||||
boxX = boxX + (handleW / 2);
|
||||
boxW = boxW - handleW;
|
||||
}
|
||||
|
||||
// Percent that the click is through the adjusted area
|
||||
return Math.max(0, Math.min(1, (pageX - boxX) / boxW));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user