Skip to content

Commit

Permalink
small refactor, removed unnecessary re-calculation (#901)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsphweid authored and katspaugh committed Jan 16, 2017
1 parent b0c0a8b commit f9426cb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
5 changes: 1 addition & 4 deletions src/drawer.canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,7 @@ WaveSurfer.util.extend(WaveSurfer.Drawer.Canvas, {
}, this);
},

updateProgress: function (progress) {
var pos = Math.round(
this.width * progress
) / this.params.pixelRatio;
updateProgress: function (pos) {
this.style(this.progressWave, { width: pos + 'px' });
},

Expand Down
2 changes: 1 addition & 1 deletion src/drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ WaveSurfer.Drawer = {
this.recenterOnPosition(newPos);
}

this.updateProgress(progress);
this.updateProgress(pos);
}
},

Expand Down
5 changes: 1 addition & 4 deletions src/drawer.multicanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,7 @@ WaveSurfer.util.extend(WaveSurfer.Drawer.MultiCanvas, {
}
},

updateProgress: function (progress) {
var pos = Math.round(
this.width * progress
) / this.params.pixelRatio;
updateProgress: function (pos) {
this.style(this.progressWave, { width: pos + 'px' });
}
});

0 comments on commit f9426cb

Please sign in to comment.