fill tool fix, null blocks fix

This commit is contained in:
Hugh Bord 2021-09-18 10:37:55 +10:00
parent 954259703d
commit 980d62d892
2 changed files with 14 additions and 17 deletions

View File

@ -66,8 +66,12 @@ ASCIIBIRD is mostly usable. There are some bugs however to note at the moment. R
* Keyboard shortcuts can be pressed at the same time which makes bugs for undo and redo if you aren't careful!
* Circle brush (works okay for odd width and height numbers)
* Importer could be re-written with regex
* Having more than a few layers depending on ascii size will slow things down, until the `fillNullBlocks` is refactored.
* CHUNKED DIFF ENGINE
* Messing with deleting layers, if you somehow have a layer that isn't selected, it'll be buggy. This is hard to do.
* Make grid faster (gonna do that later, maybe never)
## Focusing on Now / Roadmap
* Modals to add

View File

@ -548,15 +548,15 @@ export default {
case "dropper":
if (this.canFg) {
this.$store.commit("changeColourFg", targetBlock.fg);
this.$store.commit("changeColourFg", (targetBlock.fg === null) ? this.currentFg : targetBlock.fg );
}
if (this.canBg) {
this.$store.commit("changeColourBg", targetBlock.bg);
this.$store.commit("changeColourBg", (targetBlock.bg === null) ? this.currentBg : targetBlock.bg );
}
if (this.canText) {
this.$store.commit("changeChar", targetBlock.char);
this.$store.commit("changeChar", (targetBlock.char === null) ? this.currentChar : targetBlock.char );
}
this.$store.commit("changeTool", 0);
@ -1074,6 +1074,13 @@ export default {
continue;
}
// if (
// this.top !== false &&
// !this.checkVisible(this.top + (y * blockHeight) - this.yOffset)
// ) {
// continue;
// }
const brushBlock = this.brushBlocks[y][x];
const brushX = this.x * blockWidth + x * blockWidth - brushDiffX;
@ -1236,11 +1243,6 @@ export default {
current.fg = this.asciiBlockAtXy.fg;
}
if (this.canText) {
newColor.char = this.currentChar;
current.char = this.asciiBlockAtXy.char;
}
// If the newColor is same as the existing
// Then return the original image.
if (JSON.stringify(current) === JSON.stringify(newColor) && !eraser) {
@ -1260,16 +1262,7 @@ export default {
return;
}
// If the current pixel is not which needs to be replaced
if (this.canText && fillBlocks[y][x].char !== current.char) {
fillBlocks[y][x].bg = eraser ? null : this.currentBg;
fillBlocks[y][x].fg = eraser ? null : this.currentFg;
fillBlocks[y][x].char = eraser ? null : this.currentChar;
return;
}
if (this.canFg && fillBlocks[y][x].fg !== current.fg) {
fillBlocks[y][x].fg = eraser ? null : this.currentFg;
return;
}