Skip to content

Commit

Permalink
Merge branch 'master' of github.com:katspaugh/wavesurfer.js
Browse files Browse the repository at this point in the history
  • Loading branch information
thijstriemstra committed Apr 24, 2019
2 parents d4d1913 + fa93fe7 commit 1ec2a19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions example/timeline/index.html
Expand Up @@ -107,6 +107,7 @@ <h4>Options</h4>
<li><code>primaryLabelInterval</code> - number of primary time labels. (Integer or function which receives pxPerSec value and reurns value)</li>
<li><code>secondaryLabelInterval</code> - number of secondary time labels (Time labels between primary labels, integer or function which receives pxPerSec value and reurns value).</li>
<li><code>formatTimeCallback</code> - custom time format callback. (Function which receives number of seconds and returns formatted string)</li>
<li><code>offset</code> - offset (in seconds) for the start of the timeline. The value may also be negative and the default is 0.</li>
</ul>
</div>
</div>
Expand Down
7 changes: 5 additions & 2 deletions src/plugin/timeline.js
Expand Up @@ -26,6 +26,8 @@
* labels in primary color
* @property {function} secondaryLabelInterval (pxPerSec) -> cadence between
* labels in secondary color
* @property {?number} offset Offset for the timeline start in seconds. May also be
* negative.
* @property {?boolean} deferInit Set to true to manually call
* `initPlugin('timeline')`
*/
Expand Down Expand Up @@ -151,7 +153,8 @@ export default class TimelinePlugin {
formatTimeCallback: this.defaultFormatTimeCallback,
timeInterval: this.defaultTimeInterval,
primaryLabelInterval: this.defaultPrimaryLabelInterval,
secondaryLabelInterval: this.defaultSecondaryLabelInterval
secondaryLabelInterval: this.defaultSecondaryLabelInterval,
offset: 0
},
params
);
Expand Down Expand Up @@ -376,7 +379,7 @@ export default class TimelinePlugin {
this.params.secondaryLabelInterval
);

let curPixel = 0;
let curPixel = pixelsPerSecond * this.params.offset;
let curSeconds = 0;
let i;
// build an array of position data with index, second and pixel data,
Expand Down

0 comments on commit 1ec2a19

Please sign in to comment.