Skip to content

Commit

Permalink
Join ends of peaks (#1142)
Browse files Browse the repository at this point in the history
* Join ends of peaks

I'm not entirely sure that the peaks are joined at the ends. When I zoomed all the way in, it seemed that there were gaps...

* Update drawer.multicanvas.js

* Update drawer.multicanvas.js
  • Loading branch information
agamemnus authored and katspaugh committed Jul 2, 2017
1 parent 0bc87cb commit a1ff8ea
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/drawer.multicanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,11 @@ WaveSurfer.util.extend(WaveSurfer.Drawer.MultiCanvas, {
if (!ctx) { return; }

var length = peaks.length / 2;
var scale = (this.params.fillParent && this.width != length) ? this.width / length : 1;

var scale = 1;
if (this.params.fillParent && this.width != length) {
scale = this.width / length;
}

var first = Math.round(length * entry.start),
last = Math.round(length * entry.end);
var first = Math.round(length * entry.start);
// Use one more peak value to make sure we join peaks at ends -- unless, of course, this is the last canvas.
var last = Math.round(length * entry.end) + 1;
if (first > end || last < start) { return; }
var canvasStart = Math.max(first, start);
var canvasEnd = Math.min(last, end);
Expand Down

0 comments on commit a1ff8ea

Please sign in to comment.