Configure canvas element size on the fly

This commit is contained in:
Hans5958 2023-03-20 20:44:25 +07:00
parent c74a31bbca
commit 6ee0b382c4
2 changed files with 8 additions and 3 deletions

View file

@ -16,8 +16,14 @@
const innerContainer = document.getElementById("innerContainer")
const container = document.getElementById("container")
const canvas = document.getElementById("highlightCanvas")
const canvasImage = document.getElementById('image')
const context = canvas.getContext("2d")
canvas.width = canvasSize.x
canvas.height = canvasSize.y
canvasImage.width = canvasSize.x
canvasImage.height = canvasSize.y
let zoom = 1
if (window.devicePixelRatio) {

View file

@ -169,9 +169,8 @@ <h4 class="mb-3">Hang on…</h4>
</div>
<canvas id="linesCanvas"></canvas>
<div id="innerContainer">
<canvas id="highlightCanvas" width="2000" height="2000"></canvas>
<img id="image" width="2000" height="2000" alt="" />
<canvas id="highlightCanvas"></canvas>
<img id="image" alt="" />
</div>
</div>
<div class="offcanvas offcanvas-start bg-body" data-bs-scroll="true" data-bs-backdrop="false" tabindex="-1" id="offcanvasList" aria-labelledby="offcanvasListLabel">