mirc import better

This commit is contained in:
Hugh Bord 2021-03-20 19:33:16 +10:00
parent e8aeb10e9d
commit 6dc31339d8
3 changed files with 26 additions and 26 deletions

View File

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
<link rel='stylesheet' href='//cdn.jsdelivr.net/npm/hack-font@3.3.0/build/web/hack.css'>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/hack-font@3.3.0/build/web/hack.css">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>

View File

@ -1,8 +1,5 @@
<template>
<div id="app">
<t-modal
name="create-ascii-modal"
header="Create new ASCII"
@ -76,8 +73,6 @@
<Editor v-if="asciibirdMeta.length" />
</div>
</div>
</div>
</template>
@ -321,19 +316,19 @@ export default {
secondColor = false;
// CC
if (
asciiStringArray[0] === "\u0003" &&
asciiStringArray[1] === "\u0003"
) {
curBlock = {
fg: null,
bg: null,
char: null,
};
// if (
// asciiStringArray[0] === "\u0003" &&
// asciiStringArray[1] === "\u0003"
// ) {
// curBlock = {
// fg: null,
// bg: null,
// char: null,
// };
console.log("Got CC");
continue;
}
// console.log("Got CC");
// continue;
// }
asciiStringArray.shift();
theWidth++;
@ -343,7 +338,11 @@ export default {
colorChar2 = `${asciiStringArray[1]}`;
parsedColor = parseInt(`${colorChar1}${colorChar2}`);
if (parsedColor <= MIRC_MAX_COLORS && parsedColor >= 0) {
if (isNaN(parsedColor)) {
curBlock.bg = parseInt(colorChar1);
theWidth += 1;
asciiStringArray.shift();
} else if (parsedColor <= MIRC_MAX_COLORS && parsedColor >= 0) {
curBlock.fg = parseInt(parsedColor);
firstColor = true;
theWidth += parsedColor.toString().length;
@ -372,7 +371,11 @@ export default {
colorChar2 = `${asciiStringArray[1]}`;
parsedColor = parseInt(`${colorChar1}${colorChar2}`);
if (parsedColor <= MIRC_MAX_COLORS && parsedColor >= 0) {
if (isNaN(parsedColor)) {
curBlock.bg = parseInt(colorChar1);
theWidth += 1;
asciiStringArray.shift();
} else if (parsedColor <= MIRC_MAX_COLORS && parsedColor >= 0) {
curBlock.bg = parseInt(parsedColor);
theWidth += parsedColor.toString().length;
@ -404,9 +407,6 @@ export default {
} // End loop charPos
this.$store.commit("newAsciibirdMeta", this.finalAscii);
},
createClick() {
this.forms.createAscii.title = `New ASCII ${this.asciibirdMeta.length}`;

View File

@ -166,7 +166,7 @@ export default {
let canvasY = 0;
let curBlock = {};
this.ctx.font = "14px Hack";
this.ctx.font = "12.5px Hack";
for (y = 0; y < this.currentAsciibirdMeta.height + 1; y++) {
canvasY = BLOCK_HEIGHT * y;
@ -198,8 +198,8 @@ export default {
this.ctx.fillText(
curBlock.char,
canvasX,
canvasY + BLOCK_HEIGHT
canvasX - 1,
canvasY + BLOCK_HEIGHT - 3
);
this.ctx.stroke();
}