Skip to content

Commit

Permalink
Merge pull request katspaugh#564 from rozap/master
Browse files Browse the repository at this point in the history
Add autoCenter option
  • Loading branch information
katspaugh committed Oct 29, 2015
2 parents 2094b73 + 52b4353 commit 09353f7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ where you can also add your own project.
| `scrollParent` | boolean | `false` | Whether to scroll the container with a lengthy waveform. Otherwise the waveform is shrunk to the container width (see `fillParent`). |
| `skipLength` | float | `2` | Number of seconds to skip with the `skipForward()` and `skipBackward()` methods. |
| `waveColor` | string | `#999` | The fill color of the waveform after the cursor. |

| `autoCenter` | boolean | true | If a scrollbar is present, center the waveform around the progress |
## WaveSurfer Methods

All methods are intentionally public, but the most readily available are the following:
Expand Down
2 changes: 1 addition & 1 deletion src/drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ WaveSurfer.Drawer = {
if (pos < this.lastPos || pos - this.lastPos >= minPxDelta) {
this.lastPos = pos;

if (this.params.scrollParent) {
if (this.params.scrollParent && this.params.autoCenter) {
var newPos = ~~(this.wrapper.scrollWidth * progress);
this.recenterOnPosition(newPos);
}
Expand Down
3 changes: 2 additions & 1 deletion src/wavesurfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ var WaveSurfer = {
mediaControls : false,
renderer : 'Canvas',
backend : 'WebAudio',
mediaType : 'audio'
mediaType : 'audio',
autoCenter : true
},

init: function (params) {
Expand Down

0 comments on commit 09353f7

Please sign in to comment.