Skip to content

Commit

Permalink
Merge pull request katspaugh#600 from nabiulin/master
Browse files Browse the repository at this point in the history
Fixed region updation error after zoom
  • Loading branch information
katspaugh committed Dec 14, 2015
2 parents 35452b2 + 47a1973 commit 3ee6bec
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions plugin/wavesurfer.regions.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,20 @@ WaveSurfer.Region = {
this.end = Math.min(this.start + this.maxLength, this.end);
}

this.style(this.element, {
left: ~~(this.start / dur * width) + 'px',
width: ~~((this.end - this.start) / dur * width) + 'px',
backgroundColor: this.color,
cursor: this.drag ? 'move' : 'default'
});
if (this.element != null) {
this.style(this.element, {
left: ~~(this.start / dur * width) + 'px',
width: ~~((this.end - this.start) / dur * width) + 'px',
backgroundColor: this.color,
cursor: this.drag ? 'move' : 'default'
});

for (var attrname in this.attributes) {
this.element.setAttribute('data-region-' + attrname, this.attributes[attrname]);
}
for (var attrname in this.attributes) {
this.element.setAttribute('data-region-' + attrname, this.attributes[attrname]);
}

this.element.title = this.formatTime(this.start, this.end);
this.element.title = this.formatTime(this.start, this.end);
}
},

/* Bind audio events. */
Expand Down

0 comments on commit 3ee6bec

Please sign in to comment.