From 1a5172c0439e3d5c919a7cb6502828c4f5851cf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com> Date: Sun, 3 Jul 2022 04:22:46 +0100 Subject: [PATCH] fix: device pixel ratio fix --- examples/web/index.css | 2 +- examples/web/index.html | 2 +- examples/web/index.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/web/index.css b/examples/web/index.css index 4f046ba5..decfc4d4 100644 --- a/examples/web/index.css +++ b/examples/web/index.css @@ -92,7 +92,7 @@ p { border: 2px solid #50cb93; font-size: 0px; margin-top: 78px; - max-width: 660px; + max-width: 320px; padding: 8px 8px 8px 8px; } diff --git a/examples/web/index.html b/examples/web/index.html index 50bfe5e4..faa20ad4 100644 --- a/examples/web/index.html +++ b/examples/web/index.html @@ -20,7 +20,7 @@ <img class="large" src="res/minimise.svg" alt="minimise" /> </span> <div class="canvas-frame"> - <canvas id="chip-canvas" class="canvas" width="160" height="144"></canvas> + <canvas id="chip-canvas" class="canvas" width="320" height="288"></canvas> </div> </div> </div> diff --git a/examples/web/index.ts b/examples/web/index.ts index 8d4d0a37..076502df 100644 --- a/examples/web/index.ts +++ b/examples/web/index.ts @@ -699,8 +699,8 @@ const clearCanvas = async ( img.src = image; }); const [imgWidth, imgHeight] = [ - img.width * imageScale, - img.height * imageScale + img.width * imageScale * window.devicePixelRatio, + img.height * imageScale * window.devicePixelRatio ]; const [x0, y0] = [ state.canvasScaled.width / 2 - imgWidth / 2, -- GitLab