updates, fill tool fix

This commit is contained in:
Hugh Bord 2022-02-05 12:31:34 +10:00
parent 60e6f495bb
commit 641f313c86
5 changed files with 64 additions and 38 deletions

View File

@ -80,13 +80,14 @@ A most latest production build to use is available at https://asciibird.jewbird.
## Bugs in v1
* Undo sometimes stops working.
* Ignore checkboxes when saving/copy brush
##### Fixed
* System to review the localStorage data and update any differences
* Asciis sometimes open with 1 more block width and height
* The layers and undo sometimes may have bugs, but seems hard to replicate.
* The layers and undo sometimes may have bugs, but seems hard to replicate. Related to undo bug.
* Undo sometimes stops working.
##### To fix before properly releasing v1
@ -99,11 +100,14 @@ A most latest production build to use is available at https://asciibird.jewbird.
* Warning on mirc export if ascii exceeds IRCs 512 per chat line limit.
* Review encodings check on file import - UTF8 vs Latin something
* Fill tool is limited by the recursion limit on the browser. Each browser has a different limit. Filling an empty 80x196 ascii will throw a recursion error on firefox, but not on Safari for this reason. We can review the fill feature in a future version of ASCII bird.
* More fill tool options?
### v 1.2
* Half block editing mode
* Dark / light modes, different themes
* Expand the brush manager, brush categories, download brushes, import/export brushes
* ASCIIBIRD API ?!
## Mobile / Touch Screen support

View File

@ -190,7 +190,7 @@
</template>
<template v-else>
<div
class="absolute left-1/2 transform -translate-x-1/2 text-center"
class="absolute left-1/2 transform -translate-x-1/2 text-center top-1/2 -translate-y-1/2"
@mouseup.right="openContextMenu"
>
<BrushCanvas :blocks="this.splashAscii()" />

File diff suppressed because one or more lines are too long

View File

@ -236,8 +236,6 @@ export default new Vuex.Store({
state.asciibirdMeta[state.tab].layers = LZString.compressToUTF16(JSON.stringify(
tempLayers));
// state.asciibirdMeta[state.tab].current = LZString.compressToUTF16(JSON.stringify(mergeLayers()));
let historyIndex = state.asciibirdMeta[state.tab].historyIndex;
if (payload.diff && payload.diff.new && payload.diff.new.length) {
@ -248,8 +246,15 @@ export default new Vuex.Store({
state.asciibirdMeta[state.tab].history.push(LZString.compressToUTF16(JSON.stringify(
payload.diff)))
state.asciibirdMeta[state.tab].historyIndex = state.asciibirdMeta[state.tab].history
.length;
if (historyIndex > state.asciibirdMeta[state.tab].history.length) {
state.asciibirdMeta[state.tab].historyIndex = state.asciibirdMeta[state.tab].history
.length;
}
}
return;
@ -296,6 +301,7 @@ export default new Vuex.Store({
old: oldLayer
}))
});
state.asciibirdMeta[state.tab].historyIndex = state.asciibirdMeta[state.tab].history
.length;
},
@ -337,6 +343,7 @@ export default new Vuex.Store({
old: oldLayer
}))
});
state.asciibirdMeta[state.tab].historyIndex = state.asciibirdMeta[state.tab].history
.length;
},
@ -361,6 +368,7 @@ export default new Vuex.Store({
old: oldLayer
}))
});
state.asciibirdMeta[state.tab].historyIndex = state.asciibirdMeta[state.tab].history
.length;
},
@ -408,6 +416,7 @@ export default new Vuex.Store({
old: oldLayer
}))
});
state.asciibirdMeta[state.tab].historyIndex = state.asciibirdMeta[state.tab].history
.length;
}
@ -571,12 +580,13 @@ export default new Vuex.Store({
let data = JSON.parse(LZString.decompressFromUTF16(state.asciibirdMeta[state.tab]
.history[historyIndex - 1].d));
state.asciibirdMeta[state.tab].layers = LZString.compressToUTF16(JSON.stringify(data
state.asciibirdMeta[state.tab].layers = LZString.compressToUTF16(JSON.stringify(data
.old));
state.asciibirdMeta[state.tab].historyIndex--;
// Automatically select the next best layer to avoid bugs
let selectedLayer = state.asciibirdMeta[state.tab].selectedLayer
@ -614,7 +624,15 @@ export default new Vuex.Store({
state.asciibirdMeta[state.tab].layers = LZString.compressToUTF16(JSON.stringify(
tempLayers));
state.asciibirdMeta[state.tab].historyIndex--;
if (state.asciibirdMeta[state.tab].historyIndex > state.asciibirdMeta[state.tab].history
.length) {
state.asciibirdMeta[state.tab].historyIndex = state.asciibirdMeta[state.tab].history
.length;
}
}
},
redoBlocks(state) {
@ -664,6 +682,12 @@ export default new Vuex.Store({
tempLayers));
state.asciibirdMeta[state.tab].historyIndex++;
if (state.asciibirdMeta[state.tab].historyIndex > state.asciibirdMeta[state.tab].history
.length) {
state.asciibirdMeta[state.tab].historyIndex = state.asciibirdMeta[state.tab].history
.length;
}
}
},

View File

@ -1926,8 +1926,8 @@ export default {
// Fill tool
fill(eraser = false) {
const newColor = {
fg: this.currentFg,
bg: this.currentBg,
// fg: this.currentFg,
char: this.currentChar,
};
@ -1937,14 +1937,14 @@ export default {
delete newColor["bg"];
}
if (!this.canFg) {
delete newColor["fg"];
}
// if (!this.canText) {
// delete newColor["char"];
// if (!this.canFg) {
// delete newColor["fg"];
// }
if (!this.canText) {
delete newColor["char"];
}
// If the newColor is same as the existing
// Then return the original image.
if (JSON.stringify(current) === JSON.stringify(newColor) && !eraser) {
@ -1975,27 +1975,20 @@ export default {
return;
}
if (
this.diffBlocks[y] !== undefined &&
this.diffBlocks[y][x] !== undefined
) {
return;
}
let targetBlock = currentLayerBlocks[y][x];
if (this.canBg && targetBlock.bg !== current.bg) {
return;
}
if (this.canFg && targetBlock.fg !== current.fg) {
return;
}
// if (this.canText && targetBlock.char !== current.char) {
// if (this.canFg && targetBlock.fg !== current.fg) {
// return;
// }
if (this.canText && targetBlock.char !== current.char) {
return;
}
// We can eraser or fill
let oldBlock = { ...targetBlock };
if (!eraser) {
@ -2025,22 +2018,32 @@ export default {
}
}
// if (this.diffBlocks.new[y] === undefined && this.diffBlocks.new[y][x] === undefined) {
// if (!this.diffBlocks.new && !this.diffBlocks.new[y] && !this.diffBlocks.new[y][x]) {
this.storeDiffBlocks(x, y, oldBlock, targetBlock);
// }
// Fill in all four directions
// Fill Prev row
this.fillTool(currentLayerBlocks, y, x - 1, current, eraser);
if (currentLayerBlocks[y] && currentLayerBlocks[y][x - 1]) {
this.fillTool(currentLayerBlocks, y, x - 1, current, eraser);
}
// Fill Next row
this.fillTool(currentLayerBlocks, y, x + 1, current, eraser);
if (currentLayerBlocks[y] && currentLayerBlocks[y][x + 1]) {
this.fillTool(currentLayerBlocks, y, x + 1, current, eraser);
}
// Fill Prev col
this.fillTool(currentLayerBlocks, y - 1, x, current, eraser);
if (currentLayerBlocks[y - 1] && currentLayerBlocks[y - 1][x]) {
this.fillTool(currentLayerBlocks, y - 1, x, current, eraser);
}
// Fill next col
this.fillTool(currentLayerBlocks, y + 1, x, current, eraser);
if (currentLayerBlocks[y + 1] && currentLayerBlocks[y + 1][x]) {
this.fillTool(currentLayerBlocks, y + 1, x, current, eraser);
}
return;
},
},
};