Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 3, 2023
1 parent dff933b commit 286b15e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/_static/upload.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 9 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function arrayToCsv(data: number[][]): string {
row
.map(String) // convert every value to String
.map((v) => `"${v}"`) // quote it
.join(',') // comma-separated
.join(','), // comma-separated
)
.join('\n'); // rows starting on new lines
}
Expand All @@ -28,7 +28,7 @@ class DrawingApp {
constructor() {
this.imgCanvas = document.getElementById('imgCanvas') as HTMLCanvasElement;
this.pointCanvas = document.getElementById(
'pointCanvas'
'pointCanvas',
) as HTMLCanvasElement;
this.imgContext = this.imgCanvas.getContext('2d');
this.pointContext = this.pointCanvas.getContext('2d');
Expand Down Expand Up @@ -81,7 +81,9 @@ class DrawingApp {

document.getElementById('csv-save').addEventListener('click', () => {
const url = URL.createObjectURL(
new Blob([arrayToCsv(this.clicks)], { type: 'text/csv;charset=utf-8;' })
new Blob([arrayToCsv(this.clicks)], {
type: 'text/csv;charset=utf-8;',
}),
);

// Create a link to download it
Expand Down Expand Up @@ -133,7 +135,7 @@ class DrawingApp {
shiftX,
shiftY,
img.width * ratio,
img.height * ratio
img.height * ratio,
);
}

Expand All @@ -142,7 +144,7 @@ class DrawingApp {
0,
0,
this.pointCanvas.width,
this.pointCanvas.height
this.pointCanvas.height,
);
this.clicks.map((click) => {
this.drawPoint(click[0], click[1]);
Expand Down Expand Up @@ -173,7 +175,7 @@ class DrawingApp {
0,
0,
this.pointCanvas.width,
this.pointCanvas.height
this.pointCanvas.height,
);
this.clicks = [];
}
Expand All @@ -198,7 +200,7 @@ class DrawingApp {
() => {
this.img.src = reader.result as string;
},
false
false,
);
reader.readAsDataURL((e.target as HTMLInputElement).files[0]);
};
Expand Down

0 comments on commit 286b15e

Please sign in to comment.