Skip to content

Commit

Permalink
chore: align diff in preview
Browse files Browse the repository at this point in the history
  • Loading branch information
davidenke committed Sep 15, 2024
1 parent 02649a0 commit 82efca6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class Compare extends HTMLElement {
width,
height,
);
const match = 100 - offset / (height * width);
const match = 100 - (offset / (height * width)) * 100;

const diff = document.createElement('canvas');
diff.width = width;
Expand All @@ -218,7 +218,7 @@ class Compare extends HTMLElement {
section.appendChild(leftClone);
section.appendChild(diff);
section.appendChild(rightClone);
code.textContent = `${match === 100 ? '100' : match.toFixed(4)}%`;
code.textContent = `${match === 100 ? '100' : match.toFixed(2)}%`;
}
}

Expand Down

0 comments on commit 82efca6

Please sign in to comment.