From 87d04651ea56359a7994d3fed34ddbbe3af5ab2e Mon Sep 17 00:00:00 2001 From: Kyle <41976328+ImKyle4815@users.noreply.github.com> Date: Wed, 15 Sep 2021 14:01:38 -0700 Subject: [PATCH] indent code --- creator/index.php | 2 ++ js/creator-23.js | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/creator/index.php b/creator/index.php index 4aeb7048..ef414512 100644 --- a/creator/index.php +++ b/creator/index.php @@ -212,6 +212,8 @@ include('../globalHTML/header-1.php');
{right#}
Moves the text # pixels right
{shadow#}
Changes the shadow distance to # (use {shadow0} to remove the shadow)
{shadowcolor#}
Changes the shadow color to #
+
{indent}
Indents the rest of the paragraph to the current point
+
{/indent}
Removes paragraph indendation
{kerning#}
Changes the kerning (letter spacing) to #
{roll___}
Used for dice-rolling cards (like from AFR) - whatever you fill in for '___' will be bolded, and alternating paragraphs will be shaded.
Notes
For colors, you may use HTML color codes (ie 'green'), hex color codes (ie '#00FF00'), or rgb (ie 'rgb(0,255,0)'')
diff --git a/js/creator-23.js b/js/creator-23.js index ddc129ce..eb88123b 100644 --- a/js/creator-23.js +++ b/js/creator-23.js @@ -823,6 +823,7 @@ function writeText(textObject, targetContext) { wordToWrite = null; if (possibleCode == 'line') { newLine = true; + startingCurrentX = 0; newLineSpacing = textSize * 0.35; } else if (possibleCode == 'lns' || possibleCode == 'linenospace') { newLine = true; @@ -931,6 +932,10 @@ function writeText(textObject, targetContext) { lineContext.drawImage(manaSymbols[findManaSymbolIndex('chaos')].image, currentX + canvasMargin, canvasMargin, planechaseHeight * 1.2, planechaseHeight); currentX += planechaseHeight * 1.3; startingCurrentX += planechaseHeight * 1.3; + } else if (possibleCode == 'indent') { + startingCurrentX += currentX; + } else if (possibleCode == '/indent') { + startingCurrentX = 0; } else if (possibleCode.includes('elemid')) { if (document.querySelector('#' + word.replace('{elemid', '').replace('}', ''))) { wordToWrite = document.querySelector('#' + word.replace('{elemid', '').replace('}', '')).value || ''; @@ -1600,7 +1605,7 @@ function changeCardIndex() { if (card.text.mana) {card.text.mana.text = cardToImport.mana_cost || '';} if (card.text.type) {card.text.type.text = cardToImport.type_line || '';} if (card.text.rules) { - var rulesText = curlyQuotes((cardToImport.oracle_text || '').replace('(', '{i}(').replace(')', '){/i}')).replace(/{Q}/g, '{untap}'); + var rulesText = curlyQuotes((cardToImport.oracle_text || '').replace('(', '{i}(').replace(')', '){/i}')).replace(/{Q}/g, '{untap}').replace(/• /g, '• {indent}'); card.text.rules.text = rulesText; if (cardToImport.flavor_text) { var flavorText = cardToImport.flavor_text;