@samatawy/diagrams
    Preparing search index...

    Class ArrowDirectionSelect

    A dropdown component for selecting arrow direction presets. It displays predefined directions and reflects the selected direction in the trigger button. The selected direction is exposed through the value property. The component emits an arrowchange event when the direction changes.

    Index

    Constructors

    Properties

    host: HTMLElement
    config: Required<Omit<ArrowDirectionSelectConfig, "arrows">> & {
        arrows: ArrowDirection[];
    }
    selected: ArrowDirection
    trigger: HTMLButtonElement
    triggerSwatch: HTMLDivElement
    triggerLabel?: HTMLSpanElement
    menu: HTMLDivElement

    Accessors

    Methods

    • Handles the click event on the document. Closes the dropdown menu if the click is outside the host element.

      Parameters

      • event: Event

        The click event.

      Returns void

    • Handles the click event on an option. Selects the clicked width and closes the dropdown menu.

      Parameters

      • event: Event

        The click event.

      Returns void

    • Creates an SVG polygon representing a single arrowhead at the given position.

      Parameters

      • x: number

        Horizontal position of the arrowhead tip.

      • y: number

        Vertical position of the arrowhead tip.

      • direction: "forward" | "backward"

        'forward' points right; 'backward' points left.

      Returns SVGPolygonElement

      The SVG polygon element.

    • Updates the internal selection state, syncs the trigger and option list, and optionally emits 'arrowchange'.

      Parameters

      • arrow: ArrowDirection

        The new arrow direction to select.

      • emit: boolean = true

        Whether to dispatch the change event. Defaults to true.

      Returns void