@obliczeniowo/elementary
Version:
Library made in Angular version 19
88 lines (87 loc) • 3.88 kB
TypeScript
import { Point2D, ColorType } from '@obliczeniowo/elementary/classes';
import { Size } from '@obliczeniowo/elementary/resize-window';
import { DrawingContextInterface, LinePattern, LinePatternDef, TextAlign, TextBaseline } from './drawing-context-interface';
import { Renderer2 } from '@angular/core';
interface SvgOnly {
classes?: string[];
events?: {
[name: string]: (event: any) => void;
};
attributes?: {
[name: string]: any;
};
}
interface SvgOptions {
svgOnly?: SvgOnly;
[key: string]: any;
}
interface SvgPolylineOptions extends SvgOptions {
close?: boolean;
}
export declare class DrawingSvgInterface extends DrawingContextInterface {
getTextDimension(text: string): Size;
static archPath(center: Point2D, rx: number, ry: number, start: number, end: number, reverse?: boolean): string | undefined;
private readonly svg;
private readonly root?;
private xMinimum;
private xMaximum;
private yMinimum;
private yMaximum;
private textAnchor;
private linePatternName;
private defs;
private readonly linesDefs;
private readonly groups;
private readonly renderer;
fontSize: number;
constructor(svg: SVGSVGElement, renderer: Renderer2);
private setXMin;
private setYMin;
private setXMax;
private setYMax;
private setMinMax;
protected setSvgOptions(element: SVGElement, options?: any): void;
protected createSvgPoint(point2d: Point2D): DOMPoint;
protected setSvgElementLinePattern(element: SVGElement): void;
lineTo(point: Point2D, stroke: number, color: ColorType): this;
setFontSize(fontSize: number): this;
getFontSize(): number;
setTextAlign(align: TextAlign): this;
setTextBaseline(textBaseline: TextBaseline): this;
getTextWidth(text: string): number;
clear(): this;
setLinePattern(linePattern: string | LinePattern | undefined, linePatternDef?: LinePatternDef): this;
drawLine(startPoint: Point2D, endPoint: Point2D, stroke?: number, color?: ColorType, options?: SvgOptions): this;
drawCircle(point: Point2D, ray: number, stroke?: number, strokeColor?: ColorType, fillColor?: ColorType, options?: SvgOptions): this;
drawPie(center: Point2D, rx: number, ry: number, start: number, end: number, stroke: number, strokeColor?: ColorType, fillColor?: ColorType, options?: SvgOptions): this;
drawArch(center: Point2D, rx: number, ry: number, start: number, end: number, stroke: number, strokeColor?: ColorType, options?: SvgOptions): this;
drawEllipse(point: Point2D, xRay: number, yRay: number, stroke: number, strokeColor: ColorType, fillColor: ColorType, options?: SvgOptions): this;
drawRect(x: number, y: number, width: number, height: number, stroke: number, strokeColor: ColorType, fillColor: ColorType, options?: SvgOptions): this;
get svgContainer(): SVGGElement;
drawText(text: string, handlePosition: Point2D, color?: ColorType, angle?: number, options?: SvgOptions): this;
drawPolyline(points: Point2D[], stroke?: number, color?: ColorType, options?: SvgPolylineOptions): this;
drawPolygon(points: Point2D[], stroke: number, color: ColorType | 'none', fill: ColorType | 'none', options?: any): this;
get width(): number;
get height(): number;
getSvg(): string;
group(options?: {
name?: string;
data?: {
[key: string]: string;
};
clipRect?: {
pos: Point2D;
width: number;
height: number;
};
svgOnly?: SvgOnly;
onMouseOver?: (g: SVGElement) => void;
onMouseOut?: () => void;
}): this;
endGroup(): this;
getLineStrokeSize(size?: number): number;
save(fileName: string): void;
protected setClasses(element: SVGElement, options?: SvgOptions): boolean;
protected color(color: ColorType): string;
}
export {};