Skip to content

Commit

Permalink
Make canvas required
Browse files Browse the repository at this point in the history
  • Loading branch information
0x5066 committed Aug 29, 2024
1 parent 8f91c87 commit 920ee7a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/webamp/js/components/VisPainter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface Vis {
canvas?: HTMLCanvasElement;
canvas: HTMLCanvasElement;
colors: string[];
analyser?: AnalyserNode;
oscStyle?: "dots" | "solid" | "lines";
Expand Down Expand Up @@ -226,7 +226,6 @@ export class BarPaintHandler extends VisPaintHandler {

prepare() {
const vis = this._vis;
if (!vis.canvas) return;
processFFT(
this._analyser,
this._fft,
Expand Down Expand Up @@ -584,10 +583,6 @@ export class WavePaintHandler extends VisPaintHandler {
}

prepare() {
if (!this._ctx) {
console.log("ctx not set!");
return;
}
const vis = this._vis;

//? paint bar
Expand All @@ -602,7 +597,8 @@ export class WavePaintHandler extends VisPaintHandler {
ctx.fillRect(0, y, 1, y + 1);
}
}


// @ts-ignore
this._ctx.imageSmoothingEnabled = false;
// @ts-ignore
this._ctx.mozImageSmoothingEnabled = false;
Expand Down

0 comments on commit 920ee7a

Please sign in to comment.