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

    Class ScratchGestureHandler

    Handler for SCRATCH gesture type Erases or partially removes symbols by scratching over them

    Hierarchy (View Summary)

    Index
    gestureType: "SCRATCH" = ...

    The type of gesture this handler manages

    logger: Logger
    • get client(): WebSocketClient

      Get the canvas's client

      Returns WebSocketClient

    • get history(): IIHistoryManager

      Get the canvas's history manager

      Returns IIHistoryManager

    • get manager(): IIGestureManager

      Get the canvas's model

      Returns IIGestureManager

    • get model(): IIModel

      Get the canvas's model

      Returns IIModel

    • get renderer(): SVGRenderer

      Get the canvas's renderer

      Returns SVGRenderer

    • get rowHeight(): number

      Get the row height from configuration

      Returns number

    • get strokeSpaceWidth(): number

      Get the stroke space width from configuration

      Returns number

    • get translator(): IITranslateManager

      Get the canvas's translator manager

      Returns IITranslateManager

    • get typeset(): IITypesetManager

      Get the canvas's typeset manager

      Returns IITypesetManager

    • Apply the gesture to the model

      Parameters

      • gestureStroke: TStroke

        The stroke that forms the gesture

      • gesture: TGesture

        The detected gesture information

      Returns Promise<void>

      Promise that resolves when the gesture is applied

    • Compute scratch on strokes by subtracting the gesture stroke

      Parameters

      • gesture: TGesture

        The gesture information with subStrokes

      • stroke: TStroke

        The stroke to scratch

      Returns TStroke[]

      Array of resulting strokes (before/after the scratch)

    • Compute scratch on any symbol type Handles different logic for each symbol type:

      • Stroke: Uses computeScratchOnStrokes
      • RecognizedText: Scratches child strokes, preserves decorators
      • RecognizedMath/Diagram: Scratches child strokes, cleans solver outputs
      • Text: Uses computeScratchOnText
      • Math/Shape/Edge: Complete erasure

      Parameters

      • gestureStroke: TStroke

        The gesture stroke

      • gesture: TGesture

        The gesture information

      • symbol: TSymbol

        The symbol to scratch

      Returns { erased?: boolean; replaced?: TSymbol[] }

      Object with 'erased' flag or 'replaced' array of new symbols

    • Compute scratch on text symbol by removing overlapping characters

      Parameters

      • gestureStroke: TStroke

        The gesture stroke

      • textSymbol: TText

        The text symbol to scratch

      Returns TText | undefined

      Updated text symbol, or undefined if all characters removed