From 2073ea48d8831858f8eec5c9531638e7fe3d2c85 Mon Sep 17 00:00:00 2001 From: Kyle <41976328+ImKyle4815@users.noreply.github.com> Date: Mon, 15 Feb 2021 17:07:19 -0800 Subject: [PATCH] print --- print/index.php | 2 ++ print/print.js | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/print/index.php b/print/index.php index adc5e9d5..0605895b 100644 --- a/print/index.php +++ b/print/index.php @@ -11,6 +11,8 @@ include('../globalHTML/header-1.php'); +
Toggle the paper orientation (Portrait / Landscape)
+
Set the distance between cards (in pixels)
diff --git a/print/print.js b/print/print.js index 44333dcb..5212f54f 100644 --- a/print/print.js +++ b/print/print.js @@ -27,7 +27,7 @@ function drawSheet() { const cardsX = Math.floor(pageWidth / cardWidth); const cardsY = Math.floor(pageHeight / cardHeight); var count = 0; - for (var i = imageList.length - 1; i >= 0 && count < 9; i --) { + for (var i = imageList.length - 1; i >= 0 && count < cardsX * cardsY; i --) { if (imageList[i].width > 1) { context.drawImage(imageList[i], (pageWidth - cardsX * cardWidth) / 2 + (count % cardsX) * (cardWidth + cardMarginX) - cardMarginX, (pageHeight - cardsY * cardHeight) / 2 + (Math.floor(count / cardsX) % cardsY) * (cardHeight + cardMarginY) - cardMarginY, cardWidth, cardHeight); } @@ -64,4 +64,11 @@ function setCardDistance(distance) { cardMarginX = parseInt(distance); cardMarginY = parseInt(distance); drawSheet(); +} + +function changeOrientation() { + var oldWidth = pageWidth; + pageWidth = pageHeight; + pageHeight = oldWidth; + drawSheet(); } \ No newline at end of file