transparent blocks on export

This commit is contained in:
Hugh Bord 2021-09-04 10:21:53 +10:00
parent 98db95516d
commit 608a35e9d4
3 changed files with 36 additions and 10 deletions

View File

@ -72,6 +72,8 @@ ASCIIBIRD is mostly usable. There are some bugs however to note at the moment. R
* We could add a special clause for the select tool when mouse leaves canvas to select all blocks
* z indexing for toolbars and stuff is ANNOYING
* Messing with deleting layers, if you somehow have a layer that isn't selected, it'll be buggy. This is hard to do.
* Review escape and enter keys on dialogs and modals
* Fill tool use fg or char as bounds
## Focusing on Now / Roadmap
* Modals to add

View File

@ -484,6 +484,7 @@ export const exportMirc = () => {
const blocks = mergeLayers();
const output = [];
let curBlock = false;
let pushString = '';
let prevBlock = {
bg: -1,
@ -507,21 +508,31 @@ export const exportMirc = () => {
const zeroPad = (num, places) => String(num).padStart(places, '0');
if (curBlock.fg === null && curBlock.bg === null) {
output.push(" ");
output.push('\u0003');
} else {
output.push(
`\u0003${zeroPad(
curBlock.fg,
2,
)},${zeroPad(curBlock.bg, 2)}`,
);
if (curBlock.bg === null && curBlock.fg !== null) {
pushString = `\u0003\u0003${zeroPad(curBlock.fg,2,)}`;
}
// if (curBlock.bg !== null && curBlock.fg === null) {
// pushString = `\u0003,${zeroPad(curBlock.bg, 2)}`;
// }
if (curBlock.bg !== null && curBlock.fg !== null) {
pushString = `\u0003${zeroPad(curBlock.fg,2,)},${zeroPad(curBlock.bg, 2)}`;
}
output.push(pushString);
}
}
// null .chars will end up as space
output.push(curBlock.char ?? ' ');
prevBlock = blocks[y][x];
prevBlock = {
...blocks[y][x]
};
}
// We can never have a -1 colour code so we'll always

View File

@ -1219,7 +1219,20 @@ export default {
// Fill tool
fill(eraser = false) {
const newColor = this.currentBg;
const current = this.asciiBlockAtXy.bg;
// We can eraser or fill
// if (this.canBg) {
// const current = this.asciiBlockAtXy.bg;
// }
// if (this.canFg) {
// const current = this.asciiBlockAtXy.bg;
// }
// if (this.canText) {
// const current = this.asciiBlockAtXy.bg;
// }
// If the newColor is same as the existing
// Then return the original image.