g2o-svg
Version:
g2o Scalable Vector Graphics
40 lines (35 loc) • 1.69 kB
TypeScript
import { Board, ViewDOM, SVGAttributes, ViewFactory, Group, View } from 'g2o';
interface BoardOptions {
boundingBox?: {
left: number;
top: number;
right: number;
bottom: number;
};
}
/**
* A convenience function for initializing a new GraphicsBoard using SVG.
* @param elementOrId HTML identifier (id) of element in which the board is rendered.
* @param options An object that sets some of the board properties.
*/
declare function initBoard(elementOrId: string | HTMLElement, options?: BoardOptions): Board;
declare class SVGViewDOM implements ViewDOM<SVGElement> {
downcast(element: unknown): SVGElement;
createSVGElement(qualifiedName: string, attributes?: SVGAttributes): SVGElement;
setAttribute(element: SVGElement, qualifiedName: string, value: string): void;
setAttributes(element: SVGElement, attributes: SVGAttributes): void;
removeAttribute(element: SVGElement, qualifiedName: string): void;
removeAttributes(element: SVGElement, attributes: SVGAttributes): void;
appendChild(parent: SVGElement, child: SVGElement): void;
removeChild(parent: SVGElement, child: SVGElement): void;
setTextContent(element: SVGElement, textContent: string): void;
getParentNode(element: SVGElement): SVGElement | null;
getLastChild(element: SVGElement): SVGElement;
getElementDefs(svg: SVGElement): SVGElement;
setStyle(element: SVGElement, name: 'display' | 'overflow', value: string): void;
}
declare class SVGViewFactory implements ViewFactory<SVGElement> {
constructor();
createView(viewBox: Group, containerId: string): View<SVGElement>;
}
export { SVGViewDOM, SVGViewFactory, initBoard };