various improvements

This commit is contained in:
Kyle
2021-05-31 09:40:56 -07:00
parent 37351a1980
commit 27c3f75e2c
7 changed files with 22 additions and 12 deletions

View File

@@ -57,6 +57,7 @@ var scryfallArt;
var scryfallCard; var scryfallCard;
//for text //for text
var savedTextXPosition = 0; var savedTextXPosition = 0;
var savedTextContents = {};
//for misc //for misc
var date = new Date(); var date = new Date();
const year = 'WOW' //date.getFullYear(); const year = 'WOW' //date.getFullYear();
@@ -532,7 +533,6 @@ function frameElementClicked(event) {
function frameElementMaskRemoved() { function frameElementMaskRemoved() {
const selectElement = document.querySelector('#frame-editor-masks'); const selectElement = document.querySelector('#frame-editor-masks');
const selectedOption = selectElement.value; const selectedOption = selectElement.value;
console.log(selectedOption)
if (selectedOption != 'None Selected') { if (selectedOption != 'None Selected') {
selectElement.remove(selectElement.selectedIndex); selectElement.remove(selectElement.selectedIndex);
selectElement.selectedIndex = 0; selectElement.selectedIndex = 0;
@@ -561,6 +561,9 @@ function uploadFrameOption(imageSource) {
var writingText; var writingText;
function loadTextOptions(textObject, replace=true) { function loadTextOptions(textObject, replace=true) {
var oldCardText = card.text || {}; var oldCardText = card.text || {};
Object.entries(oldCardText).forEach(item => {
savedTextContents[item[0]] = oldCardText[item[0]].text;
});
if (replace) { if (replace) {
card.text = textObject; card.text = textObject;
} else { } else {
@@ -572,6 +575,8 @@ function loadTextOptions(textObject, replace=true) {
Object.entries(card.text).forEach(item => { Object.entries(card.text).forEach(item => {
if (oldCardText[item[0]]) { if (oldCardText[item[0]]) {
card.text[item[0]].text = oldCardText[item[0]].text; card.text[item[0]].text = oldCardText[item[0]].text;
} else if (savedTextContents[item[0]]) {
card.text[item[0]].text = savedTextContents[item[0]];
} }
var textOptionElement = document.createElement('h4'); var textOptionElement = document.createElement('h4');
textOptionElement.innerHTML = item[1].name; textOptionElement.innerHTML = item[1].name;
@@ -651,9 +656,7 @@ function writeText(textObject, targetContext) {
} else { } else {
item.split('').forEach(char => { item.split('').forEach(char => {
if (char == '') { if (char == '') {
console.log(char);
newSplitText.push(`{right${startingTextSize * 0.6}}`, '', '{lns}', `{up${startingTextSize * 0.75}}`); newSplitText.push(`{right${startingTextSize * 0.6}}`, '', '{lns}', `{up${startingTextSize * 0.75}}`);
console.log(newSplitText);
} else { } else {
newSplitText.push(char, '{lns}'); newSplitText.push(char, '{lns}');
} }
@@ -1662,7 +1665,6 @@ function loadScript(scriptPath) {
} }
// Stretchable SVGs // Stretchable SVGs
function stretchSVG(frameObject) { function stretchSVG(frameObject) {
// console.log(frameObject);
xhr = new XMLHttpRequest(); xhr = new XMLHttpRequest();
xhr.open('GET', fixUri(frameObject.src), true); xhr.open('GET', fixUri(frameObject.src), true);
xhr.overrideMimeType('image/svg+xml'); xhr.overrideMimeType('image/svg+xml');

View File

@@ -10,5 +10,7 @@ loadFramePacks([
{name:'Inner Crowns', value:'M15InnerCrowns'}, {name:'Inner Crowns', value:'M15InnerCrowns'},
{name:'Holo Stamps', value:'M15HoloStamps'}, {name:'Holo Stamps', value:'M15HoloStamps'},
{name:'Dark Power/Toughness', value:'M15DarkPT'}, {name:'Dark Power/Toughness', value:'M15DarkPT'},
{name:'Colored Borders', value:'M15Borders'} {name:'Colored Borders', value:'M15Borders'},
{name:'Custom Addons', value:'disabled'},
{name:'Brawl Legend Crowns', value:'Brawl'}
]) ])

View File

@@ -4,6 +4,8 @@ loadFramePacks([
{name:'Legend Crowns', value:'M15LegendCrowns'}, {name:'Legend Crowns', value:'M15LegendCrowns'},
{name:'Inner Crowns', value:'M15InnerCrowns'}, {name:'Inner Crowns', value:'M15InnerCrowns'},
{name:'Holo Stamps', value:'M15HoloStamps'}, {name:'Holo Stamps', value:'M15HoloStamps'},
{name:'Colored Borders', value:'M15Borders'} {name:'Colored Borders', value:'M15Borders'},
{name:'Custom Addons', value:'disabled'},
{name:'Brawl Legend Crowns', value:'Brawl'}
]) ])
notify('When you load the Saga frame version, a "Saga" tab will appear. This tab controls the placement and chapter counts for Saga chapters.') notify('When you load the Saga frame version, a "Saga" tab will appear. This tab controls the placement and chapter counts for Saga chapters.')

View File

@@ -12,5 +12,7 @@ loadFramePacks([
{name:'Inner Crowns', value:'M15InnerCrowns'}, {name:'Inner Crowns', value:'M15InnerCrowns'},
{name:'Holo Stamps', value:'M15HoloStamps'}, {name:'Holo Stamps', value:'M15HoloStamps'},
{name:'Dark Power/Toughness', value:'M15DarkPT'}, {name:'Dark Power/Toughness', value:'M15DarkPT'},
{name:'Colored Borders', value:'M15Borders'} {name:'Colored Borders', value:'M15Borders'},
{name:'Custom Addons', value:'disabled'},
{name:'Brawl Legend Crowns', value:'Brawl'}
]) ])

View File

@@ -8,5 +8,7 @@ loadFramePacks([
{name:'Inner Crowns', value:'M15InnerCrowns'}, {name:'Inner Crowns', value:'M15InnerCrowns'},
{name:'Holo Stamps', value:'M15HoloStamps'}, {name:'Holo Stamps', value:'M15HoloStamps'},
{name:'Dark Power/Toughness', value:'M15DarkPT'}, {name:'Dark Power/Toughness', value:'M15DarkPT'},
{name:'Colored Borders', value:'M15Borders'} {name:'Colored Borders', value:'M15Borders'},
{name:'Custom Addons', value:'disabled'},
{name:'Brawl Legend Crowns', value:'Brawl'}
]) ])

View File

@@ -34,7 +34,7 @@ document.querySelector('#loadFrameVersion').onclick = async function() {
//sets card version //sets card version
card.version = 'futureRegular'; card.version = 'futureRegular';
loadScript('/js/frames/manaSymbolsFuture.js'); loadScript('/js/frames/manaSymbolsFuture.js');
notify('The Future version adds special mana symbols. To use them, place an "F" before the following mana symbols: wubrg, 0-20, x, and hybrid mana symbols.'); // notify('The Future version adds special mana symbols. To use them, place an "F" before the following mana symbols: wubrg, 0-20, x, and hybrid mana symbols.');
//art bounds //art bounds
card.artBounds = {x:0.086, y:0.0843, width:0.8714, height:0.5853}; card.artBounds = {x:0.086, y:0.0843, width:0.8714, height:0.5853};
autoFitArt(); autoFitArt();
@@ -46,7 +46,7 @@ document.querySelector('#loadFrameVersion').onclick = async function() {
resetWatermark(); resetWatermark();
//text //text
loadTextOptions({ loadTextOptions({
mana: {name:'Mana Cost', text:'', size:119/1638, manaCost:true, manaPlacement:{x:[0.1224, 0.082, 0.0619, 0.0619, 0.0794, 0.1425], y:[0.1348, 0.1993, 0.2705, 0.3427, 0.4206, 0.4928]}, noVerticalCenter:true}, mana: {name:'Mana Cost', text:'', size:119/1638, manaCost:true, manaPlacement:{x:[0.1224, 0.082, 0.0619, 0.0619, 0.0794, 0.1425], y:[0.1348, 0.1993, 0.2705, 0.3427, 0.4206, 0.4928]}, noVerticalCenter:true, manaPrefix:'f'},
title: {name:'Title', text:'', x:0.176, y:0.0491, width:0.832, height:0.0643, oneLine:true, font:'matrixb', size:0.0448, color:'white'}, title: {name:'Title', text:'', x:0.176, y:0.0491, width:0.832, height:0.0643, oneLine:true, font:'matrixb', size:0.0448, color:'white'},
type: {name:'Type', text:'', x:0.1214, y:0.5615, width:0.832, height:0.0586, oneLine:true, font:'matrixb', size:0.0362, color:'white'}, type: {name:'Type', text:'', x:0.1214, y:0.5615, width:0.832, height:0.0586, oneLine:true, font:'matrixb', size:0.0362, color:'white'},
rules: {name:'Rules Text', text:'', x:0.1027, y:0.6248, width:0.8074, height:0.2639, size:0.0362}, rules: {name:'Rules Text', text:'', x:0.1027, y:0.6248, width:0.8074, height:0.2639, size:0.0362},

View File

@@ -29,7 +29,7 @@ document.querySelector('#loadFrameVersion').onclick = async function() {
//sets card version //sets card version
card.version = 'm21'; card.version = 'm21';
loadScript('/js/frames/manaSymbolsM21.js'); loadScript('/js/frames/manaSymbolsM21.js');
notify('The M21 version adds special mana symbols. To use them, place an "M21" or "DM21" before the following mana symbols: wubrg, 0-9, and x.'); notify('To use the darker mana symbols on white cards, place a "DM21" (for "Dark M21") before the following mana symbols: wubrg, 0-9, and x.');
//art bounds //art bounds
card.artBounds = {x:0.0767, y:0.1129, width:0.8476, height:0.4429}; card.artBounds = {x:0.0767, y:0.1129, width:0.8476, height:0.4429};
autoFitArt(); autoFitArt();
@@ -41,7 +41,7 @@ document.querySelector('#loadFrameVersion').onclick = async function() {
resetWatermark(); resetWatermark();
//text //text
loadTextOptions({ loadTextOptions({
mana: {name:'Mana Cost', text:'', y:0.0613, width:0.9292, height:71/2100, oneLine:true, size:71/1638, align:'right', manaCost:true, manaSpacing:0}, mana: {name:'Mana Cost', text:'', y:0.0613, width:0.9292, height:71/2100, oneLine:true, size:71/1638, align:'right', manaCost:true, manaSpacing:0, manaPrefix:'m21'},
title: {name:'Title', text:'', x:0.0854, y:0.0522, width:0.8292, height:0.0543, oneLine:true, font:'belerenb', size:0.0381, color:'white', shadowX:0.0014, shadowY:0.001}, title: {name:'Title', text:'', x:0.0854, y:0.0522, width:0.8292, height:0.0543, oneLine:true, font:'belerenb', size:0.0381, color:'white', shadowX:0.0014, shadowY:0.001},
type: {name:'Type', text:'', x:0.0854, y:0.5664, width:0.8292, height:0.0543, oneLine:true, font:'belerenb', size:0.0324, color:'white', shadowX:0.0014, shadowY:0.001}, type: {name:'Type', text:'', x:0.0854, y:0.5664, width:0.8292, height:0.0543, oneLine:true, font:'belerenb', size:0.0324, color:'white', shadowX:0.0014, shadowY:0.001},
rules: {name:'Rules Text', text:'', x:0.0967, y:0.6453, width:0.8067, height:0.2381, size:0.0362}, rules: {name:'Rules Text', text:'', x:0.0967, y:0.6453, width:0.8067, height:0.2381, size:0.0362},