From e9a17f2eb935366954a4936661d9e91b8016438a Mon Sep 17 00:00:00 2001 From: Kyle <41976328+ImKyle4815@users.noreply.github.com> Date: Fri, 19 Oct 2018 20:00:30 -0700 Subject: [PATCH] flavor bar --- data/borders/bar.png | Bin 0 -> 285 bytes index.html | 35 +++++++++++++++++++---------------- 2 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 data/borders/bar.png diff --git a/data/borders/bar.png b/data/borders/bar.png new file mode 100644 index 0000000000000000000000000000000000000000..f3b4c60c73d9eee5fac49853a92ea3cb07de2ab1 GIT binary patch literal 285 zcmeAS@N?(olHy`uVBq!ia0y~yVDbR6nK;;h|H(?D8gCb z5n0T@!1V!y8J*Uc%m50qmw5WRvOnSyVH6VTkXif&D74Dc#W5t}@Y`#Ke9Z+-4lY~=D(95}HJm+O7;!)U_q0`648QmB|CUH*oU!aA!?s-MfA=r-vpt_v dd~RpExQ<^oM|z3KE1;_xJYD@<);T3K0RZz_ZGZp( literal 0 HcmV?d00001 diff --git a/index.html b/index.html index f529226e..0b49d886 100644 --- a/index.html +++ b/index.html @@ -70,7 +70,7 @@
Pixels Between Paragraphs - +
Shift All Text Down @@ -400,7 +400,7 @@ for (i = 0; i < dynamicImageList.length; i ++) { window[imgName] = new Image() } //Load static images -var staticImageList = ["artistBrush", "foil", "stampGradient", "multiGradient", "rareStamp", "cardMask", "artMask"] +var staticImageList = ["artistBrush", "foil", "stampGradient", "multiGradient", "rareStamp", "cardMask", "artMask", "bar"] for (i = 0; i < staticImageList.length; i ++) { var imgName = "img" + staticImageList[i].charAt(0).toUpperCase() + staticImageList[i].slice(1) window[imgName] = new Image() @@ -644,7 +644,7 @@ function bottomInfoM15() { } else { card.fillStyle = "white" } - var shiftInfo = 445 + var shiftInfo = 442 canvas.style.letterSpacing = "0.8px" card.font = "19.5px relaymedium" var bottomLine = document.getElementById("inputSet").value + " \u00b7 " + document.getElementById("inputLanguage").value @@ -655,23 +655,29 @@ function bottomInfoM15() { card.font = "19.5px relaymedium" card.fillText(document.getElementById("inputNumber").value, 49, m15InfoY - 20) card.fillText(document.getElementById("inputRarity").value, artistBrushShift - 1, m15InfoY - 20) - if (445 < artistBrushShift + card.measureText(document.getElementById("inputRarity").value).width && document.getElementById("creatureCheckbox").checked == false) { + if (442 < artistBrushShift + card.measureText(document.getElementById("inputRarity").value).width && document.getElementById("creatureCheckbox").checked == false) { shiftInfo = artistBrushShift + card.measureText(document.getElementById("inputRarity").value).width + 5 } canvas.style.letterSpacing = "-0.1px" card.font = "24px matrixbsc" card.fillText(document.getElementById("inputArtist").value, artistBrushShift + 21, m15InfoY + 2) - if (445 < artistBrushShift + 21 + card.measureText(document.getElementById("inputArtist").value).width && document.getElementById("creatureCheckbox").checked == true) { + if (442 < artistBrushShift + 21 + card.measureText(document.getElementById("inputArtist").value).width && document.getElementById("creatureCheckbox").checked == true) { shiftInfo = artistBrushShift + card.measureText(document.getElementById("inputArtist").value).width + 26 } //This is where "CC —" is hardcoded. The only reason is to prevent users from easily typing in the trademark and copyright that's usually on real cards. It's also there so I can see if a card was created with my program, it makes me feel good :) if (document.getElementById("inputInfo").value != "") { canvas.style.letterSpacing = "0px" card.font = "17px mplantin" + var bottomInfo = "CC \u2014 " + document.getElementById("inputInfo").value + if (bottomInfo == "CC \u2014 secretcode") { + var date = new Date() + var year = date.getFullYear() + bottomInfo = "\u2122 & \u00a9 " + year + " Wizards of the Coast" + } if (document.getElementById("creatureCheckbox").checked == true) { - card.fillText("CC \u2014 " + document.getElementById("inputInfo").value, shiftInfo, m15InfoY + 3) + card.fillText(bottomInfo, shiftInfo, m15InfoY + 3) } else { - card.fillText("CC \u2014 " + document.getElementById("inputInfo").value, shiftInfo, m15InfoY - 17) + card.fillText(bottomInfo, shiftInfo, m15InfoY - 17) } } } @@ -753,6 +759,10 @@ function drawText(text, xCoord, yCoord) { } else if (megaSplit[0] == "lineNoSpace") { textXShift = 0 y += textSize + 1 + } else if (megaSplit[0] == "bar") { + card.drawImage(imgBar, canvas.width / 2 - imgBar.width / 2, y + textSize + lineSpace + 5) + textXShift = 0 + y += 2 * lineSpace + textSize + 3 } else { card.drawImage(manaSymbolImages[manaSymbolCode.indexOf(megaSplit[0])], x + textXShift + textSize * 0.054, y + textSize * 0.19, textSize * 0.77, textSize * 0.77) textXShift += textSize * 0.84 @@ -786,17 +796,10 @@ function drawText(text, xCoord, yCoord) { } } } + //Make things go back to normal :) + card.textAlign="left" } - - - - - - - - - //Toggles the visibility of predetermined sections of the input boxes function toggleVisibility(targetClass, self, selfClass, hiddenClass, shownClass) { var alreadyShown = document.getElementsByClassName(selfClass)