Skip to content

Commit

Permalink
fix spikes in oscilloscopes
Browse files Browse the repository at this point in the history
  • Loading branch information
Fr0stbyteR authored and sletz committed Sep 27, 2024
1 parent c2df0f2 commit 0207570
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/Scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export class Scope {
const l = d.length;
ctx.strokeStyle = "#FFFFFF";
ctx.lineWidth = 2;
ctx.lineJoin = "round";
ctx.beginPath();
// Fastest way to get min and max to have: 1. max abs value for y scaling, 2. mean value for zero-crossing
let min = d[0];
Expand Down
2 changes: 2 additions & 0 deletions src/StaticScope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export class StaticScope {
const gridX = (w - left) / ($1 - $0 - 1);
const step = Math.max(1, Math.round(1 / gridX)); // horizontal draw step for optimization
ctx.lineWidth = 2;
ctx.lineJoin = "round";
for (let i = 0; i < t.length; i++) {
ctx.beginPath();
ctx.strokeStyle = `hsl(${i * 60}, 100%, 85%)`;
Expand Down Expand Up @@ -262,6 +263,7 @@ export class StaticScope {
const gridX = (w - left) / ($1 - $0 - 1);
const step = Math.max(1, Math.round(1 / gridX));
ctx.lineWidth = 2;
ctx.lineJoin = "round";
for (let i = 0; i < t.length; i++) {
ctx.beginPath();
ctx.strokeStyle = t.length === 1 ? "white" : `hsl(${i * 60}, 100%, 85%)`;
Expand Down

0 comments on commit 0207570

Please sign in to comment.