Implement & fix action edit popup showing existing actions

This commit is contained in:
Tamius Han 2019-03-17 23:24:08 +01:00
parent f3e0a48471
commit 7837cf2e22
5 changed files with 18 additions and 6 deletions

View File

@ -159,6 +159,7 @@ export default {
showEditActionPopup(event) {
console.log("SHOW EDIT ACTION/APP:", event)
this.editActionPopupVisible = true;
this.editActionIndex = event;
this.anyOpenedPopups = true;
},
closePopups(){

View File

@ -118,6 +118,12 @@ export default {
}
},
created () {
console.log("Opening action edit popup. Action index:", this.actionIndex, "\nAction:", this.settings.active.actions[this.actionIndex]);
if (this.actionIndex >= 0) {
// this.currentCmdIndex = this.actionIndex;
this.action = this.settings.active.actions[this.actionIndex];
this.currentCmdIndex = this.actionIndex;
}
},
computed: {
globalScopeOptions: function() {
@ -145,6 +151,9 @@ export default {
watch: {
action: {
deep: true,
handler: function(val) {
this.action = val;
}
}
},
methods: {

View File

@ -2,8 +2,8 @@
<div class="block-main">
<div class="button-main">
<div class="button-action-display">
{{ActionList[action.cmd].name}}:&nbsp;{{
/*ActionList[action.cmd].args.find(x => x.arg === action.arg).arg ||*/ action.arg
{{ActionList[action.action].name}}:&nbsp;{{
(ActionList[action.action].args.find(x => x.arg === action.arg) || action).arg
}}
</div>
<div class="actions flex flex-row flex-center flex-cross-center">
@ -47,6 +47,7 @@ export default {
}
},
created () {
console.log("Creating command block for action:", JSON.parse(JSON.stringify(this.action)), JSON.parse(JSON.stringify(ActionList)))
},
props: {
action: Object,

View File

@ -26,6 +26,7 @@ import CommandAddEdit from './command-add-edit';
export default {
created () {
console.log("Initializing command chain. Command:", JSON.parse(JSON.stringify(this.command)))
},
components: {
CommandBlock,

View File

@ -16,7 +16,7 @@ import KeyboardShortcutParser from '../../../common/js/KeyboardShortcutParser'
export default {
props: {
shortcut: Object,
shortcut: Array, // note: array in unlikely case we ever try to implement choords
waitingForPress: false,
},
data() {
@ -25,8 +25,8 @@ export default {
}
},
created(){
if (this.shortcut) {
this.shortcutText = KeyboardShortcutParser.parseShortcut(shortcut);
if (this.shortcut && this.shortcut.length) {
this.shortcutText = KeyboardShortcutParser.parseShortcut(this.shortcut[0]);
}
},
methods: {
@ -45,7 +45,7 @@ export default {
onKeyUp: true,
onKeyDown: false,
};
this.$emit('set-shortcut', shortcut)
this.$emit('set-shortcut', [shortcut])
this.$refs.input.blur();
this.shortcutText = KeyboardShortcutParser.parseShortcut(shortcut);
}