@itwin/core-markup
Version:
iTwin.js markup package
86 lines • 2.93 kB
TypeScript
/** @packageDocumentation
* @module MarkupApp
*/
import { Transform } from "@itwin/core-geometry";
import { Box, Element as MarkupElement, Matrix } from "@svgdotjs/svg.js";
/** @public */
export interface MarkupColor {
fill: any;
stroke: any;
}
/** Add methods and classes to svg.js library for Markup.
* @public
*/
declare module "@svgdotjs/svg.js" {
function register(subclass: typeof MarkupElement, name?: string): void;
function nodeOrNew(name: string, node: any): any;
interface Dom {
css(val: object): this;
}
/** @public */
interface Element {
inSelection?: boolean;
originalEl?: Element;
/** make a copy of this Element, set its `isMarkup` flag, and reset its color if it was hilited. */
cloneMarkup(): this;
/** if this element is currently hilited or flashed, reset to its original color */
resetColor(): void;
/** override the color of this element to a new color, saving original */
overrideColor(color: string): void;
/** turn on `inSelection` and set its color to hilite */
hilite(): void;
/** turn off hilite, turn off `inSelection` flag */
unHilite(): void;
/** set this element to the flash color */
flash(): void;
/** turn off flash color */
unFlash(): void;
/** reposition and resize this element */
markupStretch(x: number, y: number, w: number, h: number, mtx: Matrix): void;
/** return true if this element is a child of the supplied Svg. */
isChildOf(svg: Svg): boolean;
/** return selectable element or the outermost group containing this element if it's a child of the supplied Svg. */
getChildOrGroupOf(svg: G): MarkupElement | undefined;
/** @internal */
forElementsOfGroup(fn: (child: MarkupElement) => void): void;
/** @internal */
getNpcToVp(): Matrix;
/** @internal */
getOutline(expand?: number): Rect;
}
/** @public */
interface Text {
getMarkup(): string;
createMarkup(val: string, spacing: number): void;
getFontSize(): number;
}
/** @public */
interface Matrix {
/** convert this SVG.Matrix into an iModel Transform */
toIModelTransform(): Transform;
fromIModelTransform(t: Transform): this;
}
/** @internal */
interface Container {
foreignObject(width: number, height: number): ForeignObject;
}
class ForeignObject extends Container {
}
}
/** Dummy class so a <title> inside a <g> will work.
* @internal
*/
export declare class Title extends MarkupElement {
constructor(node: any);
scale(): this;
size(): this;
move(): this;
dmove(): this;
bbox(): Box;
screenCTM(): Matrix;
}
/** only for tests
* @internal
*/
export declare function initSvgExt(): void;
//# sourceMappingURL=SvgJsExt.d.ts.map