UNPKG

@visactor/vrender-core

Version:

```typescript import { xxx } from '@visactor/vrender-core'; ```

99 lines (98 loc) 4.43 kB
import type { IAABBBounds, IBounds, IMatrixLike } from '@visactor/vutils'; import type { IColor } from './color'; import type { IContext2d } from './context'; import type { IGraphic, IGraphicAttribute } from './graphic'; import type { IMarkAttribute, IThemeAttribute } from './graphic/creator'; import type { IFullThemeSpec } from './graphic/theme'; import type { ILayer } from './layer'; import type { IStage } from './stage'; import type { IGroup } from './graphic/group'; import type { MaybePromise } from './common'; import type { ISyncHook } from './sync-hook'; export interface IRenderServiceDrawParams { context?: IContext2d; clear?: IGraphicAttribute['background'] | IColor | boolean; viewBox: IBounds; transMatrix?: IMatrixLike; stage: IStage; layer: ILayer; renderService: IRenderService; updateBounds: boolean; renderStyle?: string; } export interface IRenderService { dirtyBounds: IBounds; renderTreeRoots: IGraphic[]; renderLists: IGraphic[]; drawParams: IRenderServiceDrawParams; drawContribution: IDrawContribution; prepare: (updateBounds: boolean) => void; prepareRenderList: () => void; beforeDraw: (params: IRenderServiceDrawParams) => void; draw: (params: IRenderServiceDrawParams) => void; afterDraw: (params: IRenderServiceDrawParams) => void; render: (groups: IGroup[], params: IRenderServiceDrawParams) => MaybePromise<void>; reInit: () => void; } export interface IDrawContext extends IRenderServiceDrawParams { startAtId?: number; break?: boolean; restartIncremental?: boolean; multiGraphicOptions?: { startAtIdx: number; length: number; }; in3dInterceptor?: boolean; drawContribution?: IDrawContribution; hack_pieFace?: 'inside' | 'bottom' | 'top' | 'outside'; isGroupScroll?: boolean; } export interface IDrawContribution { hooks?: { completeDraw: ISyncHook<[]>; }; dirtyBounds?: IAABBBounds; backupDirtyBounds?: IAABBBounds; rendering?: boolean; currentRenderMap: Map<number, IGraphicRender>; defaultRenderMap: Map<number, IGraphicRender>; styleRenderMap: Map<string, Map<number, IGraphicRender>>; draw: (renderService: IRenderService, drawParams: IDrawContext) => MaybePromise<void>; afterDraw?: (renderService: IRenderService, drawParams: IDrawContext) => MaybePromise<void>; getRenderContribution: (graphic: IGraphic) => IGraphicRender | null; renderGroup: (group: IGroup, drawContext: IDrawContext, matrix: IMatrixLike, skipSort?: boolean) => void; renderItem: (graphic: IGraphic, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) => void; reInit: () => void; } export interface IGraphicRenderDrawParams { beforeDrawCb?: () => void; afterDrawCb?: () => void; drawingCb?: () => void; skipDraw?: boolean; theme?: IFullThemeSpec; renderInGroupParams?: { skipSort?: boolean; nextM?: IMatrixLike; }; renderInGroup?: (skipSort: boolean, group: IGroup, drawContext: IDrawContext, nextM: IMatrixLike) => void; } export interface IGraphicRender { type: string; numberType: number; style?: string; z?: number; draw: (graphic: IGraphic, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) => void; drawShape?: (graphic: IGraphic, ctx: IContext2d, x: number, y: number, drawContext: IDrawContext, params?: IGraphicRenderDrawParams, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean) => void; reInit: () => void; } export interface IBeforeRenderConstribution { apply: (renderService: IRenderService) => MaybePromise<void>; } export interface IRenderSelector { selector: (graphic: IGraphic) => IGraphicRender | null; } export interface IDrawItemInterceptorContribution { order: number; beforeDrawItem?: (graphic: IGraphic, renderService: IRenderService, drawContext: IDrawContext, drawContribution: IDrawContribution, params?: IGraphicRenderDrawParams) => boolean; afterDrawItem?: (graphic: IGraphic, renderService: IRenderService, drawContext: IDrawContext, drawContribution: IDrawContribution, params?: IGraphicRenderDrawParams) => boolean; }