@leafer/display
Version:
210 lines (206 loc) • 11.7 kB
TypeScript
import { ILeaf, InnerId, ILeaferBase, ILeafData, ILeafLayout, IMatrixWithBoundsScaleData, IMatrixWithBoundsData, IMatrixData, IBoundsData, IMatrixWithScaleData, IHitCanvas, IEventParamsMap, IEventListenerMap, ILeafInputData, IFunction, IObject, IValue, IJSONOptions, IFindMethod, ILeaferCanvas, IRenderOptions, ILocationType, IBoundsType, ILayoutBoundsData, IPointData, ITransition, IAlign, IAxis, IRadiusPointData, IMotionPathData, IUnitData, IRotationPointData, IEventParams, IEventListener, IEventOption, IEventListenerId, IEvent, IValueFunction, IAttrDecorator } from '@leafer/interface';
import { LeafData } from '@leafer/data';
import { LeafLayout } from '@leafer/layout';
declare class Leaf implements ILeaf {
get tag(): string;
set tag(_value: string);
get __tag(): string;
readonly innerId: InnerId;
get innerName(): string;
get __DataProcessor(): typeof LeafData;
get __LayoutProcessor(): typeof LeafLayout;
leafer?: ILeaferBase;
parent?: ILeaf;
get leaferIsCreated(): boolean;
get leaferIsReady(): boolean;
get isLeafer(): boolean;
get isBranch(): boolean;
get isBranchLeaf(): boolean;
syncEventer?: ILeaf;
lockNormalStyle?: boolean;
__: ILeafData;
__layout: ILeafLayout;
__world: IMatrixWithBoundsScaleData;
__local?: IMatrixWithBoundsData;
__nowWorld?: IMatrixWithBoundsScaleData;
__cameraWorld?: IMatrixWithBoundsScaleData;
get __localMatrix(): IMatrixData;
get __localBoxBounds(): IBoundsData;
__worldOpacity: number;
get worldTransform(): IMatrixWithScaleData;
get localTransform(): IMatrixData;
get boxBounds(): IBoundsData;
get renderBounds(): IBoundsData;
get worldBoxBounds(): IBoundsData;
get worldStrokeBounds(): IBoundsData;
get worldRenderBounds(): IBoundsData;
get worldOpacity(): number;
__level: number;
__tempNumber: number;
get __worldFlipped(): boolean;
__hasAutoLayout?: boolean;
__hasMask?: boolean;
__hasEraser?: boolean;
__hitCanvas?: IHitCanvas;
get __onlyHitMask(): boolean;
get __ignoreHitWorld(): boolean;
get __inLazyBounds(): boolean;
get pathInputed(): boolean;
set event(map: IEventParamsMap);
__captureMap?: IEventListenerMap;
__bubbleMap?: IEventListenerMap;
__hasLocalEvent?: boolean;
__hasWorldEvent?: boolean;
children?: ILeaf[];
destroyed: boolean;
constructor(data?: ILeafInputData);
reset(data?: ILeafInputData): void;
resetCustom(): void;
waitParent(item: IFunction, bind?: IObject): void;
waitLeafer(item: IFunction, bind?: IObject): void;
nextRender(item: IFunction, bind?: IObject, off?: 'off'): void;
removeNextRender(item: IFunction): void;
__bindLeafer(leafer: ILeaferBase | null): void;
set(_data: IObject, _isTemp?: boolean): void;
get(_name?: string): ILeafInputData | IValue;
setAttr(name: string, value: any): void;
getAttr(name: string): any;
getComputedAttr(name: string): any;
toJSON(options?: IJSONOptions): IObject;
toString(options?: IJSONOptions): string;
toSVG(): string;
__SVG(_data: IObject): void;
toHTML(): string;
__setAttr(_attrName: string, _newValue: IValue): boolean;
__getAttr(_attrName: string): IValue;
setProxyAttr(_attrName: string, _newValue: IValue): void;
getProxyAttr(_attrName: string): IValue;
find(_condition: number | string | IFindMethod, _options?: any): ILeaf[];
findTag(_tag: string | string[]): ILeaf[];
findOne(_condition: number | string | IFindMethod, _options?: any): ILeaf | undefined;
findId(_id: number | string): ILeaf | undefined;
focus(_value?: boolean): void;
updateState(): void;
updateLayout(): void;
forceUpdate(attrName?: string): void;
forceRender(_bounds?: IBoundsData, _sync?: boolean): void;
__extraUpdate(): void;
__updateWorldMatrix(): void;
__updateLocalMatrix(): void;
__updateWorldBounds(): void;
__updateLocalBounds(): void;
__updateLocalBoxBounds(): void;
__updateLocalStrokeBounds(): void;
__updateLocalRenderBounds(): void;
__updateBoxBounds(): void;
__updateContentBounds(): void;
__updateStrokeBounds(): void;
__updateRenderBounds(): void;
__updateAutoLayout(): void;
__updateFlowLayout(): void;
__updateNaturalSize(): void;
__updateStrokeSpread(): number;
__updateRenderSpread(): number;
__onUpdateSize(): void;
__updateEraser(value?: boolean): void;
__renderEraser(canvas: ILeaferCanvas, options: IRenderOptions): void;
__updateMask(_value?: boolean): void;
__renderMask(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
__getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData;
getTransform(relative?: ILocationType | ILeaf): IMatrixData;
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
getLayoutPoints(type?: IBoundsType, relative?: ILocationType | ILeaf): IPointData[];
getWorldBounds(inner: IBoundsData, relative?: ILeaf, change?: boolean): IBoundsData;
worldToLocal(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
localToWorld(local: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
worldToInner(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
innerToWorld(inner: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
getBoxPoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
getBoxPointByInner(inner: IPointData, _relative?: ILeaf, _distance?: boolean, change?: boolean): IPointData;
getInnerPoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
getInnerPointByBox(box: IPointData, _relative?: ILeaf, _distance?: boolean, change?: boolean): IPointData;
getInnerPointByLocal(local: IPointData, _relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
getLocalPoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
getLocalPointByInner(inner: IPointData, _relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
getPagePoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
getWorldPoint(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
getWorldPointByBox(box: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
getWorldPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
getWorldPointByPage(page: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
setTransform(matrix: IMatrixData, resize?: boolean, transition?: ITransition): void;
transform(matrix: IMatrixData, resize?: boolean, transition?: ITransition): void;
move(x: number | IPointData, y?: number, transition?: ITransition): void;
moveInner(x: number | IPointData, y?: number, transition?: ITransition): void;
scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition): void;
rotateOf(origin: IPointData | IAlign, rotation: number, transition?: ITransition): void;
skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean, transition?: ITransition): void;
transformWorld(worldTransform?: IMatrixData, resize?: boolean, transition?: ITransition): void;
moveWorld(x: number | IPointData, y?: number, transition?: ITransition): void;
scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition): void;
rotateOfWorld(worldOrigin: IPointData, rotation: number): void;
skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean, transition?: ITransition): void;
flip(axis: IAxis, transition?: ITransition): void;
scaleResize(scaleX: number, scaleY?: number, _noResize?: boolean): void;
__scaleResize(_scaleX: number, _scaleY: number): void;
resizeWidth(_width: number): void;
resizeHeight(_height: number): void;
__hitWorld(_point: IRadiusPointData): boolean;
__hit(_local: IRadiusPointData): boolean;
__hitFill(_inner: IRadiusPointData): boolean;
__hitStroke(_inner: IRadiusPointData, _strokeWidth: number): boolean;
__hitPixel(_inner: IRadiusPointData): boolean;
__drawHitPath(_canvas: ILeaferCanvas): void;
__updateHitCanvas(): void;
__render(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
__drawFast(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
__draw(_canvas: ILeaferCanvas, _options: IRenderOptions, _originCanvas?: ILeaferCanvas): void;
__clip(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
__renderShape(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
__drawShape(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
__updateWorldOpacity(): void;
__updateChange(): void;
__drawPath(_canvas: ILeaferCanvas): void;
__drawRenderPath(_canvas: ILeaferCanvas): void;
__updatePath(): void;
__updateRenderPath(): void;
getMotionPathData(): IMotionPathData;
getMotionPoint(_motionDistance: number | IUnitData): IRotationPointData;
getMotionTotal(): number;
__updateMotionPath(): void;
__runAnimation(_type: 'in' | 'out', _complete?: IFunction): void;
__updateSortChildren(): void;
add(_child: ILeaf | ILeaf[] | ILeafInputData | ILeafInputData[], _index?: number): void;
remove(_child?: ILeaf | number | string | IFindMethod, destroy?: boolean): void;
dropTo(parent: ILeaf, index?: number, resize?: boolean): void;
on(_type: string | string[] | IEventParams[] | IEventParamsMap, _listener?: IEventListener, _options?: IEventOption): void;
off(_type?: string | string[], _listener?: IEventListener, _options?: IEventOption): void;
on_(_type: string | string[] | IEventParams[], _listener?: IEventListener, _bind?: IObject, _options?: IEventOption): IEventListenerId;
off_(_id: IEventListenerId | IEventListenerId[]): void;
once(_type: string | string[] | IEventParams[], _listener?: IEventListener, _captureOrBind?: boolean | IObject, _capture?: boolean): void;
emit(_type: string, _event?: IEvent | IObject, _capture?: boolean): void;
emitEvent(_event?: IEvent, _capture?: boolean): void;
hasEvent(_type: string, _capture?: boolean): boolean;
static changeAttr(attrName: string, defaultValue: IValue | IValueFunction, fn?: IAttrDecorator): void;
static addAttr(attrName: string, defaultValue: IValue | IValueFunction, fn?: IAttrDecorator, helpValue?: IValue): void;
__emitLifeEvent(type: string): void;
destroy(): void;
}
declare class Branch extends Leaf {
__updateStrokeSpread(): number;
__updateRenderSpread(): number;
__updateBoxBounds(): void;
__updateStrokeBounds(): void;
__updateRenderBounds(): void;
__updateSortChildren(): void;
add(child: ILeaf, index?: number): void;
addMany(...children: ILeaf[]): void;
remove(child?: ILeaf, destroy?: boolean): void;
removeAll(destroy?: boolean): void;
clear(): void;
protected __remove(child?: ILeaf, destroy?: boolean): void;
protected __preRemove(): void;
protected __realRemoveChild(child: ILeaf): void;
protected __emitChildEvent(type: string, child: ILeaf): void;
}
export { Branch, Leaf };