mind-elixir-core icon indicating copy to clipboard operation
mind-elixir-core copied to clipboard

Collapse / expand the root node

Open jpdelmundo opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. There is no way to collapse / expand the root node.

Describe the solution you'd like Something like mind.collapseNode(mind.currentNode) or mind.expandNode(mind.currentNode) or mind.toggleNode(<root node>). Or something built-in the context menu. I could set expanded: bool to collapse / expand a node but it does not work on the root node.

Describe alternatives you've considered I could set expanded: bool to collapse / expand a node but it does not work on the root node.

jpdelmundo avatar Sep 24 '24 10:09 jpdelmundo

It's not easy to find a specific position to place the expander of root node. I tried another mindmap app (xmind) just now, it seems also doesn't let you collapse the root node.

SSShooter avatar Sep 25 '24 05:09 SSShooter

It doesn't necessarily need to be an expander icon on the root node. It could be in the context menu.

What I've done is oncontextmenu, if nodeObj.expanded == true, I set the contextMenuOption name to "Collapse All", otherwise it is "Expand All". Then onclick, I set mind.currentNode.nodeObj.expanded to true/false, and do the same recursively on mind.currentNode.nodeObj.children.

The only problem is the root node nodeObj does not effectively have an expanded property.

jpdelmundo avatar Sep 25 '24 06:09 jpdelmundo