OMD Documentation

omdStepVisualizerInteractiveSteps

This class creates and manages the interactive text boxes that display detailed explanations for simplification steps within the omdStepVisualizer. It formats the messages, handles styling, and sets up hover and click interactions, allowing users to explore the mathematical transformations.

Class Definition

export class omdStepVisualizerInteractiveSteps

Constructor

new omdStepVisualizerInteractiveSteps(stepVisualizer, simplificationData)

Creates a new omdStepVisualizerInteractiveSteps instance.

During construction, it extracts and cleans messages and rule names from the simplificationData, initializes layout properties (like stepWidth, fontSize), sets up the main layoutGroup, and creates the individual step elements.

Public Properties

Public Methods

setOnStepHover(callback)

Sets a callback function to be executed when the user hovers over a step explanation.

setOnStepClick(callback)

Sets a callback function to be executed when the user clicks on a step explanation.

getLayoutGroup()

Returns the main jsvgLayoutGroup containing all the interactive step elements. This group should be added to the parent container (e.g., omdStepVisualizer's visualContainer).

setPosition(x, y)

Sets the position of the entire interactive step group within its parent container.

getDimensions()

Returns the calculated width and height of the interactive step group, including its background.

destroy()

Cleans up the component by removing all its children, clearing references, and unsetting callbacks.

Internal Methods

How it Works

This class takes simplification data and renders it as a series of interactive text boxes. Each box represents a sub-step or a part of the explanation. It dynamically calculates sizes and positions to ensure the text boxes are readable and visually appealing. Hover and click events on these boxes can be used to trigger further actions, such as highlighting specific nodes in the main equation display.

Example

This class is typically used internally by omdStepVisualizerTextBoxes.

// Example of internal usage within omdStepVisualizerTextBoxes:
// const interactiveSteps = new omdStepVisualizerInteractiveSteps(this.stepVisualizer, simplificationData);
// this.stepVisualizer.visualContainer.addChild(interactiveSteps.getLayoutGroup());
↑ Top