From 82efca6e034653015940588857d4a00a0d185585 Mon Sep 17 00:00:00 2001 From: David Enke Date: Sun, 15 Sep 2024 17:06:47 +0200 Subject: [PATCH] chore: align diff in preview --- src/example.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/example.ts b/src/example.ts index 0e1c6a2..e87b959 100644 --- a/src/example.ts +++ b/src/example.ts @@ -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; @@ -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)}%`; } }