brush size in menu and hotkey fix
This commit is contained in:
parent
b92ddd455e
commit
c2b7c720e2
|
@ -71,6 +71,7 @@ A most latest production build to use is available at https://asciibird.jewbird.
|
|||
|
||||
## Features to Add
|
||||
|
||||
* Context menu for layers
|
||||
* Layers undo and redo could be implemented, at the moment there isn't any.
|
||||
* Warning on mirc export if ascii exceeds IRCs 512 per chat line limit.
|
||||
* Review encodings check on file import - UTF8 vs Latin something
|
||||
|
|
|
@ -252,6 +252,7 @@ import {
|
|||
getBlocksWidth,
|
||||
emptyBlock,
|
||||
canvasToPng,
|
||||
maxBrushSize
|
||||
} from "./ascii";
|
||||
|
||||
import VueFileToolbarMenu from "vue-file-toolbar-menu";
|
||||
|
@ -396,7 +397,15 @@ export default {
|
|||
// We want to avoid hiding all the layers, so if there's only one
|
||||
// visible left, we have to disable the buttons
|
||||
},
|
||||
|
||||
brushSizeHeight() {
|
||||
return this.$store.getters.brushSizeHeight;
|
||||
},
|
||||
brushSizeWidth() {
|
||||
return this.$store.getters.brushSizeWidth;
|
||||
},
|
||||
brushSizeType() {
|
||||
return this.$store.getters.brushSizeType;
|
||||
},
|
||||
// Toolbar related
|
||||
gridView() {
|
||||
return this.toolbarState.gridView;
|
||||
|
@ -832,6 +841,33 @@ export default {
|
|||
this.$store.commit("flipRotateBlocks", { type: "rotate" });
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
text: "Increase Brush Size",
|
||||
hotkey: "ctrl+]",
|
||||
disabled: !this.isBrushing && this.brushSizeHeight < maxBrushSize && this.brushSizeHeight >= 1 && this.brushSizeWidth < maxBrushSize && this.brushSizeWidth >= 1,
|
||||
icon: "add",
|
||||
click: (e) => {
|
||||
this.$store.commit("updateBrushSize", {
|
||||
brushSizeHeight: parseInt(this.brushSizeHeight) + 1,
|
||||
brushSizeWidth: parseInt(this.brushSizeWidth) + 1,
|
||||
brushSizeType: this.brushSizeType,
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
text: "Decrease Brush Size",
|
||||
hotkey: "ctrl+[",
|
||||
disabled: !this.isBrushing && this.brushSizeHeight <= maxBrushSize && this.brushSizeHeight > 1 && this.brushSizeWidth <= maxBrushSize && this.brushSizeWidth > 1,
|
||||
icon: "remove",
|
||||
click: (e) => {
|
||||
this.$store.commit("updateBrushSize", {
|
||||
brushSizeHeight: parseInt(this.brushSizeHeight) - 1,
|
||||
brushSizeWidth: parseInt(this.brushSizeWidth) - 1,
|
||||
brushSizeType: this.brushSizeType,
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
is: "separator",
|
||||
},
|
||||
|
@ -1046,8 +1082,7 @@ export default {
|
|||
methods: {
|
||||
updateAsciiDetails(widthHeight) {
|
||||
// From edit ascii modal to editor
|
||||
this.updateAscii = widthHeight
|
||||
|
||||
this.updateAscii = widthHeight;
|
||||
},
|
||||
dispatchBlocks() {
|
||||
this.diffBlocks.old = this.diffBlocks.old.flat();
|
||||
|
@ -1295,7 +1330,6 @@ export default {
|
|||
this.isShowingDialog = false;
|
||||
});
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -65,50 +65,6 @@ export default {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
hotkeys("ctrl+]", "editor", function (event, handler) {
|
||||
event.preventDefault();
|
||||
if (
|
||||
_this.brushSizeHeight < maxBrushSize &&
|
||||
_this.brushSizeHeight >= 1 &&
|
||||
_this.brushSizeWidth < maxBrushSize &&
|
||||
_this.brushSizeWidth >= 1 &&
|
||||
_this.haveOpenTabs &&
|
||||
!_this.isShowingDialog &&
|
||||
!_this.isModalOpen
|
||||
) {
|
||||
_this.$store.commit("updateBrushSize", {
|
||||
brushSizeHeight: parseInt(_this.brushSizeHeight) + 1,
|
||||
brushSizeWidth: parseInt(_this.brushSizeWidth) + 1,
|
||||
brushSizeType: _this.brushSizeType,
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
hotkeys("ctrl+[", "editor", function (event, handler) {
|
||||
event.preventDefault();
|
||||
if (
|
||||
_this.brushSizeHeight <= maxBrushSize &&
|
||||
_this.brushSizeHeight > 1 &&
|
||||
_this.brushSizeWidth <= maxBrushSize &&
|
||||
_this.brushSizeWidth > 1 &&
|
||||
_this.haveOpenTabs &&
|
||||
!_this.isShowingDialog &&
|
||||
!_this.isModalOpen
|
||||
) {
|
||||
_this.$store.commit("updateBrushSize", {
|
||||
brushSizeHeight: parseInt(_this.brushSizeHeight) - 1,
|
||||
brushSizeWidth: parseInt(_this.brushSizeWidth) - 1,
|
||||
brushSizeType: _this.brushSizeType,
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
hotkeys("Escape", function (event, handler) {
|
||||
if (
|
||||
!_this.textEditing &&
|
||||
|
|
|
@ -432,6 +432,8 @@ export default new Vuex.Store({
|
|||
.layers))
|
||||
|
||||
if (tempLayers[payload.key]) {
|
||||
|
||||
|
||||
tempLayers[payload.key].label = payload.label;
|
||||
state.asciibirdMeta[state.tab].layers = LZString.compressToUTF16(JSON.stringify(
|
||||
tempLayers));
|
||||
|
@ -444,6 +446,24 @@ export default new Vuex.Store({
|
|||
state.asciibirdMeta[state.tab].title = payload;
|
||||
},
|
||||
|
||||
|
||||
// pushLayerHistory(state, payload) {
|
||||
// let historyIndex = state.asciibirdMeta[state.tab].historyIndex;
|
||||
|
||||
// payload = payload.map(function(item) {
|
||||
// delete item['data']
|
||||
// return item;
|
||||
// });
|
||||
|
||||
// let layerHistory = LZString.compressToUTF16(JSON.stringify({
|
||||
// t: 'l',
|
||||
// o: payload.old,
|
||||
// n: payload.new
|
||||
// }));
|
||||
|
||||
// state.asciibirdMeta[state.tab].history.push(layerHistory)
|
||||
// },
|
||||
|
||||
// BLOCKS
|
||||
undoBlocks(state) {
|
||||
let historyIndex = state.asciibirdMeta[state.tab].historyIndex;
|
||||
|
@ -463,9 +483,9 @@ export default new Vuex.Store({
|
|||
...data.b
|
||||
};
|
||||
|
||||
if (tempLayers[prev.l].data[data.y][data.x]['char'] === undefined) {
|
||||
tempLayers[prev.l].data[data.y][data.x]['char'] = " ";
|
||||
}
|
||||
// if (tempLayers[prev.l].data[data.y][data.x]['char'] === undefined) {
|
||||
// tempLayers[prev.l].data[data.y][data.x]['char'] = " ";
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -491,9 +511,9 @@ export default new Vuex.Store({
|
|||
let data = prev.new[change];
|
||||
tempLayers[prev.l].data[data.y][data.x] = { ... data.b };
|
||||
|
||||
if (tempLayers[prev.l].data[data.y][data.x]['char'] === undefined) {
|
||||
tempLayers[prev.l].data[data.y][data.x]['char'] = " ";
|
||||
}
|
||||
// if (tempLayers[prev.l].data[data.y][data.x]['char'] === undefined) {
|
||||
// tempLayers[prev.l].data[data.y][data.x]['char'] = " ";
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -488,7 +488,14 @@ export default {
|
|||
this.delayRedrawCanvas();
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
// Layers undo
|
||||
// currentAsciiLayers(val, old) {
|
||||
// this.$store.commit("pushLayerHistory", {
|
||||
// old: old,
|
||||
// new: val,
|
||||
// });
|
||||
// }
|
||||
},
|
||||
methods: {
|
||||
startExport(type) {
|
||||
|
|
Loading…
Reference in New Issue