OMD Documentation

omdGroupNode

Represents a single grouping symbol, such as ( or ), as a leaf node in the expression tree. This node is primarily used for visual representation and layout, rather than mathematical operations.

Class Definition

export class omdGroupNode extends omdLeafNode

Constructor

new omdGroupNode(nodeData)

Creates a new omdGroupNode instance.

Public Properties

Public Methods

clone()

Creates a deep clone of the group node. The new node's provenance array is updated to include the original node's ID.

computeDimensions()

Calculates the dimensions of the node based on its text content. Unlike other leaf nodes, omdGroupNode does not add extra padding around the symbol, allowing for tighter visual integration.

updateLayout()

Updates the position of the node's internal text element. This method primarily calls the superclass's updateLayout.

toMathJSNode()

Converts the omdGroupNode to a math.js-compatible AST format. It represents the grouping symbol as a SymbolNode.

Internal Methods

Example

// Create grouping symbols
const leftParen = new omdGroupNode('(');
const rightParen = new omdGroupNode(')');
const leftBracket = new omdGroupNode('[');

// Render a symbol
const node = new omdGroupNode('(');
node.setFontSize(24);
node.initialize(); // Computes dimensions and layout

// Add to an SVG container to display
// const svgContainer = new jsvgContainer();
// svgContainer.addChild(node);
// document.body.appendChild(svgContainer.svgObject);

See Also

↑ Top