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++; } } };