Manages cursor appearance and behavior for the CAD editor.

This class creates and applies custom cursors to HTML elements, providing visual feedback for different CAD operations. It supports both built-in browser cursors and custom SVG-based cursors.

The cursor manager maintains a cache of cursor definitions to avoid recreating them repeatedly, improving performance.

Constructors

Accessors

Methods

  • Encodes an SVG string into a CSS cursor URL.

    This method converts SVG markup into a data URI that can be used as a CSS cursor value, with specified hotspot coordinates.

    Parameters

    • svgString: string

      The SVG markup as a string

    • xOffset: number

      X coordinate of the cursor hotspot

    • yOffset: number

      Y coordinate of the cursor hotspot

    Returns string

    CSS cursor string in url() format

    const svgCursor = '<svg width="20" height="20">...</svg>';
    const cursorUrl = cursorManager.encodeSvgToCursor(svgCursor, 10, 10);
    element.style.cursor = cursorUrl;