| 400 | } |
| 401 | |
| 402 | export function magnifyNodeToggle(layoutState: LayoutTreeState, action: LayoutTreeMagnifyNodeToggleAction) { |
| 403 | if (!action.nodeId) { |
| 404 | console.error("invalid magnifyNodeToggle operation. nodeId must be defined."); |
| 405 | return; |
| 406 | } |
| 407 | if (layoutState.rootNode.id === action.nodeId) { |
| 408 | console.warn(`cannot toggle magnification of node ${action.nodeId} because it is the root node.`); |
| 409 | return; |
| 410 | } |
| 411 | if (layoutState.magnifiedNodeId === action.nodeId) { |
| 412 | layoutState.magnifiedNodeId = undefined; |
| 413 | } else { |
| 414 | layoutState.magnifiedNodeId = action.nodeId; |
| 415 | layoutState.focusedNodeId = action.nodeId; |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | export function clearTree(layoutState: LayoutTreeState) { |
| 420 | layoutState.rootNode = undefined; |