Command for zooming to a user-selected rectangular area.

This command initiates an interactive zoom-to-box operation where:

  • User selects a rectangular area by dragging
  • The view zooms to fit the selected area
  • The zoom level is adjusted to show the entire selected region

This provides precise navigation control, allowing users to quickly focus on specific areas of large drawings.

const zoomToBoxCmd = new AcApZoomToBoxCmd();
await zoomToBoxCmd.execute(context); // User selects area to zoom to

Hierarchy (View Summary)

Constructors

Properties

Accessors

Methods

Constructors

Properties

events: {
    commandEnded: AcCmEventManager<AcEdCommandEventArgs>;
    commandWillStart: AcCmEventManager<AcEdCommandEventArgs>;
} = ...

Events fired during command execution lifecycle

Type declaration

Accessors

  • get globalName(): string

    Gets the global (untranslated) name of the command.

    The global name is typically used for programmatic access and should remain consistent across different language localizations.

    Returns string

    The global command name

  • set globalName(value: string): void

    Sets the global (untranslated) name of the command.

    Parameters

    • value: string

      The global command name (e.g., 'LINE', 'CIRCLE', 'ZOOM')

    Returns void

  • get localName(): string

    Gets the local (translated) name of the command.

    The local name is displayed to users and should be localized to the current language/region.

    Returns string

    The localized command name

  • set localName(value: string): void

    Sets the local (translated) name of the command.

    Parameters

    • value: string

      The localized command name (e.g., 'Draw Line', 'Zoom In')

    Returns void

Methods

  • Executes the zoom-to-box command.

    Creates a jig for interactive area selection and initiates the drag operation for the user to select the zoom area.

    Parameters

    • context: AcApContext

      The application context containing the view

    Returns Promise<void>

    Promise that resolves when the zoom operation completes

  • Triggers the command execution with proper event handling.

    This method should not be overridden by subclasses as it handles the event notification workflow. Subclasses should implement the execute() method instead.

    The execution flow:

    1. Fires commandWillStart event
    2. Calls the execute() method
    3. Fires commandEnded event

    Parameters

    • context: AcApContext

      The current application context containing view and document

    Returns void

    const command = new MyCommand();
    command.trigger(docManager.context);