@meta2d/core
Version:
@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .
151 lines (150 loc) • 4.09 kB
TypeScript
import { TextAlign, TextBaseline, Pen } from './pen';
import { Point } from './point';
import { Padding } from './utils';
export declare enum KeydownType {
None = -1,
Document = 0,
Canvas = 1
}
export interface Options {
color?: string;
activeColor?: string;
activeBackground?: string;
hoverColor?: string;
hoverBackground?: string;
anchorColor?: string;
hoverAnchorColor?: string;
anchorRadius?: number;
anchorBackground?: string;
dockColor?: string;
dockPenColor?: string;
dragColor?: string;
animateColor?: string;
textColor?: string;
fontFamily?: string;
fontSize?: number;
lineHeight?: number;
textAlign?: TextAlign;
textBaseline?: TextBaseline;
rotateCursor?: string;
rightCursor?: string;
downCursor?: string;
hoverCursor?: string;
disableInput?: boolean;
disableRotate?: boolean;
disableSize?: boolean;
disableAnchor?: boolean;
autoAnchor?: boolean;
autoAlignGrid?: boolean;
disableEmptyLine?: boolean;
disableRepeatLine?: boolean;
disableScale?: boolean;
disableTranslate?: boolean;
disableDock?: boolean;
disableLineDock?: boolean;
moveConnectedLine?: boolean;
minScale?: number;
maxScale?: number;
keydown?: KeydownType;
background?: string;
shadowOffsetX?: number;
shadowOffsetY?: number;
shadowBlur?: number;
shadowColor?: string;
globalAlpha?: number;
grid?: boolean;
gridColor?: string;
gridSize?: number;
rule?: boolean;
ruleColor?: string;
ruleOptions?: {
height?: number;
background?: string;
underline?: boolean;
textColor?: string;
textLeft?: number;
textTop?: number;
baseline?: string;
};
drawingLineName?: string;
fromArrow?: string;
toArrow?: string;
dirMarkers?: boolean;
dirMarkerInterval?: number;
dirMarkerColor?: string;
dirMarkerLineWidth?: number;
drawDirMarkers?: (ctx: CanvasRenderingContext2D, x: number, y: number, angleRad: number, color: string, pen: Pen) => void;
autoPolyline?: boolean;
interval?: number;
minFPSNumber?: number;
autoFPS?: boolean;
animateInterval?: number;
dragAllIn?: boolean;
scroll?: boolean;
uploadFn?: (file: File) => Promise<string>;
uploadUrl?: string;
uploadParams?: Record<string, any>;
uploadHeaders?: Record<string, string>;
disableRuleLine?: boolean;
ruleLineColor?: string;
defaultAnchors?: Point[];
measureTextWidth?: boolean;
mouseRightActive?: boolean;
disableClipboard?: boolean;
drawingLineLength?: number;
disableTouchPadScale?: boolean;
parentTouch?: boolean;
cdn?: string;
x?: number;
y?: number;
width?: number;
height?: number;
polylineSpace?: number;
defaultFormat?: Pen;
domShapes?: string[];
containerShapes?: string[];
textFlip?: boolean;
textRotate?: boolean;
cacheLength?: number;
unavailableKeys?: string[];
activeLineDash?: number[];
activeLineWidth?: number;
activeGlobalAlpha?: number;
diagramOptions?: {
[key: string]: any;
};
strictScope?: boolean;
padding?: Padding;
resizeMode?: boolean;
svgPathStroke?: boolean;
disabledColor?: string;
disabledBackground?: string;
scaleOff?: number;
scrollButScale?: boolean;
reconnetTimes?: number;
navigatorNetWork?: {
url?: string;
headers?: any;
method?: string;
};
downloadBgTransparent?: boolean;
themeOnlyCanvas?: boolean;
linePresetStyle?: Pen;
textPresetStyle?: Pen;
unFill?: boolean;
roles?: string[];
crossOrigin?: string;
}
export declare const defaultOptions: Options;
export interface PenPlugin {
install: (pen: Pen | string, options: any) => void;
uninstall: (pen: Pen | string, options: any) => void;
name: string;
[key: string]: any;
}
export interface PluginOptions {
plugin: PenPlugin;
options?: object;
enable?: boolean;
[key: string]: any;
}