mirror of
https://github.com/Investigamer/cardconjurer.git
synced 2025-07-27 05:14:53 -05:00
This commit is contained in:
@@ -11,6 +11,8 @@ include('../globalHTML/header-1.php');
|
|||||||
<option value='8.5,11'>Regular (8.5 by 11)</option>
|
<option value='8.5,11'>Regular (8.5 by 11)</option>
|
||||||
<option value='8.2667,11.6934'>A4</option>
|
<option value='8.2667,11.6934'>A4</option>
|
||||||
</select>
|
</select>
|
||||||
|
<h5 class='margin-bottom padding input-description'>Toggle the paper orientation (Portrait / Landscape)</h5>
|
||||||
|
<button onclick='changeOrientation();' class='input margin-bottom'>Toggle orientation</button>
|
||||||
<h5 class='margin-bottom padding input-description'>Set the distance between cards (in pixels)</h5>
|
<h5 class='margin-bottom padding input-description'>Set the distance between cards (in pixels)</h5>
|
||||||
<input type='number' class='input margin-bottom' value='10' min='0' max='100' onchange='setCardDistance(this.value);'>
|
<input type='number' class='input margin-bottom' value='10' min='0' max='100' onchange='setCardDistance(this.value);'>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -27,7 +27,7 @@ function drawSheet() {
|
|||||||
const cardsX = Math.floor(pageWidth / cardWidth);
|
const cardsX = Math.floor(pageWidth / cardWidth);
|
||||||
const cardsY = Math.floor(pageHeight / cardHeight);
|
const cardsY = Math.floor(pageHeight / cardHeight);
|
||||||
var count = 0;
|
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) {
|
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);
|
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);
|
||||||
}
|
}
|
||||||
@@ -65,3 +65,10 @@ function setCardDistance(distance) {
|
|||||||
cardMarginY = parseInt(distance);
|
cardMarginY = parseInt(distance);
|
||||||
drawSheet();
|
drawSheet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeOrientation() {
|
||||||
|
var oldWidth = pageWidth;
|
||||||
|
pageWidth = pageHeight;
|
||||||
|
pageHeight = oldWidth;
|
||||||
|
drawSheet();
|
||||||
|
}
|
Reference in New Issue
Block a user