Skip to content

Commit

Permalink
Fixes issue katspaugh#425 where region-out is not triggered when seek…
Browse files Browse the repository at this point in the history
…ing out of current region
  • Loading branch information
jbeyer05 committed Nov 6, 2015
1 parent 85ff34d commit 2128e11
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions plugin/wavesurfer.regions.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,19 +269,22 @@ WaveSurfer.Region = {
bindInOut: function () {
var my = this;

my.firedIn = false;
my.firedOut = false;

var onPlay = function () {
my.firedIn = false;
my.firedOut = false;
};

var onProcess = function (time) {
if (!my.firedIn && my.start <= time && my.end > time) {
my.firedIn = true;
my.firedOut = false;
my.fireEvent('in');
my.wavesurfer.fireEvent('region-in', my);
}
if (!my.firedOut && my.firedIn && my.end <= Math.round(time * 100) / 100) {
if (!my.firedOut && my.firedIn && (my.start >= Math.round(time * 100) / 100 || my.end <= Math.round(time * 100) / 100)) {
my.firedOut = true;
my.firedIn = false;
my.fireEvent('out');
my.wavesurfer.fireEvent('region-out', my);
}
Expand Down

0 comments on commit 2128e11

Please sign in to comment.