* Toggle a node's expanded state. * @param {string | import('./jsmind.node.js').Node} node * @returns {void}
(node)
| 258 | * @returns {void} |
| 259 | */ |
| 260 | toggle_node(node) { |
| 261 | if (!Node.is_node(node)) { |
| 262 | var the_node = this.get_node(node); |
| 263 | if (!the_node) { |
| 264 | logger.error('the node[id=' + node + '] can not be found.'); |
| 265 | return; |
| 266 | } else { |
| 267 | this.toggle_node(the_node); |
| 268 | return; |
| 269 | } |
| 270 | } |
| 271 | if (node.isroot) { |
| 272 | return; |
| 273 | } |
| 274 | this.view.save_location(node); |
| 275 | this.layout.toggle_node(node); |
| 276 | this.view.relayout(); |
| 277 | this.view.restore_location(node); |
| 278 | } |
| 279 | /** |
| 280 | * Expand a node. |
| 281 | * @param {string | import('./jsmind.node.js').Node} node |
no test coverage detected