diagram-js
Version:
A toolbox for displaying and modifying diagrams on the web
83 lines (75 loc) • 2.44 kB
TypeScript
/**
*
* A plugin that adds an outline to shapes and connections that may be activated and styled
* via CSS classes.
*
* The outline is created lazily, i.e. only once an element is hovered or selected
* for the first time. This keeps importing large diagrams fast, as we avoid
* creating (and laying out) an outline for every single element up front.
*
*/
export default class Outline {
static $inject: string[];
/**
* @param eventBus
* @param styles
* @param elementRegistry
*/
constructor(eventBus: EventBus, styles: Styles, elementRegistry: ElementRegistry);
/**
* Ensure the outline for the given element is present, creating, appending
* and updating it on first access.
*
* Outlines are created lazily, i.e. only once an element is hovered or
* selected. Use this to force outline creation, e.g. for features or tests
* that rely on the outline being present.
*
* @param element
*
* @return the element's outline
*/
createOutline(element: Element): SVGElement;
/**
* Updates the outline of the given element, dispatching to the shape or
* connection specific update depending on the element type.
*
* @param element
* @param outline
*/
updateOutline(element: Element, outline: SVGElement): void;
/**
* Updates the outline of a shape respecting the dimension of the
* element and an outline offset.
*
* @param outline
* @param element
*/
updateShapeOutline(outline: SVGElement, element: Element): void;
/**
* Updates the outline of a connection respecting the bounding box of
* the connection and an outline offset.
* Register an outline provider with the given priority.
*
* @param outline
* @param connection
*/
updateConnectionOutline(outline: SVGElement, connection: Element): void;
/**
* Register an outline provider with the given priority.
*
* @param priority
* @param provider
*/
registerProvider(priority: number, provider: OutlineProvider): void;
/**
* Returns the outline for an element.
*
* @param element
*/
getOutline(element: Element): undefined;
}
type Element = import("../../model/Types.js").Element;
type OutlineProvider = import("./OutlineProvider.js").default;
type EventBus = import("../../core/EventBus.js").default;
type ElementRegistry = import("../../core/ElementRegistry.js").default;
type Styles = import("../../draw/Styles.js").default;