avoid scrolling to active node without a reason, fixes #4031

This commit is contained in:
zadam 2023-06-18 21:50:22 +02:00
parent 6f16b4caec
commit bbe3f436d3

View File

@ -1002,21 +1002,21 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
this.activityDetected(); this.activityDetected();
const oldActiveNode = this.getActiveNode(); const oldActiveNode = this.getActiveNode();
let oldActiveNodeFocused = false;
if (oldActiveNode) { const newActiveNode = this.noteContext?.notePath
oldActiveNodeFocused = oldActiveNode.hasFocus();
oldActiveNode.setActive(false);
oldActiveNode.setFocus(false);
}
if (this.noteContext
&& this.noteContext.notePath
&& !this.noteContext.note?.isDeleted && !this.noteContext.note?.isDeleted
&& (!treeService.isNotePathInHiddenSubtree(this.noteContext.notePath) || await hoistedNoteService.isHoistedInHiddenSubtree()) && (!treeService.isNotePathInHiddenSubtree(this.noteContext.notePath) || await hoistedNoteService.isHoistedInHiddenSubtree())
) { && await this.getNodeFromPath(this.noteContext.notePath);
const newActiveNode = await this.getNodeFromPath(this.noteContext.notePath);
if (newActiveNode !== oldActiveNode) {
let oldActiveNodeFocused = false;
if (oldActiveNode) {
oldActiveNodeFocused = oldActiveNode.hasFocus();
oldActiveNode.setActive(false);
oldActiveNode.setFocus(false);
}
if (newActiveNode) { if (newActiveNode) {
if (!newActiveNode.isVisible()) { if (!newActiveNode.isVisible()) {