text undo fg bug fix, dono some other stuff

This commit is contained in:
Hugh Bord 2022-05-09 13:43:28 +08:00
parent de80863cd6
commit 9cf27a8b9a
5 changed files with 12 additions and 8 deletions

View File

@ -84,7 +84,8 @@ A most latest production build to use is available at https://asciibird.jewbird.
* If you drag a panel, then right click you can't drag it anymore
* Resize canvas undo
* When undoing blocks defaults to current fg instead of blocks fg
* Chzz's corrupt state, maybe running out of internal space?
* Bug with hotkey brush switching, if make a new ascii hotkeys are broke - something to do with the hotkey function
* Unit testing
### v 1.2

File diff suppressed because one or more lines are too long

View File

@ -161,9 +161,11 @@ export default {
event.preventDefault();
if (_this.isBrushing || _this.isErasing) {
let brushSelect =
Number.parseInt(event.key) !== 0 ? Number.parseInt(event.key) - 1 : 9;
if (_this.brushLibrary[brushSelect]) {
_this.reuseBlocks(
_this.decompressBlock(_this.brushLibrary[brushSelect].blocks)
);

View File

@ -574,6 +574,7 @@ export default new Vuex.Store({
if (prev.old) {
for (let change in prev.old) {
let data = prev.old[change];
console.log(data);
if (tempLayers[prev.l] !== undefined) {
tempLayers[prev.l].data[data.y][data.x] = {
...data.b
@ -585,8 +586,6 @@ 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

View File

@ -393,13 +393,15 @@ export default {
},
watch: {
currentAsciiHeight(val) {
console.log(val);
this.canvas.height = val * blockHeight;
},
currentAsciiWidth(val) {
console.log(val);
this.canvas.width = val * blockWidth;
},
async currentAscii(val, old) {
if (val !== old) {
if (JSON.stringify(val) !== JSON.stringify(old)) {
this.canvas.width = this.currentAsciiWidth * blockWidth;
this.canvas.height = this.currentAsciiHeight * blockHeight;
await this.delayRedrawCanvas();
@ -704,13 +706,13 @@ export default {
// Normal typing
default:
if (char.length === 1) {
oldBlock = { ...targetBlock };
targetBlock.char = char;
if (this.canFg) {
targetBlock.fg = this.currentFg;
}
oldBlock = { ...targetBlock };
targetBlock.char = char;
this.storeDiffBlocks(
this.textEditing.startX,
this.textEditing.startY,