From ce38672201538c0a79e16a0b1e2b90eb5efcaebf Mon Sep 17 00:00:00 2001 From: Fedorov Vladimir Date: Sun, 2 Jul 2023 21:35:48 +0700 Subject: [PATCH] fix --- src/components/Canvas.vue | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/Canvas.vue b/src/components/Canvas.vue index 467921a..b3fe161 100644 --- a/src/components/Canvas.vue +++ b/src/components/Canvas.vue @@ -38,16 +38,23 @@ const render = () => { var rotationDelta = imageHeightPx / Math.tan(vRotation / 180 * Math.PI); if (ctx.value) { + var x = 0; var y = 0; - for (let i = 0; i < 100; i++) { - y += hMargins[i%2] * ONE_MM; + + let i = 0; + while (y < imageHeightPx) { + y += hMargins[i % 2] * ONE_MM; ctx.value.moveTo(0, y); ctx.value.lineTo(imageWidthPx, y); ctx.value.stroke(); + i++; } - for (let i = 1; i < 100; i++) { - const x = i * vMarginPx; + x = 0; + y = 0; + i = 0; + while (x - rotationDelta < imageWidthPx) { + x = i * vMarginPx; var x0 = x; var y0 = 0; var x1 = x - rotationDelta; @@ -55,6 +62,7 @@ const render = () => { ctx.value.moveTo(x0, y0); ctx.value.lineTo(x1, y1); ctx.value.stroke(); + i++; } } };