Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

feat: show parent tree for zoom mode #65

Merged
merged 9 commits into from
Feb 14, 2020
Merged

Conversation

niekvanstaveren
Copy link
Collaborator

No description provided.

Comment on lines 23 to 29
if (nodeTree.data.navigationMode === 'free' && topNode.parent) {
const ancestors = topNode.parent.ancestors();
ancestors.forEach(ancestor => {
subTree.push(ancestor);
subTree.push(...ancestor.children);
});
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will lead to duplicates in the tree.
in free mode we could just as well keep the topNode static to the root OR if we want options later on just go up a few levels, then start adding nodes (instead of adding normally first, then ancestors.)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The upside of having a topNode (which probably should be called main or active now...) is that the only thing that differs between the two modes is ancestors. So we can reuse the logic from before.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could easily filter out the duplicates here actually. It would be great if we can keep the expandedState the same for all the navigation modes we use.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed now

Copy link
Collaborator

@Caele Caele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test for the filter function, just to be sure =).

@niekvanstaveren
Copy link
Collaborator Author

Added unit test and merged master

@niekvanstaveren niekvanstaveren merged commit a967ad0 into master Feb 14, 2020
@niekvanstaveren niekvanstaveren deleted the dvr/show-parents branch February 14, 2020 15:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants