Parameterize info icon Y pos

This commit is contained in:
goat 2021-05-26 22:42:31 +02:00
parent 7e86059465
commit 374bbe5bba
No known key found for this signature in database
GPG key ID: F18F057873895461

View file

@ -18,16 +18,6 @@ const jobsRowTextStartX = 495;
const jobsRowTextSize = 30; const jobsRowTextSize = 30;
const jobsRowTextSpacer = jobsRowTextSize * 2; const jobsRowTextSpacer = jobsRowTextSize * 2;
const deityIconCol = 252;
const deityIconRow = 805;
const gcRankIconCol = 293;
const gcRankIconRow = 799;
const fcCrestScale = 38;
const fcCrestCol = 345;
const fcCrestRow = 800;
const rectHeightRow1 = 120; // Title, Name, World const rectHeightRow1 = 120; // Title, Name, World
const rectHeightRow2 = 40; // Mounts, Minions const rectHeightRow2 = 40; // Mounts, Minions
const rectHeightRow3 = 210; // Info const rectHeightRow3 = 210; // Info
@ -63,6 +53,16 @@ console.log("rectStartRow2: " + rectStartRow2Y);
console.log("rectStartRow3: " + rectStartRow3Y); console.log("rectStartRow3: " + rectStartRow3Y);
console.log("rectStartRow4: " + rectStartRow4Y); console.log("rectStartRow4: " + rectStartRow4Y);
const deityIconY = rectStartRow3Y + 69;
const deityIconX = 805;
const gcRankIconY = rectStartRow3Y + 110;
const gcRankIconX = 799;
const fcCrestScale = 38;
const fcCrestY = rectStartRow3Y + 162;
const fcCrestX = 800;
class CardCreator { class CardCreator {
constructor() { constructor() {
this.isInit = false; this.isInit = false;
@ -234,17 +234,17 @@ class CardCreator {
ctx.fillText(data.Character.GuardianDeity.Name, 480, 280); ctx.fillText(data.Character.GuardianDeity.Name, 480, 280);
var deityIcon = await loadImage('https://xivapi.com/' + data.Character.GuardianDeity.Icon); var deityIcon = await loadImage('https://xivapi.com/' + data.Character.GuardianDeity.Icon);
ctx.drawImage(deityIcon, deityIconRow, deityIconCol, 28, 28); ctx.drawImage(deityIcon, deityIconX, deityIconY, 28, 28);
if (data.Character.GrandCompany.Company != null) { if (data.Character.GrandCompany.Company != null) {
ctx.fillText(data.Character.GrandCompany.Company.Name, 480, 330); ctx.fillText(data.Character.GrandCompany.Company.Name, 480, 330);
var gcRankIcon = await loadImage('https://xivapi.com/' + data.Character.GrandCompany.Rank.Icon); var gcRankIcon = await loadImage('https://xivapi.com/' + data.Character.GrandCompany.Rank.Icon);
ctx.drawImage(gcRankIcon, gcRankIconRow, gcRankIconCol, 40, 40); ctx.drawImage(gcRankIcon, gcRankIconX, gcRankIconY, 40, 40);
} }
if (data.Character.FreeCompanyName != null) { if (data.Character.FreeCompanyName != null) {
var crestImage = await this.createCrest(data.FreeCompany.Crest); var crestImage = await this.createCrest(data.FreeCompany.Crest);
ctx.drawImage(crestImage, fcCrestRow, fcCrestCol, fcCrestScale, fcCrestScale); ctx.drawImage(crestImage, fcCrestX, fcCrestY, fcCrestScale, fcCrestScale);
ctx.fillText(data.Character.FreeCompanyName, 480, 380); ctx.fillText(data.Character.FreeCompanyName, 480, 380);
} }