Skip to main content

getEnabledElement

Callable


  • A convenience method to find an EnabledElement given a reference to its associated element. Commonly used in code that’s handling a custom event emitted by this library.

    @example

    Using the renderingEngine to find the enabled element:

    const element = getRenderingEngine(renderingEngineId)
    .getViewport(viewportId)
    .element

    const enabledElement = getEnabledElement(element)
    @example

    Using a cornerstone event’s “element”

    // Our "cornerstone events" contain the source element, which is
    // raised on the viewport's div element
    const { element } = evt.detail
    const enabledElement = getEnabledElement(element)

    Parameters

    • element: HTMLDivElement

      a reference to an EnabledElement/Viewport’s div element

    Returns IEnabledElement | undefined

    the associated EnabledElement, or undefined if no matching EnabledElement can be found