fix: disregard modifiers for note selection if user hasn't triggered the action

This commit is contained in:
Antonella Sgarlatta
2021-06-02 11:20:24 -03:00
parent 26732f5b8d
commit 3823836863
3 changed files with 12 additions and 8 deletions

View File

@@ -108,13 +108,14 @@ export class NotesState {
}
}
async selectNote(uuid: UuidString): Promise<void> {
async selectNote(uuid: UuidString, userTriggered?: boolean): Promise<void> {
const note = this.application.findItem(uuid) as SNNote;
if (note) {
if (
this.io.activeModifiers.has(KeyboardModifier.Meta) ||
this.io.activeModifiers.has(KeyboardModifier.Ctrl)
userTriggered &&
(this.io.activeModifiers.has(KeyboardModifier.Meta) ||
this.io.activeModifiers.has(KeyboardModifier.Ctrl))
) {
if (this.selectedNotes[uuid]) {
delete this.selectedNotes[uuid];
@@ -124,7 +125,10 @@ export class NotesState {
this.lastSelectedNote = note;
});
}
} else if (this.io.activeModifiers.has(KeyboardModifier.Shift)) {
} else if (
userTriggered &&
this.io.activeModifiers.has(KeyboardModifier.Shift)
) {
await this.selectNotesRange(note);
} else {
const shouldSelectNote =