* Collapse a node. * @param {string | import('./jsmind.node.js').Node} node * @returns {void}
(node)
| 306 | * @returns {void} |
| 307 | */ |
| 308 | collapse_node(node) { |
| 309 | if (!Node.is_node(node)) { |
| 310 | var the_node = this.get_node(node); |
| 311 | if (!the_node) { |
| 312 | logger.error('the node[id=' + node + '] can not be found.'); |
| 313 | return; |
| 314 | } else { |
| 315 | this.collapse_node(the_node); |
| 316 | return; |
| 317 | } |
| 318 | } |
| 319 | if (node.isroot) { |
| 320 | return; |
| 321 | } |
| 322 | this.view.save_location(node); |
| 323 | this.layout.collapse_node(node); |
| 324 | this.view.relayout(); |
| 325 | this.view.restore_location(node); |
| 326 | } |
| 327 | /** Expand all nodes */ |
| 328 | expand_all() { |
| 329 | this.layout.expand_all(); |
no test coverage detected