Implement that nodes can also be deselected with ctrl+click

This commit is contained in:
Jan Oberhauser
2019-07-17 19:05:03 +02:00
parent 416eb81a6e
commit 5054c7054d
3 changed files with 31 additions and 4 deletions

View File

@@ -26,6 +26,9 @@ export const nodeBase = mixins(nodeIndex).extend({
}
return false;
},
isMacOs(): boolean {
return /(ipad|iphone|ipod|mac)/i.test(navigator.platform);
},
isReadOnly (): boolean {
if (['NodeViewExisting', 'NodeViewNew'].includes(this.$route.name as string)) {
return false;
@@ -271,23 +274,32 @@ export const nodeBase = mixins(nodeIndex).extend({
this.$store.commit('updateNodeProperties', updateInformation);
});
this.$store.commit('removeActiveAction', 'dragActive');
}
},
filter: '.action-button',
});
},
isCtrlKeyPressed(e: MouseEvent | KeyboardEvent): boolean {
if (this.isMacOs) {
return e.metaKey;
}
return e.ctrlKey;
},
mouseLeftClick (e: MouseEvent) {
if (this.$store.getters.isActionActive('dragActive')) {
this.$store.commit('removeActiveAction', 'dragActive');
} else {
if (!e.ctrlKey) {
if (this.isCtrlKeyPressed(e) === false) {
this.$emit('deselectAllNodes');
}
this.$emit('nodeSelected', this.name);
if (this.$store.getters.isNodeSelected(this.data.name)) {
this.$emit('deselectNode', this.name);
} else {
this.$emit('nodeSelected', this.name);
}
}
},
},