mirror of
https://github.com/Investigamer/cardconjurer.git
synced 2025-07-27 05:14:53 -05:00
Add font size control
This commit is contained in:

committed by
Josh birnholz

parent
32d4fa0769
commit
b351f0ba05
@@ -208,6 +208,8 @@
|
|||||||
<textarea id='text-editor' class='input margin-bottom' oninput='textEdited();'></textarea>
|
<textarea id='text-editor' class='input margin-bottom' oninput='textEdited();'></textarea>
|
||||||
<h5 class='margin-bottom padding input-description'>Edit the placement and size of the selected textbox</h5>
|
<h5 class='margin-bottom padding input-description'>Edit the placement and size of the selected textbox</h5>
|
||||||
<button class='input' onclick='textboxEditor();'>Edit Bounds</button>
|
<button class='input' onclick='textboxEditor();'>Edit Bounds</button>
|
||||||
|
<h5 class='margin-bottom padding input-description'>Adjust font size</h5>
|
||||||
|
<input id="text-editor-font-size" class="input" type="number" placeholder="0" value="0" step="1" oninput="fontSizedEdited();">
|
||||||
</div>
|
</div>
|
||||||
<div class='readable-background padding margin-bottom'>
|
<div class='readable-background padding margin-bottom'>
|
||||||
<h5 class='collapsible collapsed padding input-description' onclick='toggleCollapse(event);'>
|
<h5 class='collapsible collapsed padding input-description' onclick='toggleCollapse(event);'>
|
||||||
|
@@ -827,6 +827,7 @@ function loadTextOptions(textObject, replace=true) {
|
|||||||
function textOptionClicked(event) {
|
function textOptionClicked(event) {
|
||||||
selectedTextIndex = getElementIndex(event.target);
|
selectedTextIndex = getElementIndex(event.target);
|
||||||
document.querySelector('#text-editor').value = Object.entries(card.text)[selectedTextIndex][1].text;
|
document.querySelector('#text-editor').value = Object.entries(card.text)[selectedTextIndex][1].text;
|
||||||
|
document.querySelector('#text-editor-font-size').value = Object.entries(card.text)[selectedTextIndex][1].fontSize;
|
||||||
selectSelectable(event);
|
selectSelectable(event);
|
||||||
}
|
}
|
||||||
function textboxEditor() {
|
function textboxEditor() {
|
||||||
@@ -845,6 +846,10 @@ function textEdited() {
|
|||||||
card.text[Object.keys(card.text)[selectedTextIndex]].text = curlyQuotes(document.querySelector('#text-editor').value);
|
card.text[Object.keys(card.text)[selectedTextIndex]].text = curlyQuotes(document.querySelector('#text-editor').value);
|
||||||
drawTextBuffer();
|
drawTextBuffer();
|
||||||
}
|
}
|
||||||
|
function fontSizedEdited() {
|
||||||
|
card.text[Object.keys(card.text)[selectedTextIndex]].fontSize = document.querySelector('#text-editor-font-size').value;
|
||||||
|
drawTextBuffer();
|
||||||
|
}
|
||||||
function drawTextBuffer() {
|
function drawTextBuffer() {
|
||||||
clearTimeout(writingText);
|
clearTimeout(writingText);
|
||||||
writingText = setTimeout(drawText, 500);
|
writingText = setTimeout(drawText, 500);
|
||||||
@@ -977,6 +982,7 @@ function writeText(textObject, targetContext) {
|
|||||||
// if (textFont == 'goudymedieval') {
|
// if (textFont == 'goudymedieval') {
|
||||||
// lineCanvas.style.letterSpacing = '3.5px';
|
// lineCanvas.style.letterSpacing = '3.5px';
|
||||||
// }
|
// }
|
||||||
|
textSize += parseInt(textObject.fontSize || '0');
|
||||||
lineContext.font = textFontStyle + textSize + 'px ' + textFont + textFontExtension;
|
lineContext.font = textFontStyle + textSize + 'px ' + textFont + textFontExtension;
|
||||||
lineContext.fillStyle = textColor;
|
lineContext.fillStyle = textColor;
|
||||||
lineContext.shadowColor = textShadowColor;
|
lineContext.shadowColor = textShadowColor;
|
||||||
@@ -1911,6 +1917,7 @@ function changeCardIndex() {
|
|||||||
card.text.ability0.text = cardToImport.oracle_text.replace('(', '{i}(').replace(')', '){/i}') || '';
|
card.text.ability0.text = cardToImport.oracle_text.replace('(', '{i}(').replace(')', '){/i}') || '';
|
||||||
}
|
}
|
||||||
document.querySelector('#text-editor').value = card.text[Object.keys(card.text)[selectedTextIndex]].text;
|
document.querySelector('#text-editor').value = card.text[Object.keys(card.text)[selectedTextIndex]].text;
|
||||||
|
document.querySelector('#text-editor-font-size').value = 0;
|
||||||
textEdited();
|
textEdited();
|
||||||
//collector's info
|
//collector's info
|
||||||
if (localStorage.getItem('enableImportCollectorInfo') == 'true') {
|
if (localStorage.getItem('enableImportCollectorInfo') == 'true') {
|
||||||
@@ -1946,6 +1953,10 @@ function changeCardIndex() {
|
|||||||
if (!document.querySelector('#lockSetSymbolURL').checked) {
|
if (!document.querySelector('#lockSetSymbolURL').checked) {
|
||||||
fetchSetSymbol();
|
fetchSetSymbol();
|
||||||
}
|
}
|
||||||
|
//font size
|
||||||
|
Object.keys(card.text).forEach(key => {
|
||||||
|
card.text[key].fontSize = 0;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function loadAvailableCards(cardKeys = JSON.parse(localStorage.getItem('cardKeys'))) {
|
function loadAvailableCards(cardKeys = JSON.parse(localStorage.getItem('cardKeys'))) {
|
||||||
if (!cardKeys) {
|
if (!cardKeys) {
|
||||||
@@ -2020,6 +2031,7 @@ async function loadCard(selectedCardKey) {
|
|||||||
document.querySelector('#info-year').value = card.infoYear || date.getFullYear();
|
document.querySelector('#info-year').value = card.infoYear || date.getFullYear();
|
||||||
artistEdited(card.infoArtist);
|
artistEdited(card.infoArtist);
|
||||||
document.querySelector('#text-editor').value = card.text[Object.keys(card.text)[selectedTextIndex]].text;
|
document.querySelector('#text-editor').value = card.text[Object.keys(card.text)[selectedTextIndex]].text;
|
||||||
|
document.querySelector('#text-editor-font-size').value = card.text[Object.keys(card.text)[selectedTextIndex]].fontSize || 0;
|
||||||
loadTextOptions(card.text);
|
loadTextOptions(card.text);
|
||||||
document.querySelector('#art-x').value = scaleX(card.artX) - scaleWidth(card.marginX);
|
document.querySelector('#art-x').value = scaleX(card.artX) - scaleWidth(card.marginX);
|
||||||
document.querySelector('#art-y').value = scaleY(card.artY) - scaleHeight(card.marginY);
|
document.querySelector('#art-y').value = scaleY(card.artY) - scaleHeight(card.marginY);
|
||||||
|
Reference in New Issue
Block a user