iink-ts - v4.0.0
    Preparing search index...

    Class IIMathManager

    Main Math manager that orchestrates all math-related sub-managers.

    Sub-managers:

    • computation: Computation cache, solver I/O, numerical result ops
    • variables: Variable state, dependency tracking, visual interactions (hover/select)
    • evaluation: Function evaluation

    Hierarchy (View Summary)

    Index

    The Interactive Ink Canvas instance

    logger: Logger

    Logger instance for this manager Automatically uses LoggerCategory.MANAGER

    managerName: string = "IIMathManager"

    Name of the manager for logging purposes Must be overridden in concrete classes

    "IITypesetManager", "IIMathManager"
    
    • get client(): WebSocketClient

      Get the client from the canvas Convenience getter to avoid accessing canvas.client everywhere

      Returns WebSocketClient

    • get model(): IIModel

      Get the model from the canvas Convenience getter to avoid accessing canvas.model everywhere

      Returns IIModel

    • get renderer(): SVGRenderer

      Get the renderer from the canvas Convenience getter to avoid accessing canvas.renderer everywhere

      Returns SVGRenderer

    • Parameters

      Returns void

    • Parameters

      • jiixBlockIds: string[]

      Returns void

    • Returns Promise<void>

    • Returns void

    • Parameters

      • jiixBlockId: string

      Returns void

    • Parameters

      • jiixBlockId: string

      Returns Promise<void>

    • Returns void

    • Returns Promise<void>

    • Compute numerical result for a math symbol

      Parameters

      • jiixBlockId: string

        The ID of the math block

      • Optionalmode: TMathResultMode

        Result display mode ("draw" or "ghost"). Defaults to canvas.mathResultMode

      Returns Promise<
          {
              addedStrokesCount: number;
              result: TJIIXMathElement;
              value?: number;
              wasRecomputed: boolean;
          },
      >

      Promise with the computation result, number of added strokes, and numeric value

    • Destroy the manager and cleanup resources Calls the onDestroy hook if defined

      Returns void

    • Parameters

      • jiixBlockId: string
      • OptionalisStale: () => boolean

      Returns Promise<void>

    • Evaluate a math function for a math symbol

      Parameters

      • jiixBlockId: string

        The ID of the math element (jiixId)

      • evaluation: {
            from: number;
            inputVariableName: string;
            outputVariableName: string;
            pointCount: number;
            to: number;
        }

        Evaluation parameters

      Returns Promise<{ [key: string]: number }[][]>

      Promise with evaluation points

    • Parameters

      • OptionaljiixBlockIds: string[]

      Returns Promise<void>

    • Get available math solver actions for a specific math element

      Parameters

      • jiixBlockId: string

        The ID of the math element (jiixId)

      Returns Promise<string[]>

      Promise with array of available actions

    • Get which math operations (edit variables, compute, evaluate, manage solver output strokes) are available for a math block. Result is cached per block until the block's variables, computation state, or diagnostics change.

      Parameters

      • jiixBlockId: string

        The ID of the math block

      Returns Promise<TMathBlockCapabilities>

    • Parameters

      • jiixBlockId: string

      Returns TMathDependencies | null

    • Get diagnostic result for a specific math task

      Parameters

      • jiixBlockId: string

        The ID of the math element (jiixId)

      • task: string

        The task to diagnose (e.g., "numerical-computation", "evaluation")

      Returns Promise<string>

      Promise with diagnostic result (e.g., "ALLOWED", "NOT_ALLOWED")

    • Get evaluables from a math expression

      Parameters

      • jiixBlockId: string

        The ID of the math element (jiixId)

      Returns Promise<TMathEvaluable[]>

      Promise with array of evaluables

    • Parameters

      • jiixBlockId: string

      Returns TBox | undefined

    • Parameters

      • jiixBlockId: string

      Returns string[]

    • Parameters

      • jiixBlockId: string

      Returns string[] | undefined

    • Get variables from a math expression

      Parameters

      • jiixBlockId: string

        The ID of the math element (jiixId)

      Returns Promise<TMathVariable[]>

      Promise with array of variables

    • Get variable value from a math expression

      Parameters

      • jiixBlockId: string

        The ID of the math element (jiixId)

      • variableName: string

        Name of the variable

      Returns Promise<number | null>

      Promise with the value of the variable

    • Parameters

      • jiixBlockId: string

      Returns boolean

    • Parameters

      • jiixBlockId: string

      Returns boolean

    • Parameters

      • jiixBlockId: string

      Returns boolean

    • Lifecycle hook called when the manager is being destroyed Override in subclasses to cleanup resources

      Returns void

      protected onDestroy(): void {
      this.logger.info(`${this.managerName} destroyed`)
      // Remove event listeners, clear intervals, etc.
      }
    • Lifecycle hook called after manager initialization Override in subclasses if needed

      This is called at the end of the constructor, allowing subclasses to perform initialization that requires access to this.managerName or other properties set in the subclass constructor.

      Returns void

      protected onInit(): void {
      this.logger.info(`${this.managerName} initialized`)
      // Setup event listeners, etc.
      }
    • Parameters

      • jiixBlockId: string | null

      Returns void

    • Parameters

      • sourceBlockId: string

      Returns Promise<void>

    • Parameters

      • jiixBlockId: string
      • variableName: string

      Returns Promise<void>

    • Parameters

      • jiixBlockId: string

      Returns void

    • Set multiple variable values for a math symbol

      Parameters

      • jiixBlockId: string

        The ID of the math block

      • variableValues: Record<string, number>

        Object with variable names as keys and their values

      Returns Promise<void>

      Promise that resolves when all variables are set

    • Set value for a specific variable in a math expression

      Parameters

      • jiixBlockId: string

        The ID of the math element (jiixId)

      • variableName: string

        Name of the variable to set

      • variableValue: number

        Value to assign to the variable

      Returns Promise<void>

      Promise that resolves when the variable is set

    • Returns Promise<void>