Skip to content

Commit

Permalink
perf: only update on change
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey committed Jul 30, 2019
1 parent 64ba118 commit 9cff4cc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/js/slider/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class Slider extends Component {
this.on('keydown', this.handleKeyDown);
this.on('click', this.handleClick);

// TODO: deprecated, controlsvisible does not seem to be fired
this.on(this.player_, 'controlsvisible', this.update);

if (this.playerEvent) {
Expand Down Expand Up @@ -262,10 +263,10 @@ class Slider extends Component {
const style = bar.el().style;

// Set the new bar width or height
if (this.vertical()) {
style.height = percentage;
} else {
style.width = percentage;
const sizeKey = this.vertical() ? 'height' : 'width';

if (style[sizeKey] !== percentage) {
style[sizeKey] = percentage;
}

return progress;
Expand Down

0 comments on commit 9cff4cc

Please sign in to comment.