Advanced input handler for CAD operations providing high-level user interaction methods.

This class serves as a wrapper for all types of user input including:

  • Point input (mouse clicks, coordinates)
  • Entity selection (single or multiple entities)
  • String, number, angle, and distance input
  • Cursor management and visual feedback

The editor abstracts away low-level mouse and keyboard events, providing a clean API for command implementations. Instead of listening to raw DOM events, commands should use the methods provided by this class.

// Get user input for a point
const point = await editor.getPoint();
console.log('User clicked at:', point);

// Get entity selection
const selection = await editor.getSelection();
console.log('Selected entities:', selection.ids);

// Change cursor appearance
editor.setCursor(AcEdCorsorType.Crosshair);

Constructors

Properties

The view this editor is associated with

Accessors

Methods

  • Prompts the user to input a point by clicking on the view.

    This method returns a promise that resolves when the user clicks on the view, providing the world coordinates of the click point.

    Returns Promise<AcGePoint2d>

    Promise that resolves to the input point coordinates

    const startPoint = await editor.getPoint();
    const endPoint = await editor.getPoint();
    // Now you can create a line from startPoint to endPoint
  • Prompts the user to select entities using box selection.

    This method allows the user to drag a selection box to select multiple entities at once. The selection behavior follows CAD conventions (left-to-right for crossing, right-to-left for window).

    Returns Promise<AcGeBox2d>

    Promise that resolves to the selection set containing selected entity IDs

    const selection = await editor.getSelection();
    if (selection.count > 0) {
    console.log(`Selected ${selection.count} entities`);
    // Process the selected entities
    for (const id of selection.ids) {
    // Do something with each selected entity
    }
    }
  • Restores the previously set cursor.

    This is useful for temporarily changing the cursor and then reverting to the previous state.

    Returns void

  • Sets the cursor appearance for the view.

    The previous cursor type is stored for potential restoration.

    Parameters

    Returns void

    editor.setCursor(AcEdCorsorType.Crosshair);  // For precise point input
    editor.setCursor(AcEdCorsorType.Grab); // For pan operations