@visactor/vrender-core 1.0.9-alpha.2 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/core/stage.d.ts +3 -0
- package/cjs/core/stage.js +7 -3
- package/cjs/core/stage.js.map +1 -1
- package/cjs/interface/stage.d.ts +2 -0
- package/cjs/interface/stage.js.map +1 -1
- package/cjs/render/contributions/render/draw-contribution.js +4 -4
- package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
- package/dist/index.es.js +13 -4
- package/es/core/stage.d.ts +3 -0
- package/es/core/stage.js +7 -3
- package/es/core/stage.js.map +1 -1
- package/es/interface/stage.d.ts +2 -0
- package/es/interface/stage.js.map +1 -1
- package/es/render/contributions/render/draw-contribution.js +4 -4
- package/es/render/contributions/render/draw-contribution.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/draw-contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAAwF;AAexF,+CAAgE;AAEhE,iFAA6E;AAC7E,oDAA2D;AAE3D,6CAA8F;AAC9F,kDAA+C;AAC/C,qCAAsE;AACtE,yDAAyD;AACzD,+DAA2D;AAE3D,wEAAoE;AACpE,wEAAoE;AACpE,sDAAmD;AAM5C,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAgBlC,YAIiD,aAA+B,EAK3D,gCAAyF;QAL7D,kBAAa,GAAb,aAAa,CAAkB;QAK3D,qCAAgC,GAAhC,gCAAgC,CAAyD;QAyM9G,mBAAc,GAAG,CAAC,QAAiB,EAAE,KAAa,EAAE,WAAyB,EAAE,KAAc,EAAE,EAAE;;YAC/F,QAAQ;gBACN,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,IAAc,EAAE,EAAE;oBACvC,IAAI,WAAW,CAAC,KAAK,EAAE;wBACrB,OAAO;qBACR;oBACD,IAAI,IAAI,CAAC,WAAW,EAA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C;YACvE,IAAI,KAAK,IAAK,KAAa,CAAC,aAAa,IAAK,KAAa,CAAC,SAAS,EAAE;gBACrE,MAAM,GAAG,GAAI,KAAa,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBAChD,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE;oBAC9C,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;iBAClD;aACF;iBAAM;gBACL,OAAO,CAAC,SAAS,GAAG,IAAA,0BAAW,EAC7B,OAAO,EACP,KAAK,EACL;oBACE,UAAU,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,EAAE;iBAC5D,EACD,CAAC,EACD,CAAC,CACF,CAAC;gBACF,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;aACvC;SACF;IACH,CAAC;IAED,SAAS,CAAC,aAA6B,EAAE,UAAwB;QAC/D,OAAO;IACT,CAAC;CACF,CAAA;AAhdY,uBAAuB;IADnC,IAAA,2BAAU,GAAE;IAqBR,WAAA,IAAA,4BAAW,EAAC,sBAAa,CAAC,CAAA;IAG1B,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,sCAAmB,CAAC,CAAA;;GAxBlB,uBAAuB,CAgdnC;AAhdY,0DAAuB","file":"draw-contribution.js","sourcesContent":["import { injectable, inject, named, multiInject } from '../../../common/inversify-lite';\nimport type {\n IContext2d,\n MaybePromise,\n IGraphic,\n IGroup,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider,\n IDrawItemInterceptorContribution,\n IDrawContribution,\n IGlobal\n} from '../../../interface';\nimport { findNextGraphic, foreach } from '../../../common/sort';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { DefaultAttribute } from '../../../graphic/config';\nimport type { IAABBBounds, IBounds, IMatrix } from '@visactor/vutils';\nimport { Bounds, Logger, getRectIntersect, isArray, isRectIntersect } from '@visactor/vutils';\nimport { container } from '../../../container';\nimport { GraphicRender, IncrementalDrawContribution } from './symbol';\nimport { DrawItemInterceptor } from './draw-interceptor';\nimport { createColor } from '../../../common/canvas-utils';\nimport type { ILayerService } from '../../../interface/core';\nimport { boundsAllocate } from '../../../allocator/bounds-allocate';\nimport { matrixAllocate } from '../../../allocator/matrix-allocate';\nimport { application } from '../../../application';\n\n/**\n * 默认的渲染contribution,基于树状结构针对图元的渲染\n */\n@injectable()\nexport class DefaultDrawContribution implements IDrawContribution {\n declare currentRenderMap: Map<number, IGraphicRender>;\n declare defaultRenderMap: Map<number, IGraphicRender>;\n declare styleRenderMap: Map<string, Map<number, IGraphicRender>>;\n declare dirtyBounds: IBounds;\n declare backupDirtyBounds: IBounds;\n // 是否使用dirtyBounds\n declare useDirtyBounds: boolean;\n declare currentRenderService: IRenderService;\n declare InterceptorContributions: IDrawItemInterceptorContribution[];\n\n declare global: IGlobal;\n declare layerService: ILayerService;\n\n declare scrollMatrix?: IMatrix;\n\n constructor(\n // @inject(ContributionProvider)\n // @named(GraphicRender)\n // protected readonly contributions: ContributionProvider<IGraphicRender>,\n @multiInject(GraphicRender) protected readonly contributions: IGraphicRender[],\n // @inject(RenderSelector) protected readonly renderSelector: IRenderSelector, // 根据图元类型选择对应的renderItem进行渲染\n // 拦截器\n @inject(ContributionProvider)\n @named(DrawItemInterceptor)\n protected readonly drawItemInterceptorContributions: IContributionProvider<IDrawItemInterceptorContribution>\n ) {\n this.currentRenderMap = new Map();\n this.defaultRenderMap = new Map();\n this.styleRenderMap = new Map();\n this.dirtyBounds = new Bounds();\n this.backupDirtyBounds = new Bounds();\n this.global = application.global;\n this.layerService = application.layerService;\n if (!isArray(this.contributions)) {\n this.contributions = [this.contributions];\n }\n this.init();\n }\n\n reInit() {\n this.init();\n this.contributions.forEach(item => {\n item.reInit();\n });\n }\n\n init() {\n this.contributions.forEach(item => {\n if (item.style) {\n const map = this.styleRenderMap.get(item.style) || new Map();\n map.set(item.numberType, item);\n this.styleRenderMap.set(item.style, map);\n } else {\n this.defaultRenderMap.set(item.numberType, item);\n }\n });\n this.InterceptorContributions = this.drawItemInterceptorContributions\n .getContributions()\n .sort((a, b) => a.order - b.order);\n }\n\n prepareForDraw(renderService: IRenderService, drawContext: IDrawContext) {\n // 有dirtyBounds用dirtyBounds\n if (drawContext.updateBounds) {\n this.useDirtyBounds = true;\n } else {\n // 没有的话,看看是否需要跳过outRange的渲染\n this.useDirtyBounds = !drawContext.stage.params.optimize.disableCheckGraphicWidthOutRange;\n }\n }\n\n draw(renderService: IRenderService, drawContext: IDrawContext): MaybePromise<void> {\n this.prepareForDraw(renderService, drawContext);\n drawContext.drawContribution = this;\n this.currentRenderMap = this.styleRenderMap.get(drawContext.renderStyle) || this.defaultRenderMap;\n // this.startAtId = drawParams.startAtId;\n this.currentRenderService = renderService;\n // this.drawParams = drawParams;\n const { context, stage, viewBox, transMatrix } = drawContext;\n\n if (!context) {\n return;\n }\n // if (context.drawPromise) {\n // return;\n // }\n const dirtyBounds: IBounds | undefined = this.dirtyBounds.setValue(0, 0, viewBox.width(), viewBox.height());\n if (stage.dirtyBounds && !stage.dirtyBounds.empty()) {\n const b = getRectIntersect(dirtyBounds, stage.dirtyBounds, false);\n dirtyBounds.x1 = Math.floor(b.x1);\n dirtyBounds.y1 = Math.floor(b.y1);\n dirtyBounds.x2 = Math.ceil(b.x2);\n dirtyBounds.y2 = Math.ceil(b.y2);\n }\n // 如果dpr不是整数或者.5的小数,需要格式化dirtyBounds\n const d = context.dpr % 1;\n if (d || d !== 0.5) {\n dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr;\n dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr;\n dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr;\n dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr;\n }\n this.backupDirtyBounds.copy(dirtyBounds);\n // TODO:不需要设置context.transform,后续translate会设置\n context.reset(false);\n context.save();\n context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f);\n // 初始化context\n context.clearMatrix(false);\n // context.setTransformForCurrent(true);\n\n // const drawInArea =\n // dirtyBounds.width() * context.dpr < context.canvas.width ||\n // dirtyBounds.height() * context.dpr < context.canvas.height;\n // context.save();\n\n // 设置translate\n context.translate(viewBox.x1, viewBox.y1, true);\n context.beginPath();\n context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height());\n context.clip();\n\n // 如果存在3d视角,那么不使用dirtyBounds\n if (stage.camera) {\n this.dirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n this.backupDirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n }\n\n this.clearScreen(renderService, context, drawContext);\n if (renderService.drawParams?.stage) {\n renderService.drawParams.stage.hooks.afterClearScreen.call(renderService.drawParams);\n }\n // // 渲染的时候图元的起始位置就是x,y\n // this.backupDirtyBounds.translate(-x, -y);\n // this.dirtyBounds.translate(-x, -y);\n\n // // 设置translate\n // context.translate(x, y, true);\n\n // context.save();\n renderService.renderTreeRoots\n .sort((a, b) => {\n return (a.attribute.zIndex ?? DefaultAttribute.zIndex) - (b.attribute.zIndex ?? DefaultAttribute.zIndex);\n })\n .forEach(group => {\n group.isContainer\n ? this.renderGroup(group as IGroup, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0))\n : this.renderItem(group as IGraphic, drawContext);\n });\n\n // context.restore();\n // context.restore();\n // context.setClearMatrix(1, 0, 0, 1, 0, 0);\n // this.break = false;\n // context.inuse = false;\n context.restore();\n context.draw();\n }\n\n doRegister() {\n throw new Error('暂不支持');\n }\n\n // 找到下一个graphic\n protected _findNextGraphic(group: IGroup): IGraphic | null {\n let parent = group.parent;\n let id = group._uid;\n while (parent) {\n const g = findNextGraphic(parent, id, DefaultAttribute.zIndex);\n if (g) {\n return g;\n }\n id = parent._uid;\n parent = parent.parent;\n }\n return null;\n }\n\n renderGroup(group: IGroup, drawContext: IDrawContext, parentMatrix: IMatrix, skipSort?: boolean) {\n if (drawContext.break || group.attribute.visibleAll === false) {\n return;\n }\n if (group.incremental && (drawContext.startAtId == null || drawContext.startAtId === group._uid)) {\n drawContext.break = true;\n this._increaseRender(group, drawContext);\n return;\n }\n\n if (\n this.useDirtyBounds &&\n !isRectIntersect(group.AABBBounds, this.dirtyBounds, false) &&\n group.attribute.boundsMode !== 'empty'\n ) {\n return;\n }\n\n let nextM: IMatrix = parentMatrix;\n let tempBounds: IBounds;\n\n if (this.useDirtyBounds) {\n tempBounds = boundsAllocate.allocateByObj(this.dirtyBounds);\n // 变换dirtyBounds\n const gm = group.transMatrix;\n nextM = matrixAllocate.allocateByObj(parentMatrix).multiply(gm.a, gm.b, gm.c, gm.d, gm.e, gm.f);\n // const m = group.globalTransMatrix.getInverse();\n this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(nextM.getInverse());\n }\n\n drawContext.isGroupScroll = !!(group.attribute.scrollX || group.attribute.scrollY);\n\n this.renderItem(group, drawContext, {\n renderInGroupParams: {\n skipSort,\n nextM\n },\n renderInGroup: this._renderInGroup\n });\n\n if (this.useDirtyBounds) {\n this.dirtyBounds.copy(tempBounds);\n boundsAllocate.free(tempBounds);\n matrixAllocate.free(nextM);\n }\n }\n\n _renderInGroup = (skipSort: boolean, group: IGroup, drawContext: IDrawContext, nextM: IMatrix) => {\n skipSort\n ? group.forEachChildren((item: IGraphic) => {\n if (drawContext.break) {\n return;\n }\n if (item.isContainer) {\n this.renderGroup(item as IGroup, drawContext, nextM);\n } else {\n this.renderItem(item, drawContext);\n }\n })\n : foreach(\n group,\n DefaultAttribute.zIndex,\n (item: IGraphic) => {\n if (drawContext.break) {\n return;\n }\n if (item.isContainer) {\n this.renderGroup(item as IGroup, drawContext, nextM);\n } else {\n this.renderItem(item, drawContext);\n }\n },\n false,\n !!drawContext.context?.camera\n );\n };\n\n protected _increaseRender(group: IGroup, drawContext: IDrawContext) {\n const { layer, stage } = drawContext;\n const { subLayers } = layer;\n // 获取渐进渲染层\n let incrementalLayer = subLayers.get(group._uid);\n if (!incrementalLayer) {\n incrementalLayer = {\n layer: this.layerService.createLayer(stage),\n zIndex: subLayers.size,\n group\n };\n subLayers.set(group._uid, incrementalLayer);\n }\n // 渲染\n const incrementalContext = incrementalLayer.layer.getNativeHandler().getContext();\n const idc = incrementalLayer.drawContribution || container.get(IncrementalDrawContribution);\n idc.dirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n idc.backupDirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n (idc as any).draw(this.currentRenderService, {\n ...drawContext,\n drawContribution: idc,\n clear: 'transparent',\n layer: incrementalLayer.layer,\n context: incrementalContext,\n startAtId: group._uid,\n break: false\n });\n incrementalLayer.drawContribution = idc;\n // this.draw(this.currentRenderService, {...this.drawParams, startAtId: group._uid})\n // this.draw(this.currentRenderService, {...this.drawParams, clear: 'transparent', layer: incrementalContext.layer, context: incrementalContext, startAtId: group._uid})\n const nextGraphic = this._findNextGraphic(group);\n if (nextGraphic) {\n // 如果是下一个渐进渲染层,那就再来一次\n if (nextGraphic.isContainer && nextGraphic.incremental) {\n this._increaseRender(nextGraphic as IGroup, drawContext);\n } else {\n // 如果不是渐进渲染层,那就默认图层渲染\n let afterLayer = subLayers.get(nextGraphic._uid);\n if (!afterLayer) {\n afterLayer = {\n layer: this.layerService.createLayer(stage),\n zIndex: subLayers.size\n };\n subLayers.set(nextGraphic._uid, afterLayer);\n }\n const afterContext = afterLayer.layer.getNativeHandler().getContext();\n this.draw(this.currentRenderService, {\n ...drawContext,\n drawContribution: idc,\n clear: 'transparent',\n layer: afterLayer.layer,\n context: afterContext,\n startAtId: nextGraphic._uid,\n break: false\n });\n }\n }\n }\n\n getRenderContribution(graphic: IGraphic): IGraphicRender | null {\n let renderer;\n if (!renderer) {\n renderer = this.selectRenderByNumberType(graphic.numberType, graphic);\n }\n if (!renderer) {\n renderer = this.selectRenderByType(graphic.type);\n }\n return renderer;\n }\n\n renderItem(graphic: IGraphic, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n // 添加拦截器\n if (this.InterceptorContributions.length) {\n for (let i = 0; i < this.InterceptorContributions.length; i++) {\n const drawContribution = this.InterceptorContributions[i];\n if (\n drawContribution.beforeDrawItem &&\n drawContribution.beforeDrawItem(graphic, this.currentRenderService, drawContext, this, params)\n ) {\n return;\n }\n }\n }\n\n const renderer = this.getRenderContribution(graphic);\n if (!renderer) {\n return;\n }\n\n let retrans: boolean = false;\n let tempBounds: IBounds;\n\n if (drawContext.isGroupScroll) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n retrans = true;\n if (!this.scrollMatrix) {\n this.scrollMatrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);\n }\n this.scrollMatrix.translate(-scrollX, -scrollY);\n }\n // if (graphic.parent) {\n // const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n // if (!!(scrollX || scrollY)) {\n // retrans = true;\n // if (!this.scrollMatrix) {\n // this.scrollMatrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);\n // }\n // this.scrollMatrix.translate(-scrollX, -scrollY);\n // }\n // }\n // 需要二次变化,那就重新算一个变换后的Bounds\n if (retrans) {\n tempBounds = this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix);\n }\n\n if (\n this.useDirtyBounds &&\n !(\n graphic.isContainer ||\n graphic.attribute.boundsMode === 'empty' ||\n isRectIntersect(graphic.AABBBounds, tempBounds ?? this.dirtyBounds, false)\n )\n ) {\n if (retrans && graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n this.scrollMatrix && this.scrollMatrix.translate(scrollX, scrollY);\n }\n return;\n }\n\n const skipDraw = drawContext.startAtId != null && graphic._uid !== drawContext.startAtId;\n if (graphic._uid === drawContext.startAtId) {\n drawContext.startAtId = null;\n }\n params && (params.skipDraw = skipDraw);\n if (skipDraw) {\n graphic.isContainer && renderer.draw(graphic, this.currentRenderService, drawContext, params);\n } else {\n renderer.draw(graphic, this.currentRenderService, drawContext, params);\n }\n\n // retrans && this.dirtyBounds.copy(tempBounds);\n if (retrans && graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n this.scrollMatrix && this.scrollMatrix.translate(scrollX, scrollY);\n }\n\n // 添加拦截器\n if (this.InterceptorContributions.length) {\n for (let i = 0; i < this.InterceptorContributions.length; i++) {\n const drawContribution = this.InterceptorContributions[i];\n if (drawContribution.afterDrawItem) {\n if (drawContribution.afterDrawItem(graphic, this.currentRenderService, drawContext, this)) {\n return;\n }\n }\n }\n }\n }\n // 根据type选择对应的render\n protected selectRenderByType(type?: string): IGraphicRender | null {\n Logger.getInstance().warn('未知错误,不应该走到这里');\n return null;\n }\n // 根据type选择对应的render\n protected selectRenderByNumberType(type: number, graphic: IGraphic): IGraphicRender | null {\n let data;\n if (graphic.attribute.renderStyle) {\n const currentRenderMap = this.styleRenderMap.get(graphic.attribute.renderStyle);\n data = currentRenderMap && currentRenderMap.get(type);\n }\n return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);\n }\n\n protected clearScreen(renderService: IRenderService, context: IContext2d, drawContext: IDrawContext) {\n const { clear, viewBox } = drawContext;\n // 已经translate过了\n const x = 0;\n const y = 0;\n const width = viewBox.width();\n const height = viewBox.height();\n if (clear) {\n context.clearRect(x, y, width, height);\n const stage = renderService.drawParams?.stage;\n stage && (context.globalAlpha = (stage as any).attribute.opacity ?? 1);\n if (stage && (stage as any).backgroundImg && (stage as any).resources) {\n const res = (stage as any).resources.get(clear);\n if (res && res.state === 'success' && res.data) {\n context.drawImage(res.data, x, y, width, height);\n }\n } else {\n context.fillStyle = createColor(\n context,\n clear,\n {\n AABBBounds: { x1: x, y1: y, x2: x + width, y2: y + height }\n },\n 0,\n 0\n );\n context.fillRect(x, y, width, height);\n }\n }\n }\n\n afterDraw(renderService: IRenderService, drawParams: IDrawContext) {\n return;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/draw-contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAAwF;AAexF,+CAAgE;AAEhE,iFAA6E;AAC7E,oDAA2D;AAE3D,6CAA8F;AAC9F,kDAA+C;AAC/C,qCAAsE;AACtE,yDAAyD;AACzD,+DAA2D;AAE3D,wEAAoE;AACpE,wEAAoE;AACpE,sDAAmD;AAM5C,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAgBlC,YAIiD,aAA+B,EAK3D,gCAAyF;QAL7D,kBAAa,GAAb,aAAa,CAAkB;QAK3D,qCAAgC,GAAhC,gCAAgC,CAAyD;QAyM9G,mBAAc,GAAG,CAAC,QAAiB,EAAE,KAAa,EAAE,WAAyB,EAAE,KAAc,EAAE,EAAE;;YAC/F,QAAQ;gBACN,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,IAAc,EAAE,EAAE;oBACvC,IAAI,WAAW,CAAC,KAAK,EAAE;wBACrB,OAAO;qBACR;oBACD,IAAI,IAAI,CAAC,WAAW,EAAE;wBACpB,IAAI,CAAC,WAAW,CAAC,IAAc,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;qBACtD;yBAAM;wBACL,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;qBACpC;gBACH,CAAC,CAAC;gBACJ,CAAC,CAAC,IAAA,cAAO,EACL,KAAK,EACL,yBAAgB,CAAC,MAAM,EACvB,CAAC,IA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GAAG,GAAI,KAAa,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBAChD,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE;oBAC9C,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;iBAClD;aACF;iBAAM;gBACL,OAAO,CAAC,SAAS,GAAG,IAAA,0BAAW,EAC7B,OAAO,EACP,KAAK,EACL;oBACE,UAAU,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,EAAE;iBAC5D,EACD,CAAC,EACD,CAAC,CACF,CAAC;gBACF,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;aACvC;SACF;IACH,CAAC;IAED,SAAS,CAAC,aAA6B,EAAE,UAAwB;QAC/D,OAAO;IACT,CAAC;CACF,CAAA;AAndY,uBAAuB;IADnC,IAAA,2BAAU,GAAE;IAqBR,WAAA,IAAA,4BAAW,EAAC,sBAAa,CAAC,CAAA;IAG1B,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,sCAAmB,CAAC,CAAA;;GAxBlB,uBAAuB,CAmdnC;AAndY,0DAAuB","file":"draw-contribution.js","sourcesContent":["import { injectable, inject, named, multiInject } from '../../../common/inversify-lite';\nimport type {\n IContext2d,\n MaybePromise,\n IGraphic,\n IGroup,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider,\n IDrawItemInterceptorContribution,\n IDrawContribution,\n IGlobal\n} from '../../../interface';\nimport { findNextGraphic, foreach } from '../../../common/sort';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { DefaultAttribute } from '../../../graphic/config';\nimport type { IAABBBounds, IBounds, IMatrix } from '@visactor/vutils';\nimport { Bounds, Logger, getRectIntersect, isArray, isRectIntersect } from '@visactor/vutils';\nimport { container } from '../../../container';\nimport { GraphicRender, IncrementalDrawContribution } from './symbol';\nimport { DrawItemInterceptor } from './draw-interceptor';\nimport { createColor } from '../../../common/canvas-utils';\nimport type { ILayerService } from '../../../interface/core';\nimport { boundsAllocate } from '../../../allocator/bounds-allocate';\nimport { matrixAllocate } from '../../../allocator/matrix-allocate';\nimport { application } from '../../../application';\n\n/**\n * 默认的渲染contribution,基于树状结构针对图元的渲染\n */\n@injectable()\nexport class DefaultDrawContribution implements IDrawContribution {\n declare currentRenderMap: Map<number, IGraphicRender>;\n declare defaultRenderMap: Map<number, IGraphicRender>;\n declare styleRenderMap: Map<string, Map<number, IGraphicRender>>;\n declare dirtyBounds: IBounds;\n declare backupDirtyBounds: IBounds;\n // 是否使用dirtyBounds\n declare useDirtyBounds: boolean;\n declare currentRenderService: IRenderService;\n declare InterceptorContributions: IDrawItemInterceptorContribution[];\n\n declare global: IGlobal;\n declare layerService: ILayerService;\n\n declare scrollMatrix?: IMatrix;\n\n constructor(\n // @inject(ContributionProvider)\n // @named(GraphicRender)\n // protected readonly contributions: ContributionProvider<IGraphicRender>,\n @multiInject(GraphicRender) protected readonly contributions: IGraphicRender[],\n // @inject(RenderSelector) protected readonly renderSelector: IRenderSelector, // 根据图元类型选择对应的renderItem进行渲染\n // 拦截器\n @inject(ContributionProvider)\n @named(DrawItemInterceptor)\n protected readonly drawItemInterceptorContributions: IContributionProvider<IDrawItemInterceptorContribution>\n ) {\n this.currentRenderMap = new Map();\n this.defaultRenderMap = new Map();\n this.styleRenderMap = new Map();\n this.dirtyBounds = new Bounds();\n this.backupDirtyBounds = new Bounds();\n this.global = application.global;\n this.layerService = application.layerService;\n if (!isArray(this.contributions)) {\n this.contributions = [this.contributions];\n }\n this.init();\n }\n\n reInit() {\n this.init();\n this.contributions.forEach(item => {\n item.reInit();\n });\n }\n\n init() {\n this.contributions.forEach(item => {\n if (item.style) {\n const map = this.styleRenderMap.get(item.style) || new Map();\n map.set(item.numberType, item);\n this.styleRenderMap.set(item.style, map);\n } else {\n this.defaultRenderMap.set(item.numberType, item);\n }\n });\n this.InterceptorContributions = this.drawItemInterceptorContributions\n .getContributions()\n .sort((a, b) => a.order - b.order);\n }\n\n prepareForDraw(renderService: IRenderService, drawContext: IDrawContext) {\n // 有dirtyBounds用dirtyBounds\n if (drawContext.updateBounds) {\n this.useDirtyBounds = true;\n } else {\n // 没有的话,看看是否需要跳过outRange的渲染\n this.useDirtyBounds = !drawContext.stage.params.optimize.disableCheckGraphicWidthOutRange;\n }\n }\n\n draw(renderService: IRenderService, drawContext: IDrawContext): MaybePromise<void> {\n this.prepareForDraw(renderService, drawContext);\n drawContext.drawContribution = this;\n this.currentRenderMap = this.styleRenderMap.get(drawContext.renderStyle) || this.defaultRenderMap;\n // this.startAtId = drawParams.startAtId;\n this.currentRenderService = renderService;\n // this.drawParams = drawParams;\n const { context, stage, viewBox, transMatrix } = drawContext;\n\n if (!context) {\n return;\n }\n // if (context.drawPromise) {\n // return;\n // }\n const dirtyBounds: IBounds | undefined = this.dirtyBounds.setValue(0, 0, viewBox.width(), viewBox.height());\n if (stage.dirtyBounds && !stage.dirtyBounds.empty()) {\n const b = getRectIntersect(dirtyBounds, stage.dirtyBounds, false);\n dirtyBounds.x1 = Math.floor(b.x1);\n dirtyBounds.y1 = Math.floor(b.y1);\n dirtyBounds.x2 = Math.ceil(b.x2);\n dirtyBounds.y2 = Math.ceil(b.y2);\n }\n // 如果dpr不是整数或者.5的小数,需要格式化dirtyBounds\n const d = context.dpr % 1;\n if (d || d !== 0.5) {\n dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr;\n dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr;\n dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr;\n dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr;\n }\n this.backupDirtyBounds.copy(dirtyBounds);\n // TODO:不需要设置context.transform,后续translate会设置\n context.reset(false);\n context.save();\n context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f);\n // 初始化context\n context.clearMatrix(false);\n // context.setTransformForCurrent(true);\n\n // const drawInArea =\n // dirtyBounds.width() * context.dpr < context.canvas.width ||\n // dirtyBounds.height() * context.dpr < context.canvas.height;\n // context.save();\n\n // 设置translate\n context.translate(viewBox.x1, viewBox.y1, true);\n context.beginPath();\n context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height());\n context.clip();\n\n // 如果存在3d视角,那么不使用dirtyBounds\n if (stage.camera) {\n this.dirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n this.backupDirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n }\n\n this.clearScreen(renderService, context, drawContext);\n if (renderService.drawParams?.stage) {\n renderService.drawParams.stage.hooks.afterClearScreen.call(renderService.drawParams);\n }\n // // 渲染的时候图元的起始位置就是x,y\n // this.backupDirtyBounds.translate(-x, -y);\n // this.dirtyBounds.translate(-x, -y);\n\n // // 设置translate\n // context.translate(x, y, true);\n\n // context.save();\n renderService.renderTreeRoots\n .sort((a, b) => {\n return (a.attribute.zIndex ?? DefaultAttribute.zIndex) - (b.attribute.zIndex ?? DefaultAttribute.zIndex);\n })\n .forEach(group => {\n group.isContainer\n ? this.renderGroup(group as IGroup, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0))\n : this.renderItem(group as IGraphic, drawContext);\n });\n\n // context.restore();\n // context.restore();\n // context.setClearMatrix(1, 0, 0, 1, 0, 0);\n // this.break = false;\n // context.inuse = false;\n context.restore();\n context.draw();\n }\n\n doRegister() {\n throw new Error('暂不支持');\n }\n\n // 找到下一个graphic\n protected _findNextGraphic(group: IGroup): IGraphic | null {\n let parent = group.parent;\n let id = group._uid;\n while (parent) {\n const g = findNextGraphic(parent, id, DefaultAttribute.zIndex);\n if (g) {\n return g;\n }\n id = parent._uid;\n parent = parent.parent;\n }\n return null;\n }\n\n renderGroup(group: IGroup, drawContext: IDrawContext, parentMatrix: IMatrix, skipSort?: boolean) {\n if (drawContext.break || group.attribute.visibleAll === false) {\n return;\n }\n if (group.incremental && (drawContext.startAtId == null || drawContext.startAtId === group._uid)) {\n drawContext.break = true;\n this._increaseRender(group, drawContext);\n return;\n }\n\n if (\n this.useDirtyBounds &&\n !isRectIntersect(group.AABBBounds, this.dirtyBounds, false) &&\n group.attribute.boundsMode !== 'empty'\n ) {\n return;\n }\n\n let nextM: IMatrix = parentMatrix;\n let tempBounds: IBounds;\n\n if (this.useDirtyBounds) {\n tempBounds = boundsAllocate.allocateByObj(this.dirtyBounds);\n // 变换dirtyBounds\n const gm = group.transMatrix;\n nextM = matrixAllocate.allocateByObj(parentMatrix).multiply(gm.a, gm.b, gm.c, gm.d, gm.e, gm.f);\n // const m = group.globalTransMatrix.getInverse();\n this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(nextM.getInverse());\n }\n\n drawContext.isGroupScroll = !!(group.attribute.scrollX || group.attribute.scrollY);\n\n this.renderItem(group, drawContext, {\n renderInGroupParams: {\n skipSort,\n nextM\n },\n renderInGroup: this._renderInGroup\n });\n\n if (this.useDirtyBounds) {\n this.dirtyBounds.copy(tempBounds);\n boundsAllocate.free(tempBounds);\n matrixAllocate.free(nextM);\n }\n }\n\n _renderInGroup = (skipSort: boolean, group: IGroup, drawContext: IDrawContext, nextM: IMatrix) => {\n skipSort\n ? group.forEachChildren((item: IGraphic) => {\n if (drawContext.break) {\n return;\n }\n if (item.isContainer) {\n this.renderGroup(item as IGroup, drawContext, nextM);\n } else {\n this.renderItem(item, drawContext);\n }\n })\n : foreach(\n group,\n DefaultAttribute.zIndex,\n (item: IGraphic) => {\n if (drawContext.break) {\n return;\n }\n if (item.isContainer) {\n this.renderGroup(item as IGroup, drawContext, nextM);\n } else {\n this.renderItem(item, drawContext);\n }\n },\n false,\n !!drawContext.context?.camera\n );\n };\n\n protected _increaseRender(group: IGroup, drawContext: IDrawContext) {\n const { layer, stage } = drawContext;\n const { subLayers } = layer;\n // 获取渐进渲染层\n let incrementalLayer = subLayers.get(group._uid);\n if (!incrementalLayer) {\n incrementalLayer = {\n layer: this.layerService.createLayer(stage),\n zIndex: subLayers.size,\n group\n };\n subLayers.set(group._uid, incrementalLayer);\n }\n // 渲染\n const incrementalContext = incrementalLayer.layer.getNativeHandler().getContext();\n const idc = incrementalLayer.drawContribution || container.get(IncrementalDrawContribution);\n idc.dirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n idc.backupDirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n (idc as any).draw(this.currentRenderService, {\n ...drawContext,\n drawContribution: idc,\n clear: 'transparent',\n layer: incrementalLayer.layer,\n context: incrementalContext,\n startAtId: group._uid,\n break: false\n });\n incrementalLayer.drawContribution = idc;\n // this.draw(this.currentRenderService, {...this.drawParams, startAtId: group._uid})\n // this.draw(this.currentRenderService, {...this.drawParams, clear: 'transparent', layer: incrementalContext.layer, context: incrementalContext, startAtId: group._uid})\n const nextGraphic = this._findNextGraphic(group);\n if (nextGraphic) {\n // 如果是下一个渐进渲染层,那就再来一次\n if (nextGraphic.isContainer && nextGraphic.incremental) {\n this._increaseRender(nextGraphic as IGroup, drawContext);\n } else {\n // 如果不是渐进渲染层,那就默认图层渲染\n let afterLayer = subLayers.get(nextGraphic._uid);\n if (!afterLayer) {\n afterLayer = {\n layer: this.layerService.createLayer(stage),\n zIndex: subLayers.size\n };\n subLayers.set(nextGraphic._uid, afterLayer);\n }\n const afterContext = afterLayer.layer.getNativeHandler().getContext();\n this.draw(this.currentRenderService, {\n ...drawContext,\n drawContribution: idc,\n clear: 'transparent',\n layer: afterLayer.layer,\n context: afterContext,\n startAtId: nextGraphic._uid,\n break: false\n });\n }\n }\n }\n\n getRenderContribution(graphic: IGraphic): IGraphicRender | null {\n let renderer;\n if (!renderer) {\n renderer = this.selectRenderByNumberType(graphic.numberType, graphic);\n }\n if (!renderer) {\n renderer = this.selectRenderByType(graphic.type);\n }\n return renderer;\n }\n\n renderItem(graphic: IGraphic, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n // 添加拦截器\n if (this.InterceptorContributions.length) {\n for (let i = 0; i < this.InterceptorContributions.length; i++) {\n const drawContribution = this.InterceptorContributions[i];\n if (\n drawContribution.beforeDrawItem &&\n drawContribution.beforeDrawItem(graphic, this.currentRenderService, drawContext, this, params)\n ) {\n return;\n }\n }\n }\n\n const renderer = this.getRenderContribution(graphic);\n if (!renderer) {\n return;\n }\n\n let retrans: boolean = false;\n let tempBounds: IBounds;\n\n if (drawContext.isGroupScroll) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n retrans = true;\n if (!this.scrollMatrix) {\n this.scrollMatrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);\n }\n this.scrollMatrix.translate(-scrollX, -scrollY);\n }\n // if (graphic.parent) {\n // const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n // if (!!(scrollX || scrollY)) {\n // retrans = true;\n // if (!this.scrollMatrix) {\n // this.scrollMatrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);\n // }\n // this.scrollMatrix.translate(-scrollX, -scrollY);\n // }\n // }\n // 需要二次变化,那就重新算一个变换后的Bounds\n if (retrans) {\n tempBounds = this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix);\n }\n\n if (\n this.useDirtyBounds &&\n !(\n graphic.isContainer ||\n graphic.attribute.boundsMode === 'empty' ||\n isRectIntersect(graphic.AABBBounds, tempBounds ?? this.dirtyBounds, false)\n )\n ) {\n if (retrans && graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n this.scrollMatrix && this.scrollMatrix.translate(scrollX, scrollY);\n }\n return;\n }\n\n const skipDraw = drawContext.startAtId != null && graphic._uid !== drawContext.startAtId;\n if (graphic._uid === drawContext.startAtId) {\n drawContext.startAtId = null;\n }\n params && (params.skipDraw = skipDraw);\n if (skipDraw) {\n graphic.isContainer && renderer.draw(graphic, this.currentRenderService, drawContext, params);\n } else {\n renderer.draw(graphic, this.currentRenderService, drawContext, params);\n }\n\n // retrans && this.dirtyBounds.copy(tempBounds);\n if (retrans && graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n this.scrollMatrix && this.scrollMatrix.translate(scrollX, scrollY);\n }\n\n // 添加拦截器\n if (this.InterceptorContributions.length) {\n for (let i = 0; i < this.InterceptorContributions.length; i++) {\n const drawContribution = this.InterceptorContributions[i];\n if (drawContribution.afterDrawItem) {\n if (drawContribution.afterDrawItem(graphic, this.currentRenderService, drawContext, this)) {\n return;\n }\n }\n }\n }\n }\n // 根据type选择对应的render\n protected selectRenderByType(type?: string): IGraphicRender | null {\n Logger.getInstance().warn('未知错误,不应该走到这里');\n return null;\n }\n // 根据type选择对应的render\n protected selectRenderByNumberType(type: number, graphic: IGraphic): IGraphicRender | null {\n let data;\n if (graphic.attribute.renderStyle) {\n const currentRenderMap = this.styleRenderMap.get(graphic.attribute.renderStyle);\n data = currentRenderMap && currentRenderMap.get(type);\n }\n return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);\n }\n\n protected clearScreen(renderService: IRenderService, context: IContext2d, drawContext: IDrawContext) {\n const { clear, viewBox } = drawContext;\n // 已经translate过了\n const x = 0;\n const y = 0;\n const width = viewBox.width();\n const height = viewBox.height();\n if (clear) {\n context.clearRect(x, y, width, height);\n if (renderService.drawParams?.stage) {\n renderService.drawParams.stage.hooks.afterClearRect.call(renderService.drawParams);\n }\n const stage = renderService.drawParams?.stage;\n stage && (context.globalAlpha = (stage as any).attribute.opacity ?? 1);\n if (stage && (stage as any).backgroundImg && (stage as any).resources) {\n const res = (stage as any).resources.get(clear);\n if (res && res.state === 'success' && res.data) {\n context.drawImage(res.data, x, y, width, height);\n }\n } else {\n context.fillStyle = createColor(\n context,\n clear,\n {\n AABBBounds: { x1: x, y1: y, x2: x + width, y2: y + height }\n },\n 0,\n 0\n );\n context.fillRect(x, y, width, height);\n }\n }\n }\n\n afterDraw(renderService: IRenderService, drawParams: IDrawContext) {\n return;\n }\n}\n"]}
|
package/dist/index.es.js
CHANGED
|
@@ -21850,7 +21850,7 @@ let DefaultDrawContribution = class DefaultDrawContribution {
|
|
|
21850
21850
|
return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
|
|
21851
21851
|
}
|
|
21852
21852
|
clearScreen(renderService, context, drawContext) {
|
|
21853
|
-
var _a, _b;
|
|
21853
|
+
var _a, _b, _c;
|
|
21854
21854
|
const { clear, viewBox } = drawContext;
|
|
21855
21855
|
const x = 0;
|
|
21856
21856
|
const y = 0;
|
|
@@ -21858,8 +21858,11 @@ let DefaultDrawContribution = class DefaultDrawContribution {
|
|
|
21858
21858
|
const height = viewBox.height();
|
|
21859
21859
|
if (clear) {
|
|
21860
21860
|
context.clearRect(x, y, width, height);
|
|
21861
|
-
|
|
21862
|
-
|
|
21861
|
+
if ((_a = renderService.drawParams) === null || _a === void 0 ? void 0 : _a.stage) {
|
|
21862
|
+
renderService.drawParams.stage.hooks.afterClearRect.call(renderService.drawParams);
|
|
21863
|
+
}
|
|
21864
|
+
const stage = (_b = renderService.drawParams) === null || _b === void 0 ? void 0 : _b.stage;
|
|
21865
|
+
stage && (context.globalAlpha = (_c = stage.attribute.opacity) !== null && _c !== void 0 ? _c : 1);
|
|
21863
21866
|
if (stage && stage.backgroundImg && stage.resources) {
|
|
21864
21867
|
const res = stage.resources.get(clear);
|
|
21865
21868
|
if (res && res.state === 'success' && res.data) {
|
|
@@ -22678,6 +22681,9 @@ class Stage extends Group {
|
|
|
22678
22681
|
this.afterClearScreen = (drawParams) => {
|
|
22679
22682
|
this._afterClearScreen && this._afterClearScreen(drawParams);
|
|
22680
22683
|
};
|
|
22684
|
+
this.afterClearRect = (drawParams) => {
|
|
22685
|
+
this._afterClearRect && this._afterClearRect(drawParams);
|
|
22686
|
+
};
|
|
22681
22687
|
this.afterRender = (stage) => {
|
|
22682
22688
|
this.renderCount++;
|
|
22683
22689
|
this._afterRender && this._afterRender(stage);
|
|
@@ -22694,7 +22700,8 @@ class Stage extends Group {
|
|
|
22694
22700
|
this.hooks = {
|
|
22695
22701
|
beforeRender: new SyncHook(['stage']),
|
|
22696
22702
|
afterRender: new SyncHook(['stage']),
|
|
22697
|
-
afterClearScreen: new SyncHook(['stage'])
|
|
22703
|
+
afterClearScreen: new SyncHook(['stage']),
|
|
22704
|
+
afterClearRect: new SyncHook(['stage'])
|
|
22698
22705
|
};
|
|
22699
22706
|
this.global = application.global;
|
|
22700
22707
|
if (!this.global.env && isBrowserEnv()) {
|
|
@@ -22744,9 +22751,11 @@ class Stage extends Group {
|
|
|
22744
22751
|
this.hooks.beforeRender.tap('constructor', this.beforeRender);
|
|
22745
22752
|
this.hooks.afterRender.tap('constructor', this.afterRender);
|
|
22746
22753
|
this.hooks.afterClearScreen.tap('constructor', this.afterClearScreen);
|
|
22754
|
+
this.hooks.afterClearRect.tap('constructor', this.afterClearRect);
|
|
22747
22755
|
this._beforeRender = params.beforeRender;
|
|
22748
22756
|
this._afterRender = params.afterRender;
|
|
22749
22757
|
this._afterClearScreen = params.afterClearScreen;
|
|
22758
|
+
this._afterClearRect = params.afterClearRect;
|
|
22750
22759
|
this.supportInteractiveLayer = params.interactiveLayer !== false;
|
|
22751
22760
|
if (!params.optimize) {
|
|
22752
22761
|
params.optimize = {
|
package/es/core/stage.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare class Stage extends Group implements IStage {
|
|
|
20
20
|
beforeRender: ISyncHook<[IStage]>;
|
|
21
21
|
afterRender: ISyncHook<[IStage]>;
|
|
22
22
|
afterClearScreen: ISyncHook<[IRenderServiceDrawParams]>;
|
|
23
|
+
afterClearRect: ISyncHook<[IRenderServiceDrawParams]>;
|
|
23
24
|
};
|
|
24
25
|
set viewBox(b: IBoundsLike);
|
|
25
26
|
get viewBox(): IAABBBounds;
|
|
@@ -60,6 +61,7 @@ export declare class Stage extends Group implements IStage {
|
|
|
60
61
|
protected _beforeRender?: (stage: IStage) => void;
|
|
61
62
|
protected _afterRender?: (stage: IStage) => void;
|
|
62
63
|
protected _afterClearScreen?: (drawParams: any) => void;
|
|
64
|
+
protected _afterClearRect?: (drawParams: any) => void;
|
|
63
65
|
protected _skipRender?: number;
|
|
64
66
|
protected _afterNextRenderCbs?: ((stage: IStage) => void)[];
|
|
65
67
|
protected lastRenderparams?: Partial<IDrawContext>;
|
|
@@ -107,6 +109,7 @@ export declare class Stage extends Group implements IStage {
|
|
|
107
109
|
set3dOptions(options: IOption3D): void;
|
|
108
110
|
protected beforeRender: (stage: IStage) => void;
|
|
109
111
|
protected afterClearScreen: (drawParams: any) => void;
|
|
112
|
+
protected afterClearRect: (drawParams: any) => void;
|
|
110
113
|
protected afterRender: (stage: IStage) => void;
|
|
111
114
|
protected afterTickCb: () => void;
|
|
112
115
|
setBeforeRender(cb: (stage: IStage) => void): void;
|
package/es/core/stage.js
CHANGED
|
@@ -129,6 +129,8 @@ export class Stage extends Group {
|
|
|
129
129
|
this._beforeRender && this._beforeRender(stage);
|
|
130
130
|
}, this.afterClearScreen = drawParams => {
|
|
131
131
|
this._afterClearScreen && this._afterClearScreen(drawParams);
|
|
132
|
+
}, this.afterClearRect = drawParams => {
|
|
133
|
+
this._afterClearRect && this._afterClearRect(drawParams);
|
|
132
134
|
}, this.afterRender = stage => {
|
|
133
135
|
this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach((cb => cb(stage))),
|
|
134
136
|
this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
|
|
@@ -137,7 +139,8 @@ export class Stage extends Group {
|
|
|
137
139
|
}, this.params = params, this.theme = new Theme, this.hooks = {
|
|
138
140
|
beforeRender: new SyncHook([ "stage" ]),
|
|
139
141
|
afterRender: new SyncHook([ "stage" ]),
|
|
140
|
-
afterClearScreen: new SyncHook([ "stage" ])
|
|
142
|
+
afterClearScreen: new SyncHook([ "stage" ]),
|
|
143
|
+
afterClearRect: new SyncHook([ "stage" ])
|
|
141
144
|
}, this.global = application.global, !this.global.env && isBrowserEnv() && this.global.setEnv("browser"),
|
|
142
145
|
this.window = container.get(VWindow), this.renderService = container.get(RenderService),
|
|
143
146
|
this.pluginService = container.get(PluginService), this.layerService = container.get(LayerService),
|
|
@@ -160,8 +163,9 @@ export class Stage extends Group {
|
|
|
160
163
|
params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute),
|
|
161
164
|
params.ReactDOM && this.enableReactAttribute(params.ReactDOM), params.enableLayout && this.enableLayout(),
|
|
162
165
|
this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender),
|
|
163
|
-
this.hooks.afterClearScreen.tap("constructor", this.afterClearScreen), this.
|
|
164
|
-
this.
|
|
166
|
+
this.hooks.afterClearScreen.tap("constructor", this.afterClearScreen), this.hooks.afterClearRect.tap("constructor", this.afterClearRect),
|
|
167
|
+
this._beforeRender = params.beforeRender, this._afterRender = params.afterRender,
|
|
168
|
+
this._afterClearScreen = params.afterClearScreen, this._afterClearRect = params.afterClearRect,
|
|
165
169
|
this.supportInteractiveLayer = !1 !== params.interactiveLayer, params.optimize || (params.optimize = {
|
|
166
170
|
tickRenderMode: "effect"
|
|
167
171
|
}), this.optmize(params.optimize), params.background && isString(this._background) && this._background.includes("/") && this.setAttributes({
|
package/es/core/stage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/stage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AA6B3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ACF","file":"stage.js","sourcesContent":["import type { IAABBBounds, IBounds, IBoundsLike, IMatrix } from '@visactor/vutils';\nimport { Bounds, Point, isString } from '@visactor/vutils';\nimport type {\n IGraphic,\n IExportType,\n IStage,\n IStageParams,\n ILayer,\n IColor,\n IGlobal,\n IOption3D,\n ICamera,\n vec3,\n IDirectionLight,\n ITicker,\n IRenderService,\n IPickerService,\n IPluginService,\n ISyncHook,\n IDrawContext,\n IWindow,\n ILayerService,\n ITimeline,\n IOptimizeType,\n LayerMode,\n PickResult,\n IPlugin,\n IGraphicService,\n IRenderServiceDrawParams\n} from '../interface';\nimport { VWindow } from './window';\nimport type { Layer } from './layer';\nimport { EventSystem } from '../event';\nimport { container } from '../container';\nimport { RenderService } from '../render';\nimport { Group } from '../graphic/group';\nimport { Theme } from '../graphic/theme';\nimport { PickerService } from '../picker/constants';\nimport { PluginService } from '../plugins/constants';\nimport { AutoRenderPlugin } from '../plugins/builtin-plugin/auto-render-plugin';\nimport { AutoRefreshPlugin } from '../plugins/builtin-plugin/auto-refresh-plugin';\nimport { IncrementalAutoRenderPlugin } from '../plugins/builtin-plugin/incremental-auto-render-plugin';\nimport { DirtyBoundsPlugin } from '../plugins/builtin-plugin/dirty-bounds-plugin';\nimport { SyncHook } from '../tapable';\nimport { LayerService } from './constants';\nimport { application } from '../application';\nimport { isBrowserEnv } from '../env-check';\nimport { Factory } from '../factory';\nimport { Graphic, GraphicService } from '../graphic';\n\nconst DefaultConfig = {\n WIDTH: 500,\n HEIGHT: 500,\n X: 0,\n Y: 0,\n BACKGROUND: 'white'\n};\n\ntype IStageState = 'rendering' | 'normal';\n\n/**\n * Stage是一个舞台或一个视口,并不直接对应一个或多个Canvas,逻辑上和Canvas无关\n *\n * 1. Stage对应一个Canvas的整体,Stage的宽高即为Canvas的宽高\n * 2. Stage小于Canvas,Stage作为Canvas某个区域的视口,只管理这个区域\n * 3. 多图层时Stage的多个图层对应多个Canvas\n *\n * 原生环境下Stage可以拥有一个Window或者使用Window的一块区域\n *\n * 【注】如果希望获取完整的Canvas或窗口或者调整窗口信息,请使用Window模块\n */\nexport class Stage extends Group implements IStage {\n declare parent: IStage | null;\n\n declare state: IStageState;\n\n private _background: string | IColor;\n protected nextFrameRenderLayerSet: Set<Layer>;\n protected willNextFrameRender: boolean;\n protected _cursor: string;\n renderCount: number;\n dirtyBounds: IBounds | null;\n option3d?: IOption3D;\n declare light?: IDirectionLight;\n declare camera?: ICamera;\n declare renderStyle?: string;\n\n declare hooks: {\n beforeRender: ISyncHook<[IStage]>;\n afterRender: ISyncHook<[IStage]>;\n afterClearScreen: ISyncHook<[IRenderServiceDrawParams]>;\n };\n\n set viewBox(b: IBoundsLike) {\n this.window.setViewBox(b);\n }\n get viewBox(): IAABBBounds {\n return this.window.getViewBox();\n }\n\n /**\n * @deprecated 不建议使用\n */\n get x(): number {\n return this.window.getViewBox().x1;\n }\n /**\n * @deprecated 不建议使用\n */\n set x(x: number) {\n const b = this.window.getViewBox();\n b.translate(x - b.x1, 0);\n this.window.setViewBox(b);\n }\n /**\n * @deprecated 不建议使用\n */\n get y(): number {\n return this.window.getViewBox().y1;\n }\n /**\n * @deprecated 不建议使用\n */\n set y(y: number) {\n const b = this.window.getViewBox();\n b.translate(0, y - b.y1);\n this.window.setViewBox(b);\n }\n get width(): number {\n return this.window.width;\n }\n set width(w: number) {\n this.resize(w, this.height);\n }\n get viewWidth(): number {\n return this.window.getViewBox().width();\n }\n set viewWidth(w: number) {\n this.resizeView(w, this.viewHeight);\n }\n get viewHeight(): number {\n return this.window.getViewBox().height();\n }\n set viewHeight(h: number) {\n this.resizeView(this.viewWidth, h);\n }\n get height(): number {\n return this.window.height;\n }\n set height(h: number) {\n this.resize(this.width, h);\n }\n get dpr(): number {\n return this.window.dpr;\n }\n set dpr(r: number) {\n this.setDpr(r);\n }\n get background(): string | IColor {\n return this._background ?? DefaultConfig.BACKGROUND;\n }\n set background(b: string | IColor) {\n this._background = b;\n }\n get defaultLayer(): ILayer {\n return this.at(0) as unknown as ILayer;\n }\n\n protected _ticker: ITicker;\n\n autoRender: boolean;\n autoRefresh: boolean;\n _enableLayout: boolean;\n htmlAttribute: boolean | string | any;\n reactAttribute: boolean | string | any;\n increaseAutoRender: boolean;\n view3dTranform: boolean;\n readonly window: IWindow;\n private readonly global: IGlobal;\n readonly renderService: IRenderService;\n protected pickerService?: IPickerService;\n readonly pluginService: IPluginService;\n readonly layerService: ILayerService;\n readonly graphicService: IGraphicService;\n private _eventSystem?: EventSystem;\n private get eventSystem(): EventSystem {\n return this._eventSystem;\n }\n\n protected _beforeRender?: (stage: IStage) => void;\n protected _afterRender?: (stage: IStage) => void;\n protected _afterClearScreen?: (drawParams: any) => void;\n // 0: 正常渲染, > 0: 跳过隐藏canvas的渲染, < 0: 禁止渲染\n protected _skipRender?: number;\n protected _afterNextRenderCbs?: ((stage: IStage) => void)[];\n protected lastRenderparams?: Partial<IDrawContext>;\n\n protected interactiveLayer?: ILayer;\n protected supportInteractiveLayer: boolean;\n protected timeline: ITimeline;\n\n declare params: Partial<IStageParams>;\n\n // 是否在render之前执行了tick,如果没有执行,尝试执行tick用来应用动画属性,避免动画过程中随意赋值然后又调用同步render导致属性的突变\n // 第一次render不需要强行走动画\n protected tickedBeforeRender: boolean = true;\n\n // 随机分配一个rafId\n readonly rafId: number;\n\n get ticker() {\n return this._ticker;\n }\n\n set ticker(ticker: ITicker) {\n ticker.bindStage(this);\n if (this._ticker) {\n this._ticker.removeListener('tick', this.afterTickCb);\n }\n ticker.addTimeline(this.timeline);\n this._ticker = ticker;\n this._ticker.on('tick', this.afterTickCb);\n }\n\n /**\n * 所有属性都具有默认值。\n * Canvas为字符串或者Canvas元素,那么默认图层就会绑定到这个Canvas上\n * 如果不传入Canvas,那么会新建一个Canvas,用户可以通过Window模块管理这个Canvas\n * 1. 如果没有传入宽高,那么默认为canvas宽高,如果传入了宽高则stage使用传入宽高作为视口宽高\n * @param params\n */\n constructor(params: Partial<IStageParams> = {}) {\n super({});\n this.params = params;\n this.theme = new Theme();\n this.hooks = {\n beforeRender: new SyncHook(['stage']),\n afterRender: new SyncHook(['stage']),\n afterClearScreen: new SyncHook(['stage'])\n };\n this.global = application.global;\n if (!this.global.env && isBrowserEnv()) {\n // 如果是浏览器环境,默认设置env\n this.global.setEnv('browser');\n }\n this.window = container.get<IWindow>(VWindow);\n this.renderService = container.get<IRenderService>(RenderService);\n this.pluginService = container.get<IPluginService>(PluginService);\n this.layerService = container.get<ILayerService>(LayerService);\n this.graphicService = container.get<IGraphicService>(GraphicService);\n this.pluginService.active(this, params);\n\n this.window.create({\n width: params.width,\n height: params.height,\n viewBox: params.viewBox,\n container: params.container,\n dpr: params.dpr || this.global.devicePixelRatio,\n canvasControled: params.canvasControled !== false,\n title: params.title || '',\n canvas: params.canvas\n });\n\n this.state = 'normal';\n this.renderCount = 0;\n this.tryInitEventSystem();\n // // 没有传入xy就默认为0\n // this._x = params.x ?? DefaultConfig.X;\n // this._y = params.y ?? DefaultConfig.Y;\n // // 没有传入view的宽高则默认为window的宽高\n // this._viewWidth = params.viewWidth ?? this.window.width;\n // this._viewHeight = params.viewHeight ?? this.window.height;\n // this._AABBBounds.set(this._x, this._y, this._viewWidth + this._x, this._viewHeight + this._y);\n // 背景色默认为纯白色\n this._background = params.background ?? DefaultConfig.BACKGROUND;\n\n // 创建一个默认layer图层\n // this.appendChild(new Layer(this, this.global, this.window, { main: true }));\n this.appendChild(this.layerService.createLayer(this, { main: true }));\n\n this.nextFrameRenderLayerSet = new Set();\n this.willNextFrameRender = false;\n this.stage = this;\n this.renderStyle = params.renderStyle;\n\n // this.autoRender = params.autoRender;\n if (params.autoRender) {\n this.enableAutoRender();\n }\n if (params.autoRefresh) {\n this.enableAutoRefresh();\n }\n // 默认不开启dirtyBounds\n if (params.disableDirtyBounds === false) {\n this.enableDirtyBounds();\n }\n\n if (params.enableHtmlAttribute) {\n this.enableHtmlAttribute(params.enableHtmlAttribute);\n }\n if (params.ReactDOM) {\n this.enableReactAttribute(params.ReactDOM);\n }\n\n params.enableLayout && this.enableLayout();\n this.hooks.beforeRender.tap('constructor', this.beforeRender);\n this.hooks.afterRender.tap('constructor', this.afterRender);\n this.hooks.afterClearScreen.tap('constructor', this.afterClearScreen);\n this._beforeRender = params.beforeRender;\n this._afterRender = params.afterRender;\n this._afterClearScreen = params.afterClearScreen;\n this.supportInteractiveLayer = params.interactiveLayer !== false;\n if (!params.optimize) {\n params.optimize = {\n tickRenderMode: 'effect'\n };\n }\n this.optmize(params.optimize);\n // 如果背景是图片,触发加载图片操作\n if (params.background && isString(this._background) && this._background.includes('/')) {\n this.setAttributes({ background: this._background });\n }\n\n this.initAnimate(params);\n this.rafId = params.rafId ?? Math.floor(Math.random() * 6);\n }\n\n initAnimate(params: Partial<IStageParams>) {\n if ((this as any).createTicker && (this as any).createTimeline) {\n this._ticker = params.ticker || (this as any).createTicker(this);\n this._ticker.bindStage(this);\n if (this.params.optimize?.tickRenderMode === 'performance') {\n this._ticker.setFPS(30);\n }\n this.timeline = (this as any).createTimeline();\n this._ticker.addTimeline(this.timeline);\n this._ticker.on('tick', this.afterTickCb);\n }\n }\n\n startAnimate() {\n if (this._ticker && this.timeline) {\n this._ticker.start();\n this.timeline.resume();\n }\n }\n\n pauseRender(sr: number = -1) {\n this._skipRender = sr;\n }\n\n resumeRender() {\n this._skipRender = 0;\n }\n\n protected tryInitEventSystem() {\n if (this.global.supportEvent && !this._eventSystem) {\n this._eventSystem = new EventSystem({\n targetElement: this.window,\n resolution: this.window.dpr || this.global.devicePixelRatio,\n rootNode: this as any,\n global: this.global,\n supportsPointerEvents: this.params.supportsPointerEvents,\n supportsTouchEvents: this.params.supportsTouchEvents,\n ...this.params.event\n });\n }\n }\n\n preventRender(prevent: boolean) {\n if (prevent) {\n this._skipRender = -Infinity;\n } else {\n // 判断是否需要outRange优化\n if (this.params.optimize.skipRenderWithOutRange !== false) {\n this._skipRender = this.window.isVisible() ? 0 : 1;\n } else {\n this._skipRender = 0;\n }\n }\n }\n\n // 优化策略\n optmize(params: IOptimizeType) {\n this.optmizeRender(params.skipRenderWithOutRange);\n this.params.optimize = params;\n }\n\n // 优化渲染\n protected optmizeRender(skipRenderWithOutRange: boolean = false) {\n if (!skipRenderWithOutRange) {\n return;\n }\n // 不在视口内的时候,跳过渲染\n this._skipRender = this._skipRender < 0 ? this._skipRender : this.window.isVisible() ? 0 : 1;\n this.window.onVisibleChange(this._onVisibleChange);\n }\n\n protected _onVisibleChange = (visible: boolean) => {\n if (this._skipRender < 0) {\n return;\n }\n if (visible) {\n if (this.dirtyBounds) {\n const b = this.window.getViewBox();\n this.dirtyBounds.setValue(b.x1, b.y1, b.width(), b.height());\n }\n if (this._skipRender > 1) {\n this.renderNextFrame();\n }\n this._skipRender = 0;\n } else {\n this._skipRender = 1;\n }\n };\n\n getTimeline() {\n return this.timeline;\n }\n\n get3dOptions(options: IOption3D) {\n const {\n center = { x: this.width / 2, y: this.height / 2, z: 0, dx: 0, dy: 0, dz: 0 },\n light = {},\n alpha = 0,\n beta = 0,\n camera,\n fieldRatio = 1,\n fieldDepth\n } = options;\n\n return {\n ...options,\n center,\n light,\n alpha,\n beta,\n camera,\n fieldRatio,\n fieldDepth\n };\n }\n\n set3dOptions(options: IOption3D) {\n this.option3d = options;\n const options3d = this.get3dOptions(options);\n const { light, center, camera, alpha, beta, fieldRatio, fieldDepth } = options3d;\n const { dir = [1, 1, -1], color = 'white', ambient } = light;\n\n const centerX = (center.x ?? this.width / 2) + (center.dx ?? 0);\n const centerY = (center.y ?? this.height / 2) + (center.dy ?? 0);\n const centerZ = (center.z ?? 0) + (center.dz ?? 0);\n const centerVec3: vec3 = [centerX, centerY, centerZ];\n const z = 1;\n let cameraX = 0;\n let cameraY = 0;\n let cameraZ = 0;\n if (!camera) {\n cameraX = Math.sin(alpha) + centerX;\n cameraY = Math.sin(beta) + centerY;\n cameraZ = Math.cos(alpha) * Math.cos(beta) * z;\n }\n\n const DirectionalLight = Factory.getPlugin('DirectionalLight');\n\n if (DirectionalLight) {\n this.light = new DirectionalLight(dir, color, ambient);\n }\n const cameraParams = {\n left: 0,\n right: this.width,\n top: 0,\n bottom: this.height,\n fieldRatio: fieldRatio,\n fieldDepth,\n viewParams: {\n pos: [cameraX, cameraY, cameraZ] as vec3,\n center: centerVec3,\n up: [0, 1, 0] as vec3\n }\n };\n if (this.camera) {\n this.camera.params = cameraParams;\n } else {\n const OrthoCamera = Factory.getPlugin('OrthoCamera');\n if (OrthoCamera) {\n this.camera = new OrthoCamera(cameraParams);\n }\n }\n\n if (options.enableView3dTransform) {\n this.enableView3dTransform();\n }\n }\n\n protected beforeRender = (stage: IStage) => {\n this._beforeRender && this._beforeRender(stage);\n };\n protected afterClearScreen = (drawParams: any) => {\n this._afterClearScreen && this._afterClearScreen(drawParams);\n };\n\n protected afterRender = (stage: IStage) => {\n this.renderCount++;\n this._afterRender && this._afterRender(stage);\n this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage));\n this._afterNextRenderCbs = null;\n this.tickedBeforeRender = false;\n };\n\n protected afterTickCb = () => {\n this.tickedBeforeRender = true;\n // 性能模式不用立刻渲染\n this.state !== 'rendering' && this.renderNextFrame();\n };\n\n setBeforeRender(cb: (stage: IStage) => void) {\n this._beforeRender = cb;\n }\n\n setAfterRender(cb: (stage: IStage) => void) {\n this._afterRender = cb;\n }\n\n afterNextRender(cb: (stage: IStage) => void) {\n if (!this._afterNextRenderCbs) {\n this._afterNextRenderCbs = [];\n }\n this._afterNextRenderCbs.push(cb);\n }\n\n enableView3dTransform() {\n if (this.view3dTranform) {\n return;\n }\n this.view3dTranform = true;\n const ViewTransform3dPlugin = Factory.getPlugin('ViewTransform3dPlugin');\n\n if (ViewTransform3dPlugin) {\n this.pluginService.register(new ViewTransform3dPlugin());\n }\n }\n\n disableView3dTranform() {\n if (!this.view3dTranform) {\n return;\n }\n this.view3dTranform = false;\n this.pluginService.findPluginsByName('ViewTransform3dPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n\n enableAutoRender() {\n if (this.autoRender) {\n return;\n }\n this.autoRender = true;\n this.pluginService.register(new AutoRenderPlugin());\n }\n disableAutoRender() {\n if (!this.autoRender) {\n return;\n }\n this.autoRender = false;\n this.pluginService.findPluginsByName('AutoRenderPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableAutoRefresh() {\n if (this.autoRefresh) {\n return;\n }\n this.autoRefresh = true;\n this.pluginService.register(new AutoRefreshPlugin());\n }\n disableAutoRefresh() {\n if (!this.autoRefresh) {\n return;\n }\n this.autoRefresh = false;\n this.pluginService.findPluginsByName('AutoRefreshPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableIncrementalAutoRender() {\n if (this.increaseAutoRender) {\n return;\n }\n this.increaseAutoRender = true;\n this.pluginService.register(new IncrementalAutoRenderPlugin());\n }\n disableIncrementalAutoRender() {\n if (!this.increaseAutoRender) {\n return;\n }\n this.increaseAutoRender = false;\n this.pluginService.findPluginsByName('IncrementalAutoRenderPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableDirtyBounds() {\n if (this.dirtyBounds) {\n return;\n }\n this.dirtyBounds = new Bounds();\n let plugin = this.pluginService.findPluginsByName('DirtyBoundsPlugin')[0];\n if (!plugin) {\n plugin = new DirtyBoundsPlugin();\n this.pluginService.register(plugin);\n } else {\n plugin.activate(this.pluginService);\n }\n }\n disableDirtyBounds() {\n if (!this.dirtyBounds) {\n return;\n }\n this.dirtyBounds = null;\n this.pluginService.findPluginsByName('DirtyBoundsPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableLayout() {\n if (this._enableLayout) {\n return;\n }\n this._enableLayout = true;\n\n const FlexLayoutPlugin = Factory.getPlugin('FlexLayoutPlugin');\n\n if (FlexLayoutPlugin) {\n this.pluginService.register(new FlexLayoutPlugin());\n }\n }\n disableLayout() {\n if (!this._enableLayout) {\n return;\n }\n this._enableLayout = false;\n this.pluginService.findPluginsByName('FlexLayoutPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableHtmlAttribute(container?: any) {\n if (this.htmlAttribute) {\n return;\n }\n const HtmlAttributePlugin = Factory.getPlugin('HtmlAttributePlugin');\n\n if (HtmlAttributePlugin) {\n this.htmlAttribute = container;\n this.pluginService.register(new HtmlAttributePlugin());\n }\n }\n disableHtmlAttribute() {\n if (!this.htmlAttribute) {\n return;\n }\n this.htmlAttribute = false;\n this.pluginService.findPluginsByName('HtmlAttributePlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableReactAttribute(container?: any) {\n if (this.reactAttribute) {\n return;\n }\n const ReactAttributePlugin = Factory.getPlugin('ReactAttributePlugin');\n\n if (ReactAttributePlugin) {\n this.reactAttribute = container;\n this.pluginService.register(new ReactAttributePlugin());\n }\n }\n disableReactAttribute() {\n if (!this.reactAttribute) {\n return;\n }\n this.reactAttribute = false;\n this.pluginService.findPluginsByName('ReactAttributePlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n\n getPluginsByName(name: string): IPlugin[] {\n return this.pluginService.findPluginsByName(name);\n }\n\n // /**\n // * stage的appendChild,add\n // * @param node\n // * @returns\n // */\n // appendChild<T extends Node>(node: T): T | null {\n // const layer = this.at(0);\n // if (!layer) {\n // return null;\n // }\n // return layer.appendChild<T>(node);\n // }\n\n protected tryUpdateAABBBounds(): IAABBBounds {\n const viewBox = this.window.getViewBox();\n this._AABBBounds.setValue(viewBox.x1, viewBox.y1, viewBox.x2, viewBox.y2);\n return this._AABBBounds;\n }\n\n combineLayer(ILayer1: ILayer, ILayer2: ILayer): ILayer {\n throw new Error('暂不支持');\n }\n // 如果传入CanvasId,如果存在相同Id,说明这两个图层使用相同的Canvas绘制\n // 但需要注意的是依然是两个图层(用于解决Table嵌入ChartSpace不影响Table的绘制)\n createLayer(canvasId?: string, layerMode?: LayerMode): ILayer {\n if (this.releaseStatus === 'released') {\n return;\n }\n // 创建一个默认layer图层\n const layer = this.layerService.createLayer(this, {\n main: false,\n layerMode,\n canvasId\n });\n this.appendChild(layer);\n return layer;\n // const layer = new Layer(this, this.global, this.window, {\n // main: false,\n // canvasId\n // });\n // this.appendChild(layer);\n // return layer;\n }\n sortLayer(cb: (ILayer1: ILayer, layer2: ILayer) => number): void {\n const children = this.children;\n children.sort(cb);\n this.removeAllChild();\n children.forEach(c => {\n this.appendChild(c);\n });\n }\n removeLayer(ILayerId: number): ILayer | false {\n return this.removeChild(this.findChildByUid(ILayerId) as IGraphic) as ILayer;\n }\n tryInitInteractiveLayer() {\n if (this.releaseStatus === 'released') {\n return;\n }\n // TODO:顺序可能会存在问题\n // 支持交互层,且没有创建过,那就创建\n if (this.supportInteractiveLayer && !this.interactiveLayer) {\n this.interactiveLayer = this.createLayer();\n this.interactiveLayer.name = '_builtin_interactive';\n this.interactiveLayer.attribute.pickable = false;\n this.nextFrameRenderLayerSet.add(this.interactiveLayer as any); // to be fixed\n }\n // this.interactiveLayer.afterDraw(l => {\n // l.removeAllChild();\n // });\n }\n\n clearViewBox(color?: string) {\n this.window.clearViewBox(color);\n }\n\n render(layers?: ILayer[], params?: Partial<IDrawContext>): void {\n if (this.releaseStatus === 'released') {\n return;\n }\n this.startAnimate();\n const state = this.state;\n this.state = 'rendering';\n this.layerService.prepareStageLayer(this);\n if (!this._skipRender) {\n this.lastRenderparams = params;\n this.hooks.beforeRender.call(this);\n if (!this._skipRender) {\n this.renderLayerList(this.children as ILayer[]);\n this.combineLayersToWindow();\n this.nextFrameRenderLayerSet.clear();\n }\n this.hooks.afterRender.call(this);\n }\n this.state = state;\n this._skipRender && this._skipRender++;\n }\n\n protected combineLayersToWindow() {\n // TODO 后续支持通用的渲染模型\n if (this.global.env === 'harmony') {\n const ctx = this.window.getContext().nativeContext;\n this.forEachChildren<ILayer>((layer, i) => {\n if (i > 0) {\n const image = layer\n .getNativeHandler()\n .getContext()\n .canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();\n ctx.transferFromImageBitmap(image);\n }\n });\n }\n return;\n // this.forEach<ILayer>((layer, i) => {\n // layer.combineTo(this.window, {\n // clear: i === 0,\n // x: this.x,\n // y: this.y,\n // width: this.viewWidth,\n // height: this.viewHeight,\n // renderService: this.renderService,\n // background: layer === this.defaultLayer ? this.background : undefined,\n // updateBounds: !!this.dirtyBounds\n // });\n // });\n }\n\n renderNextFrame(layers?: ILayer[], force?: boolean): void {\n // render状态中调用的不会触发nextFrame,避免loop\n // if (this.state === 'rendering' && !force) {\n // console.log('abc');\n // return;\n // }\n // 性能优化,避免重复add\n if (this.nextFrameRenderLayerSet.size !== this.childrenCount) {\n (layers || this).forEach<ILayer>((layer: any) => {\n this.nextFrameRenderLayerSet.add(layer);\n });\n }\n if (!this.willNextFrameRender) {\n this.willNextFrameRender = true;\n this.global.getSpecifiedRequestAnimationFrame(this.rafId)(() => {\n this._doRenderInThisFrame(), (this.willNextFrameRender = false);\n });\n }\n }\n\n _doRenderInThisFrame() {\n if (this.releaseStatus === 'released') {\n return;\n }\n this.startAnimate();\n const state = this.state;\n this.state = 'rendering';\n this.layerService.prepareStageLayer(this);\n if (this.nextFrameRenderLayerSet.size && !this._skipRender) {\n this.hooks.beforeRender.call(this);\n if (!this._skipRender) {\n this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()), this.lastRenderparams || {});\n this.combineLayersToWindow();\n this.nextFrameRenderLayerSet.clear();\n }\n this.hooks.afterRender.call(this);\n }\n this.state = state;\n this._skipRender && this._skipRender++;\n }\n\n protected renderLayerList(layerList: ILayer[], params?: Partial<IDrawContext>) {\n const list: ILayer[] = [];\n // 只需要render main layer即可\n for (let i = 0; i < layerList.length; i++) {\n let l = layerList[i];\n if (l.layerMode === 'virtual') {\n l = l.getNativeHandler().mainHandler.layer;\n }\n if (!list.includes(l)) {\n list.push(l);\n }\n }\n list.forEach(layer => {\n // 记录当前的stamp,避免重复绘制layer(如果存在virtual layer)\n if (layer.renderCount > this.renderCount) {\n return;\n }\n layer.renderCount = this.renderCount + 1;\n\n if (layer === this.interactiveLayer) {\n // 交互层由于其特殊性,不使用dirtyBounds\n this.dirtyBounds && this.dirtyBounds.clear();\n }\n layer.render(\n {\n renderService: this.renderService,\n background: layer === this.defaultLayer ? this.background : undefined,\n updateBounds: !!(this.dirtyBounds && !this.dirtyBounds.empty()),\n viewBox: this.window.getViewBox(),\n transMatrix: this.window.getViewBoxTransform()\n },\n { renderStyle: this.renderStyle, ...params }\n );\n });\n\n // 添加交互层渲染\n if (this.interactiveLayer && !layerList.includes(this.interactiveLayer)) {\n // 交互层由于其特殊性,不使用dirtyBounds\n this.dirtyBounds && this.dirtyBounds.clear();\n this.interactiveLayer.render(\n {\n renderService: this.renderService,\n updateBounds: !!(this.dirtyBounds && !this.dirtyBounds.empty()),\n viewBox: this.window.getViewBox(),\n transMatrix: this.window.getViewBoxTransform()\n },\n { renderStyle: this.renderStyle, ...params }\n );\n }\n }\n\n resizeWindow(w: number, h: number, rerender: boolean = true) {\n this.window.resize(w, h);\n rerender && this.render();\n }\n\n /**\n * 语法糖,如果viewBox和window宽高一样的话,那么会同时缩放window和viewBox\n * @param w\n * @param h\n * @param rerender\n */\n resize(w: number, h: number, rerender: boolean = true): void {\n if (this.releaseStatus === 'released') {\n return;\n }\n // 如果不是子图的stage,那么认为用户也想要resize view\n if (!this.window.hasSubView()) {\n this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h);\n }\n this.window.resize(w, h);\n this.forEachChildren<ILayer>(c => {\n c.resize(w, h);\n });\n // 设置camera\n // this.camera && (this.camera.params = { ...this.camera.params, right: this.width, bottom: this.height });\n this.camera && this.option3d && this.set3dOptions(this.option3d);\n rerender && this.render();\n }\n resizeView(w: number, h: number, rerender: boolean = true) {\n if (this.releaseStatus === 'released') {\n return;\n }\n this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h);\n this.forEachChildren<ILayer>(c => {\n c.resizeView(w, h);\n });\n // 设置camera\n this.camera && (this.camera.params = { ...this.camera.params, right: this.width, bottom: this.height });\n rerender && this.render();\n }\n setViewBox(viewBox: IBoundsLike, rerender: boolean): void;\n setViewBox(x: number, y: number, w: number, h: number, rerender: boolean): void;\n setViewBox(x: number | IBoundsLike, y: number | boolean, w?: number, h?: number, rerender?: boolean): void {\n let isRerender: boolean = true;\n\n if (typeof x === 'object') {\n this.viewBox.setValue(x.x1, x.y1, x.x2, x.y2);\n if (y === false) {\n isRerender = false;\n }\n } else {\n this.viewBox.setValue(x, y as number, x + w, (y as number) + h);\n\n if (rerender === false) {\n isRerender = false;\n }\n }\n\n this.forEachChildren<ILayer>(c => {\n c.resizeView(this.viewBox.width(), this.viewBox.height());\n });\n isRerender && this.render();\n }\n setDpr(dpr: number, rerender: boolean = true): void {\n // this.window.setDpr(dpr);\n this.forEachChildren<ILayer>(c => {\n c.setDpr(dpr);\n });\n\n rerender && this.render();\n }\n setOrigin(x: number, y: number): void {\n throw new Error('暂不支持');\n }\n export(type: IExportType): HTMLCanvasElement | ImageData {\n throw new Error('暂不支持');\n }\n pick(x: number, y: number): PickResult | false {\n if (this.releaseStatus === 'released') {\n return;\n }\n // 暂时不提供layer的pick\n const result = this.getPickerService().pick(this.children as unknown as IGraphic[], new Point(x, y), {\n bounds: this.AABBBounds\n });\n if (result?.graphic || result?.group) {\n return result;\n }\n return false;\n }\n\n setToFrame(t: number): void {\n throw new Error('暂不支持');\n }\n\n release() {\n super.release();\n\n this.hooks.beforeRender.unTap('constructor', this.beforeRender);\n this.hooks.afterRender.unTap('constructor', this.afterRender);\n\n this.eventSystem && this.eventSystem.release();\n this.layerService.releaseStage(this);\n this.pluginService.release();\n this.forEach(layer => {\n layer.release();\n });\n // 额外删除掉interactiveLayer的节点\n if (this.interactiveLayer) {\n this.interactiveLayer.forEachChildren((item: IGraphic) => {\n item.setStage && item.setStage(null, null);\n this.interactiveLayer.removeChild(item);\n });\n this.interactiveLayer.release();\n }\n this.window.release();\n this._ticker?.remTimeline(this?.timeline);\n this._ticker?.removeListener('tick', this.afterTickCb);\n this.renderService.renderTreeRoots = [];\n }\n\n setStage(stage?: IStage) {\n return;\n // this.stage = this;\n // this.forEachChildren(item => {\n // (item as Layer).setStage(this);\n // });\n }\n\n /**\n * 添加dirty区域,会修改参数b\n * @param b\n * @param matrix\n */\n dirty(b: IBounds, matrix?: IMatrix) {\n if (this.releaseStatus === 'released') {\n return;\n }\n if (matrix) {\n b.transformWithMatrix(matrix);\n }\n if (this.dirtyBounds.empty()) {\n this.dirtyBounds.setValue(b.x1, b.y1, b.x2, b.y2);\n }\n this.dirtyBounds.union(b);\n }\n\n getLayer(name: string): undefined | ILayer {\n const layer = this.children.filter(layer => layer.name === name);\n return layer[0] as ILayer;\n }\n\n renderTo(window: IWindow) {\n if (this.releaseStatus === 'released') {\n return;\n }\n this.forEachChildren<ILayer>((layer, i) => {\n layer.drawTo(window, {\n // ...params,\n renderService: this.renderService,\n viewBox: window.getViewBox(),\n transMatrix: window.getViewBoxTransform(),\n background: layer === this.defaultLayer ? this.background : undefined,\n clear: i === 0, // 第一个layer需要clear\n updateBounds: !!(this.dirtyBounds && !this.dirtyBounds.empty())\n });\n });\n }\n\n /**\n * 渲染到新的window上去\n * @param fullImage 是否是全量的image,因为可能之前的window有一部分场景树超过window的帧缓冲了\n * @returns\n */\n renderToNewWindow(fullImage: boolean = true, viewBox?: IAABBBounds): IWindow {\n if (this.releaseStatus === 'released') {\n return;\n }\n const window = container.get<IWindow>(VWindow);\n const x1 = viewBox ? -viewBox.x1 : 0;\n const y1 = viewBox ? -viewBox.y1 : 0;\n const x2 = viewBox ? viewBox.x2 : this.viewWidth;\n const y2 = viewBox ? viewBox.y2 : this.viewHeight;\n const width = viewBox ? viewBox.width() : this.viewWidth;\n const height = viewBox ? viewBox.height() : this.viewHeight;\n if (fullImage) {\n window.create({\n viewBox: { x1, y1, x2, y2 },\n width,\n height,\n dpr: this.window.dpr,\n canvasControled: true,\n offscreen: true,\n title: ''\n });\n } else {\n window.create({\n viewBox: { x1, y1, x2, y2 },\n width,\n height,\n dpr: this.window.dpr,\n canvasControled: true,\n offscreen: true,\n title: ''\n });\n }\n\n this.renderTo(window);\n return window;\n }\n\n toCanvas(fullImage: boolean = true, viewBox?: IAABBBounds): HTMLCanvasElement | null {\n if (this.releaseStatus === 'released') {\n return;\n }\n const window = this.renderToNewWindow(fullImage, viewBox);\n const c = window.getNativeHandler();\n if (c.nativeCanvas) {\n return c.nativeCanvas;\n }\n return null;\n }\n\n setCursor(mode?: string): void {\n this._cursor = mode;\n this.eventSystem.setCursor(mode, 'ignore');\n }\n\n getCursor() {\n return this._cursor;\n }\n\n eventPointTransform(e: PointerEvent | WheelEvent | TouchEvent): { x: number; y: number } {\n const point = this.global.mapToCanvasPoint(e, this.window);\n\n return this.stage.window.pointTransform(point.x, point.y);\n }\n\n pauseTriggerEvent() {\n this._eventSystem && this._eventSystem.pauseTriggerEvent();\n }\n resumeTriggerEvent() {\n this._eventSystem && this._eventSystem.resumeTriggerEvent();\n }\n\n getPickerService() {\n if (!this.pickerService) {\n this.pickerService = container.get<IPickerService>(PickerService);\n }\n return this.pickerService;\n }\n\n reInit() {\n this.renderService.reInit();\n this.pickerService.reInit();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/stage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AA6B3D,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,aAA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,MAAM,EAAE,CAAC;IAC9B,CAAC;CACF","file":"stage.js","sourcesContent":["import type { IAABBBounds, IBounds, IBoundsLike, IMatrix } from '@visactor/vutils';\nimport { Bounds, Point, isString } from '@visactor/vutils';\nimport type {\n IGraphic,\n IExportType,\n IStage,\n IStageParams,\n ILayer,\n IColor,\n IGlobal,\n IOption3D,\n ICamera,\n vec3,\n IDirectionLight,\n ITicker,\n IRenderService,\n IPickerService,\n IPluginService,\n ISyncHook,\n IDrawContext,\n IWindow,\n ILayerService,\n ITimeline,\n IOptimizeType,\n LayerMode,\n PickResult,\n IPlugin,\n IGraphicService,\n IRenderServiceDrawParams\n} from '../interface';\nimport { VWindow } from './window';\nimport type { Layer } from './layer';\nimport { EventSystem } from '../event';\nimport { container } from '../container';\nimport { RenderService } from '../render';\nimport { Group } from '../graphic/group';\nimport { Theme } from '../graphic/theme';\nimport { PickerService } from '../picker/constants';\nimport { PluginService } from '../plugins/constants';\nimport { AutoRenderPlugin } from '../plugins/builtin-plugin/auto-render-plugin';\nimport { AutoRefreshPlugin } from '../plugins/builtin-plugin/auto-refresh-plugin';\nimport { IncrementalAutoRenderPlugin } from '../plugins/builtin-plugin/incremental-auto-render-plugin';\nimport { DirtyBoundsPlugin } from '../plugins/builtin-plugin/dirty-bounds-plugin';\nimport { SyncHook } from '../tapable';\nimport { LayerService } from './constants';\nimport { application } from '../application';\nimport { isBrowserEnv } from '../env-check';\nimport { Factory } from '../factory';\nimport { Graphic, GraphicService } from '../graphic';\n\nconst DefaultConfig = {\n WIDTH: 500,\n HEIGHT: 500,\n X: 0,\n Y: 0,\n BACKGROUND: 'white'\n};\n\ntype IStageState = 'rendering' | 'normal';\n\n/**\n * Stage是一个舞台或一个视口,并不直接对应一个或多个Canvas,逻辑上和Canvas无关\n *\n * 1. Stage对应一个Canvas的整体,Stage的宽高即为Canvas的宽高\n * 2. Stage小于Canvas,Stage作为Canvas某个区域的视口,只管理这个区域\n * 3. 多图层时Stage的多个图层对应多个Canvas\n *\n * 原生环境下Stage可以拥有一个Window或者使用Window的一块区域\n *\n * 【注】如果希望获取完整的Canvas或窗口或者调整窗口信息,请使用Window模块\n */\nexport class Stage extends Group implements IStage {\n declare parent: IStage | null;\n\n declare state: IStageState;\n\n private _background: string | IColor;\n protected nextFrameRenderLayerSet: Set<Layer>;\n protected willNextFrameRender: boolean;\n protected _cursor: string;\n renderCount: number;\n dirtyBounds: IBounds | null;\n option3d?: IOption3D;\n declare light?: IDirectionLight;\n declare camera?: ICamera;\n declare renderStyle?: string;\n\n declare hooks: {\n beforeRender: ISyncHook<[IStage]>;\n afterRender: ISyncHook<[IStage]>;\n afterClearScreen: ISyncHook<[IRenderServiceDrawParams]>;\n afterClearRect: ISyncHook<[IRenderServiceDrawParams]>;\n };\n\n set viewBox(b: IBoundsLike) {\n this.window.setViewBox(b);\n }\n get viewBox(): IAABBBounds {\n return this.window.getViewBox();\n }\n\n /**\n * @deprecated 不建议使用\n */\n get x(): number {\n return this.window.getViewBox().x1;\n }\n /**\n * @deprecated 不建议使用\n */\n set x(x: number) {\n const b = this.window.getViewBox();\n b.translate(x - b.x1, 0);\n this.window.setViewBox(b);\n }\n /**\n * @deprecated 不建议使用\n */\n get y(): number {\n return this.window.getViewBox().y1;\n }\n /**\n * @deprecated 不建议使用\n */\n set y(y: number) {\n const b = this.window.getViewBox();\n b.translate(0, y - b.y1);\n this.window.setViewBox(b);\n }\n get width(): number {\n return this.window.width;\n }\n set width(w: number) {\n this.resize(w, this.height);\n }\n get viewWidth(): number {\n return this.window.getViewBox().width();\n }\n set viewWidth(w: number) {\n this.resizeView(w, this.viewHeight);\n }\n get viewHeight(): number {\n return this.window.getViewBox().height();\n }\n set viewHeight(h: number) {\n this.resizeView(this.viewWidth, h);\n }\n get height(): number {\n return this.window.height;\n }\n set height(h: number) {\n this.resize(this.width, h);\n }\n get dpr(): number {\n return this.window.dpr;\n }\n set dpr(r: number) {\n this.setDpr(r);\n }\n get background(): string | IColor {\n return this._background ?? DefaultConfig.BACKGROUND;\n }\n set background(b: string | IColor) {\n this._background = b;\n }\n get defaultLayer(): ILayer {\n return this.at(0) as unknown as ILayer;\n }\n\n protected _ticker: ITicker;\n\n autoRender: boolean;\n autoRefresh: boolean;\n _enableLayout: boolean;\n htmlAttribute: boolean | string | any;\n reactAttribute: boolean | string | any;\n increaseAutoRender: boolean;\n view3dTranform: boolean;\n readonly window: IWindow;\n private readonly global: IGlobal;\n readonly renderService: IRenderService;\n protected pickerService?: IPickerService;\n readonly pluginService: IPluginService;\n readonly layerService: ILayerService;\n readonly graphicService: IGraphicService;\n private _eventSystem?: EventSystem;\n private get eventSystem(): EventSystem {\n return this._eventSystem;\n }\n\n protected _beforeRender?: (stage: IStage) => void;\n protected _afterRender?: (stage: IStage) => void;\n protected _afterClearScreen?: (drawParams: any) => void;\n protected _afterClearRect?: (drawParams: any) => void;\n // 0: 正常渲染, > 0: 跳过隐藏canvas的渲染, < 0: 禁止渲染\n protected _skipRender?: number;\n protected _afterNextRenderCbs?: ((stage: IStage) => void)[];\n protected lastRenderparams?: Partial<IDrawContext>;\n\n protected interactiveLayer?: ILayer;\n protected supportInteractiveLayer: boolean;\n protected timeline: ITimeline;\n\n declare params: Partial<IStageParams>;\n\n // 是否在render之前执行了tick,如果没有执行,尝试执行tick用来应用动画属性,避免动画过程中随意赋值然后又调用同步render导致属性的突变\n // 第一次render不需要强行走动画\n protected tickedBeforeRender: boolean = true;\n\n // 随机分配一个rafId\n readonly rafId: number;\n\n get ticker() {\n return this._ticker;\n }\n\n set ticker(ticker: ITicker) {\n ticker.bindStage(this);\n if (this._ticker) {\n this._ticker.removeListener('tick', this.afterTickCb);\n }\n ticker.addTimeline(this.timeline);\n this._ticker = ticker;\n this._ticker.on('tick', this.afterTickCb);\n }\n\n /**\n * 所有属性都具有默认值。\n * Canvas为字符串或者Canvas元素,那么默认图层就会绑定到这个Canvas上\n * 如果不传入Canvas,那么会新建一个Canvas,用户可以通过Window模块管理这个Canvas\n * 1. 如果没有传入宽高,那么默认为canvas宽高,如果传入了宽高则stage使用传入宽高作为视口宽高\n * @param params\n */\n constructor(params: Partial<IStageParams> = {}) {\n super({});\n this.params = params;\n this.theme = new Theme();\n this.hooks = {\n beforeRender: new SyncHook(['stage']),\n afterRender: new SyncHook(['stage']),\n afterClearScreen: new SyncHook(['stage']),\n afterClearRect: new SyncHook(['stage'])\n };\n this.global = application.global;\n if (!this.global.env && isBrowserEnv()) {\n // 如果是浏览器环境,默认设置env\n this.global.setEnv('browser');\n }\n this.window = container.get<IWindow>(VWindow);\n this.renderService = container.get<IRenderService>(RenderService);\n this.pluginService = container.get<IPluginService>(PluginService);\n this.layerService = container.get<ILayerService>(LayerService);\n this.graphicService = container.get<IGraphicService>(GraphicService);\n this.pluginService.active(this, params);\n\n this.window.create({\n width: params.width,\n height: params.height,\n viewBox: params.viewBox,\n container: params.container,\n dpr: params.dpr || this.global.devicePixelRatio,\n canvasControled: params.canvasControled !== false,\n title: params.title || '',\n canvas: params.canvas\n });\n\n this.state = 'normal';\n this.renderCount = 0;\n this.tryInitEventSystem();\n // // 没有传入xy就默认为0\n // this._x = params.x ?? DefaultConfig.X;\n // this._y = params.y ?? DefaultConfig.Y;\n // // 没有传入view的宽高则默认为window的宽高\n // this._viewWidth = params.viewWidth ?? this.window.width;\n // this._viewHeight = params.viewHeight ?? this.window.height;\n // this._AABBBounds.set(this._x, this._y, this._viewWidth + this._x, this._viewHeight + this._y);\n // 背景色默认为纯白色\n this._background = params.background ?? DefaultConfig.BACKGROUND;\n\n // 创建一个默认layer图层\n // this.appendChild(new Layer(this, this.global, this.window, { main: true }));\n this.appendChild(this.layerService.createLayer(this, { main: true }));\n\n this.nextFrameRenderLayerSet = new Set();\n this.willNextFrameRender = false;\n this.stage = this;\n this.renderStyle = params.renderStyle;\n\n // this.autoRender = params.autoRender;\n if (params.autoRender) {\n this.enableAutoRender();\n }\n if (params.autoRefresh) {\n this.enableAutoRefresh();\n }\n // 默认不开启dirtyBounds\n if (params.disableDirtyBounds === false) {\n this.enableDirtyBounds();\n }\n\n if (params.enableHtmlAttribute) {\n this.enableHtmlAttribute(params.enableHtmlAttribute);\n }\n if (params.ReactDOM) {\n this.enableReactAttribute(params.ReactDOM);\n }\n\n params.enableLayout && this.enableLayout();\n this.hooks.beforeRender.tap('constructor', this.beforeRender);\n this.hooks.afterRender.tap('constructor', this.afterRender);\n this.hooks.afterClearScreen.tap('constructor', this.afterClearScreen);\n this.hooks.afterClearRect.tap('constructor', this.afterClearRect);\n this._beforeRender = params.beforeRender;\n this._afterRender = params.afterRender;\n this._afterClearScreen = params.afterClearScreen;\n this._afterClearRect = params.afterClearRect;\n this.supportInteractiveLayer = params.interactiveLayer !== false;\n if (!params.optimize) {\n params.optimize = {\n tickRenderMode: 'effect'\n };\n }\n this.optmize(params.optimize);\n // 如果背景是图片,触发加载图片操作\n if (params.background && isString(this._background) && this._background.includes('/')) {\n this.setAttributes({ background: this._background });\n }\n\n this.initAnimate(params);\n this.rafId = params.rafId ?? Math.floor(Math.random() * 6);\n }\n\n initAnimate(params: Partial<IStageParams>) {\n if ((this as any).createTicker && (this as any).createTimeline) {\n this._ticker = params.ticker || (this as any).createTicker(this);\n this._ticker.bindStage(this);\n if (this.params.optimize?.tickRenderMode === 'performance') {\n this._ticker.setFPS(30);\n }\n this.timeline = (this as any).createTimeline();\n this._ticker.addTimeline(this.timeline);\n this._ticker.on('tick', this.afterTickCb);\n }\n }\n\n startAnimate() {\n if (this._ticker && this.timeline) {\n this._ticker.start();\n this.timeline.resume();\n }\n }\n\n pauseRender(sr: number = -1) {\n this._skipRender = sr;\n }\n\n resumeRender() {\n this._skipRender = 0;\n }\n\n protected tryInitEventSystem() {\n if (this.global.supportEvent && !this._eventSystem) {\n this._eventSystem = new EventSystem({\n targetElement: this.window,\n resolution: this.window.dpr || this.global.devicePixelRatio,\n rootNode: this as any,\n global: this.global,\n supportsPointerEvents: this.params.supportsPointerEvents,\n supportsTouchEvents: this.params.supportsTouchEvents,\n ...this.params.event\n });\n }\n }\n\n preventRender(prevent: boolean) {\n if (prevent) {\n this._skipRender = -Infinity;\n } else {\n // 判断是否需要outRange优化\n if (this.params.optimize.skipRenderWithOutRange !== false) {\n this._skipRender = this.window.isVisible() ? 0 : 1;\n } else {\n this._skipRender = 0;\n }\n }\n }\n\n // 优化策略\n optmize(params: IOptimizeType) {\n this.optmizeRender(params.skipRenderWithOutRange);\n this.params.optimize = params;\n }\n\n // 优化渲染\n protected optmizeRender(skipRenderWithOutRange: boolean = false) {\n if (!skipRenderWithOutRange) {\n return;\n }\n // 不在视口内的时候,跳过渲染\n this._skipRender = this._skipRender < 0 ? this._skipRender : this.window.isVisible() ? 0 : 1;\n this.window.onVisibleChange(this._onVisibleChange);\n }\n\n protected _onVisibleChange = (visible: boolean) => {\n if (this._skipRender < 0) {\n return;\n }\n if (visible) {\n if (this.dirtyBounds) {\n const b = this.window.getViewBox();\n this.dirtyBounds.setValue(b.x1, b.y1, b.width(), b.height());\n }\n if (this._skipRender > 1) {\n this.renderNextFrame();\n }\n this._skipRender = 0;\n } else {\n this._skipRender = 1;\n }\n };\n\n getTimeline() {\n return this.timeline;\n }\n\n get3dOptions(options: IOption3D) {\n const {\n center = { x: this.width / 2, y: this.height / 2, z: 0, dx: 0, dy: 0, dz: 0 },\n light = {},\n alpha = 0,\n beta = 0,\n camera,\n fieldRatio = 1,\n fieldDepth\n } = options;\n\n return {\n ...options,\n center,\n light,\n alpha,\n beta,\n camera,\n fieldRatio,\n fieldDepth\n };\n }\n\n set3dOptions(options: IOption3D) {\n this.option3d = options;\n const options3d = this.get3dOptions(options);\n const { light, center, camera, alpha, beta, fieldRatio, fieldDepth } = options3d;\n const { dir = [1, 1, -1], color = 'white', ambient } = light;\n\n const centerX = (center.x ?? this.width / 2) + (center.dx ?? 0);\n const centerY = (center.y ?? this.height / 2) + (center.dy ?? 0);\n const centerZ = (center.z ?? 0) + (center.dz ?? 0);\n const centerVec3: vec3 = [centerX, centerY, centerZ];\n const z = 1;\n let cameraX = 0;\n let cameraY = 0;\n let cameraZ = 0;\n if (!camera) {\n cameraX = Math.sin(alpha) + centerX;\n cameraY = Math.sin(beta) + centerY;\n cameraZ = Math.cos(alpha) * Math.cos(beta) * z;\n }\n\n const DirectionalLight = Factory.getPlugin('DirectionalLight');\n\n if (DirectionalLight) {\n this.light = new DirectionalLight(dir, color, ambient);\n }\n const cameraParams = {\n left: 0,\n right: this.width,\n top: 0,\n bottom: this.height,\n fieldRatio: fieldRatio,\n fieldDepth,\n viewParams: {\n pos: [cameraX, cameraY, cameraZ] as vec3,\n center: centerVec3,\n up: [0, 1, 0] as vec3\n }\n };\n if (this.camera) {\n this.camera.params = cameraParams;\n } else {\n const OrthoCamera = Factory.getPlugin('OrthoCamera');\n if (OrthoCamera) {\n this.camera = new OrthoCamera(cameraParams);\n }\n }\n\n if (options.enableView3dTransform) {\n this.enableView3dTransform();\n }\n }\n\n protected beforeRender = (stage: IStage) => {\n this._beforeRender && this._beforeRender(stage);\n };\n protected afterClearScreen = (drawParams: any) => {\n this._afterClearScreen && this._afterClearScreen(drawParams);\n };\n protected afterClearRect = (drawParams: any) => {\n this._afterClearRect && this._afterClearRect(drawParams);\n };\n\n protected afterRender = (stage: IStage) => {\n this.renderCount++;\n this._afterRender && this._afterRender(stage);\n this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage));\n this._afterNextRenderCbs = null;\n this.tickedBeforeRender = false;\n };\n\n protected afterTickCb = () => {\n this.tickedBeforeRender = true;\n // 性能模式不用立刻渲染\n this.state !== 'rendering' && this.renderNextFrame();\n };\n\n setBeforeRender(cb: (stage: IStage) => void) {\n this._beforeRender = cb;\n }\n\n setAfterRender(cb: (stage: IStage) => void) {\n this._afterRender = cb;\n }\n\n afterNextRender(cb: (stage: IStage) => void) {\n if (!this._afterNextRenderCbs) {\n this._afterNextRenderCbs = [];\n }\n this._afterNextRenderCbs.push(cb);\n }\n\n enableView3dTransform() {\n if (this.view3dTranform) {\n return;\n }\n this.view3dTranform = true;\n const ViewTransform3dPlugin = Factory.getPlugin('ViewTransform3dPlugin');\n\n if (ViewTransform3dPlugin) {\n this.pluginService.register(new ViewTransform3dPlugin());\n }\n }\n\n disableView3dTranform() {\n if (!this.view3dTranform) {\n return;\n }\n this.view3dTranform = false;\n this.pluginService.findPluginsByName('ViewTransform3dPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n\n enableAutoRender() {\n if (this.autoRender) {\n return;\n }\n this.autoRender = true;\n this.pluginService.register(new AutoRenderPlugin());\n }\n disableAutoRender() {\n if (!this.autoRender) {\n return;\n }\n this.autoRender = false;\n this.pluginService.findPluginsByName('AutoRenderPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableAutoRefresh() {\n if (this.autoRefresh) {\n return;\n }\n this.autoRefresh = true;\n this.pluginService.register(new AutoRefreshPlugin());\n }\n disableAutoRefresh() {\n if (!this.autoRefresh) {\n return;\n }\n this.autoRefresh = false;\n this.pluginService.findPluginsByName('AutoRefreshPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableIncrementalAutoRender() {\n if (this.increaseAutoRender) {\n return;\n }\n this.increaseAutoRender = true;\n this.pluginService.register(new IncrementalAutoRenderPlugin());\n }\n disableIncrementalAutoRender() {\n if (!this.increaseAutoRender) {\n return;\n }\n this.increaseAutoRender = false;\n this.pluginService.findPluginsByName('IncrementalAutoRenderPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableDirtyBounds() {\n if (this.dirtyBounds) {\n return;\n }\n this.dirtyBounds = new Bounds();\n let plugin = this.pluginService.findPluginsByName('DirtyBoundsPlugin')[0];\n if (!plugin) {\n plugin = new DirtyBoundsPlugin();\n this.pluginService.register(plugin);\n } else {\n plugin.activate(this.pluginService);\n }\n }\n disableDirtyBounds() {\n if (!this.dirtyBounds) {\n return;\n }\n this.dirtyBounds = null;\n this.pluginService.findPluginsByName('DirtyBoundsPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableLayout() {\n if (this._enableLayout) {\n return;\n }\n this._enableLayout = true;\n\n const FlexLayoutPlugin = Factory.getPlugin('FlexLayoutPlugin');\n\n if (FlexLayoutPlugin) {\n this.pluginService.register(new FlexLayoutPlugin());\n }\n }\n disableLayout() {\n if (!this._enableLayout) {\n return;\n }\n this._enableLayout = false;\n this.pluginService.findPluginsByName('FlexLayoutPlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableHtmlAttribute(container?: any) {\n if (this.htmlAttribute) {\n return;\n }\n const HtmlAttributePlugin = Factory.getPlugin('HtmlAttributePlugin');\n\n if (HtmlAttributePlugin) {\n this.htmlAttribute = container;\n this.pluginService.register(new HtmlAttributePlugin());\n }\n }\n disableHtmlAttribute() {\n if (!this.htmlAttribute) {\n return;\n }\n this.htmlAttribute = false;\n this.pluginService.findPluginsByName('HtmlAttributePlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n enableReactAttribute(container?: any) {\n if (this.reactAttribute) {\n return;\n }\n const ReactAttributePlugin = Factory.getPlugin('ReactAttributePlugin');\n\n if (ReactAttributePlugin) {\n this.reactAttribute = container;\n this.pluginService.register(new ReactAttributePlugin());\n }\n }\n disableReactAttribute() {\n if (!this.reactAttribute) {\n return;\n }\n this.reactAttribute = false;\n this.pluginService.findPluginsByName('ReactAttributePlugin').forEach(plugin => {\n this.pluginService.unRegister(plugin);\n });\n }\n\n getPluginsByName(name: string): IPlugin[] {\n return this.pluginService.findPluginsByName(name);\n }\n\n // /**\n // * stage的appendChild,add\n // * @param node\n // * @returns\n // */\n // appendChild<T extends Node>(node: T): T | null {\n // const layer = this.at(0);\n // if (!layer) {\n // return null;\n // }\n // return layer.appendChild<T>(node);\n // }\n\n protected tryUpdateAABBBounds(): IAABBBounds {\n const viewBox = this.window.getViewBox();\n this._AABBBounds.setValue(viewBox.x1, viewBox.y1, viewBox.x2, viewBox.y2);\n return this._AABBBounds;\n }\n\n combineLayer(ILayer1: ILayer, ILayer2: ILayer): ILayer {\n throw new Error('暂不支持');\n }\n // 如果传入CanvasId,如果存在相同Id,说明这两个图层使用相同的Canvas绘制\n // 但需要注意的是依然是两个图层(用于解决Table嵌入ChartSpace不影响Table的绘制)\n createLayer(canvasId?: string, layerMode?: LayerMode): ILayer {\n if (this.releaseStatus === 'released') {\n return;\n }\n // 创建一个默认layer图层\n const layer = this.layerService.createLayer(this, {\n main: false,\n layerMode,\n canvasId\n });\n this.appendChild(layer);\n return layer;\n // const layer = new Layer(this, this.global, this.window, {\n // main: false,\n // canvasId\n // });\n // this.appendChild(layer);\n // return layer;\n }\n sortLayer(cb: (ILayer1: ILayer, layer2: ILayer) => number): void {\n const children = this.children;\n children.sort(cb);\n this.removeAllChild();\n children.forEach(c => {\n this.appendChild(c);\n });\n }\n removeLayer(ILayerId: number): ILayer | false {\n return this.removeChild(this.findChildByUid(ILayerId) as IGraphic) as ILayer;\n }\n tryInitInteractiveLayer() {\n if (this.releaseStatus === 'released') {\n return;\n }\n // TODO:顺序可能会存在问题\n // 支持交互层,且没有创建过,那就创建\n if (this.supportInteractiveLayer && !this.interactiveLayer) {\n this.interactiveLayer = this.createLayer();\n this.interactiveLayer.name = '_builtin_interactive';\n this.interactiveLayer.attribute.pickable = false;\n this.nextFrameRenderLayerSet.add(this.interactiveLayer as any); // to be fixed\n }\n // this.interactiveLayer.afterDraw(l => {\n // l.removeAllChild();\n // });\n }\n\n clearViewBox(color?: string) {\n this.window.clearViewBox(color);\n }\n\n render(layers?: ILayer[], params?: Partial<IDrawContext>): void {\n if (this.releaseStatus === 'released') {\n return;\n }\n this.startAnimate();\n const state = this.state;\n this.state = 'rendering';\n this.layerService.prepareStageLayer(this);\n if (!this._skipRender) {\n this.lastRenderparams = params;\n this.hooks.beforeRender.call(this);\n if (!this._skipRender) {\n this.renderLayerList(this.children as ILayer[]);\n this.combineLayersToWindow();\n this.nextFrameRenderLayerSet.clear();\n }\n this.hooks.afterRender.call(this);\n }\n this.state = state;\n this._skipRender && this._skipRender++;\n }\n\n protected combineLayersToWindow() {\n // TODO 后续支持通用的渲染模型\n if (this.global.env === 'harmony') {\n const ctx = this.window.getContext().nativeContext;\n this.forEachChildren<ILayer>((layer, i) => {\n if (i > 0) {\n const image = layer\n .getNativeHandler()\n .getContext()\n .canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();\n ctx.transferFromImageBitmap(image);\n }\n });\n }\n return;\n // this.forEach<ILayer>((layer, i) => {\n // layer.combineTo(this.window, {\n // clear: i === 0,\n // x: this.x,\n // y: this.y,\n // width: this.viewWidth,\n // height: this.viewHeight,\n // renderService: this.renderService,\n // background: layer === this.defaultLayer ? this.background : undefined,\n // updateBounds: !!this.dirtyBounds\n // });\n // });\n }\n\n renderNextFrame(layers?: ILayer[], force?: boolean): void {\n // render状态中调用的不会触发nextFrame,避免loop\n // if (this.state === 'rendering' && !force) {\n // console.log('abc');\n // return;\n // }\n // 性能优化,避免重复add\n if (this.nextFrameRenderLayerSet.size !== this.childrenCount) {\n (layers || this).forEach<ILayer>((layer: any) => {\n this.nextFrameRenderLayerSet.add(layer);\n });\n }\n if (!this.willNextFrameRender) {\n this.willNextFrameRender = true;\n this.global.getSpecifiedRequestAnimationFrame(this.rafId)(() => {\n this._doRenderInThisFrame(), (this.willNextFrameRender = false);\n });\n }\n }\n\n _doRenderInThisFrame() {\n if (this.releaseStatus === 'released') {\n return;\n }\n this.startAnimate();\n const state = this.state;\n this.state = 'rendering';\n this.layerService.prepareStageLayer(this);\n if (this.nextFrameRenderLayerSet.size && !this._skipRender) {\n this.hooks.beforeRender.call(this);\n if (!this._skipRender) {\n this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()), this.lastRenderparams || {});\n this.combineLayersToWindow();\n this.nextFrameRenderLayerSet.clear();\n }\n this.hooks.afterRender.call(this);\n }\n this.state = state;\n this._skipRender && this._skipRender++;\n }\n\n protected renderLayerList(layerList: ILayer[], params?: Partial<IDrawContext>) {\n const list: ILayer[] = [];\n // 只需要render main layer即可\n for (let i = 0; i < layerList.length; i++) {\n let l = layerList[i];\n if (l.layerMode === 'virtual') {\n l = l.getNativeHandler().mainHandler.layer;\n }\n if (!list.includes(l)) {\n list.push(l);\n }\n }\n list.forEach(layer => {\n // 记录当前的stamp,避免重复绘制layer(如果存在virtual layer)\n if (layer.renderCount > this.renderCount) {\n return;\n }\n layer.renderCount = this.renderCount + 1;\n\n if (layer === this.interactiveLayer) {\n // 交互层由于其特殊性,不使用dirtyBounds\n this.dirtyBounds && this.dirtyBounds.clear();\n }\n layer.render(\n {\n renderService: this.renderService,\n background: layer === this.defaultLayer ? this.background : undefined,\n updateBounds: !!(this.dirtyBounds && !this.dirtyBounds.empty()),\n viewBox: this.window.getViewBox(),\n transMatrix: this.window.getViewBoxTransform()\n },\n { renderStyle: this.renderStyle, ...params }\n );\n });\n\n // 添加交互层渲染\n if (this.interactiveLayer && !layerList.includes(this.interactiveLayer)) {\n // 交互层由于其特殊性,不使用dirtyBounds\n this.dirtyBounds && this.dirtyBounds.clear();\n this.interactiveLayer.render(\n {\n renderService: this.renderService,\n updateBounds: !!(this.dirtyBounds && !this.dirtyBounds.empty()),\n viewBox: this.window.getViewBox(),\n transMatrix: this.window.getViewBoxTransform()\n },\n { renderStyle: this.renderStyle, ...params }\n );\n }\n }\n\n resizeWindow(w: number, h: number, rerender: boolean = true) {\n this.window.resize(w, h);\n rerender && this.render();\n }\n\n /**\n * 语法糖,如果viewBox和window宽高一样的话,那么会同时缩放window和viewBox\n * @param w\n * @param h\n * @param rerender\n */\n resize(w: number, h: number, rerender: boolean = true): void {\n if (this.releaseStatus === 'released') {\n return;\n }\n // 如果不是子图的stage,那么认为用户也想要resize view\n if (!this.window.hasSubView()) {\n this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h);\n }\n this.window.resize(w, h);\n this.forEachChildren<ILayer>(c => {\n c.resize(w, h);\n });\n // 设置camera\n // this.camera && (this.camera.params = { ...this.camera.params, right: this.width, bottom: this.height });\n this.camera && this.option3d && this.set3dOptions(this.option3d);\n rerender && this.render();\n }\n resizeView(w: number, h: number, rerender: boolean = true) {\n if (this.releaseStatus === 'released') {\n return;\n }\n this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h);\n this.forEachChildren<ILayer>(c => {\n c.resizeView(w, h);\n });\n // 设置camera\n this.camera && (this.camera.params = { ...this.camera.params, right: this.width, bottom: this.height });\n rerender && this.render();\n }\n setViewBox(viewBox: IBoundsLike, rerender: boolean): void;\n setViewBox(x: number, y: number, w: number, h: number, rerender: boolean): void;\n setViewBox(x: number | IBoundsLike, y: number | boolean, w?: number, h?: number, rerender?: boolean): void {\n let isRerender: boolean = true;\n\n if (typeof x === 'object') {\n this.viewBox.setValue(x.x1, x.y1, x.x2, x.y2);\n if (y === false) {\n isRerender = false;\n }\n } else {\n this.viewBox.setValue(x, y as number, x + w, (y as number) + h);\n\n if (rerender === false) {\n isRerender = false;\n }\n }\n\n this.forEachChildren<ILayer>(c => {\n c.resizeView(this.viewBox.width(), this.viewBox.height());\n });\n isRerender && this.render();\n }\n setDpr(dpr: number, rerender: boolean = true): void {\n // this.window.setDpr(dpr);\n this.forEachChildren<ILayer>(c => {\n c.setDpr(dpr);\n });\n\n rerender && this.render();\n }\n setOrigin(x: number, y: number): void {\n throw new Error('暂不支持');\n }\n export(type: IExportType): HTMLCanvasElement | ImageData {\n throw new Error('暂不支持');\n }\n pick(x: number, y: number): PickResult | false {\n if (this.releaseStatus === 'released') {\n return;\n }\n // 暂时不提供layer的pick\n const result = this.getPickerService().pick(this.children as unknown as IGraphic[], new Point(x, y), {\n bounds: this.AABBBounds\n });\n if (result?.graphic || result?.group) {\n return result;\n }\n return false;\n }\n\n setToFrame(t: number): void {\n throw new Error('暂不支持');\n }\n\n release() {\n super.release();\n\n this.hooks.beforeRender.unTap('constructor', this.beforeRender);\n this.hooks.afterRender.unTap('constructor', this.afterRender);\n\n this.eventSystem && this.eventSystem.release();\n this.layerService.releaseStage(this);\n this.pluginService.release();\n this.forEach(layer => {\n layer.release();\n });\n // 额外删除掉interactiveLayer的节点\n if (this.interactiveLayer) {\n this.interactiveLayer.forEachChildren((item: IGraphic) => {\n item.setStage && item.setStage(null, null);\n this.interactiveLayer.removeChild(item);\n });\n this.interactiveLayer.release();\n }\n this.window.release();\n this._ticker?.remTimeline(this?.timeline);\n this._ticker?.removeListener('tick', this.afterTickCb);\n this.renderService.renderTreeRoots = [];\n }\n\n setStage(stage?: IStage) {\n return;\n // this.stage = this;\n // this.forEachChildren(item => {\n // (item as Layer).setStage(this);\n // });\n }\n\n /**\n * 添加dirty区域,会修改参数b\n * @param b\n * @param matrix\n */\n dirty(b: IBounds, matrix?: IMatrix) {\n if (this.releaseStatus === 'released') {\n return;\n }\n if (matrix) {\n b.transformWithMatrix(matrix);\n }\n if (this.dirtyBounds.empty()) {\n this.dirtyBounds.setValue(b.x1, b.y1, b.x2, b.y2);\n }\n this.dirtyBounds.union(b);\n }\n\n getLayer(name: string): undefined | ILayer {\n const layer = this.children.filter(layer => layer.name === name);\n return layer[0] as ILayer;\n }\n\n renderTo(window: IWindow) {\n if (this.releaseStatus === 'released') {\n return;\n }\n this.forEachChildren<ILayer>((layer, i) => {\n layer.drawTo(window, {\n // ...params,\n renderService: this.renderService,\n viewBox: window.getViewBox(),\n transMatrix: window.getViewBoxTransform(),\n background: layer === this.defaultLayer ? this.background : undefined,\n clear: i === 0, // 第一个layer需要clear\n updateBounds: !!(this.dirtyBounds && !this.dirtyBounds.empty())\n });\n });\n }\n\n /**\n * 渲染到新的window上去\n * @param fullImage 是否是全量的image,因为可能之前的window有一部分场景树超过window的帧缓冲了\n * @returns\n */\n renderToNewWindow(fullImage: boolean = true, viewBox?: IAABBBounds): IWindow {\n if (this.releaseStatus === 'released') {\n return;\n }\n const window = container.get<IWindow>(VWindow);\n const x1 = viewBox ? -viewBox.x1 : 0;\n const y1 = viewBox ? -viewBox.y1 : 0;\n const x2 = viewBox ? viewBox.x2 : this.viewWidth;\n const y2 = viewBox ? viewBox.y2 : this.viewHeight;\n const width = viewBox ? viewBox.width() : this.viewWidth;\n const height = viewBox ? viewBox.height() : this.viewHeight;\n if (fullImage) {\n window.create({\n viewBox: { x1, y1, x2, y2 },\n width,\n height,\n dpr: this.window.dpr,\n canvasControled: true,\n offscreen: true,\n title: ''\n });\n } else {\n window.create({\n viewBox: { x1, y1, x2, y2 },\n width,\n height,\n dpr: this.window.dpr,\n canvasControled: true,\n offscreen: true,\n title: ''\n });\n }\n\n this.renderTo(window);\n return window;\n }\n\n toCanvas(fullImage: boolean = true, viewBox?: IAABBBounds): HTMLCanvasElement | null {\n if (this.releaseStatus === 'released') {\n return;\n }\n const window = this.renderToNewWindow(fullImage, viewBox);\n const c = window.getNativeHandler();\n if (c.nativeCanvas) {\n return c.nativeCanvas;\n }\n return null;\n }\n\n setCursor(mode?: string): void {\n this._cursor = mode;\n this.eventSystem.setCursor(mode, 'ignore');\n }\n\n getCursor() {\n return this._cursor;\n }\n\n eventPointTransform(e: PointerEvent | WheelEvent | TouchEvent): { x: number; y: number } {\n const point = this.global.mapToCanvasPoint(e, this.window);\n\n return this.stage.window.pointTransform(point.x, point.y);\n }\n\n pauseTriggerEvent() {\n this._eventSystem && this._eventSystem.pauseTriggerEvent();\n }\n resumeTriggerEvent() {\n this._eventSystem && this._eventSystem.resumeTriggerEvent();\n }\n\n getPickerService() {\n if (!this.pickerService) {\n this.pickerService = container.get<IPickerService>(PickerService);\n }\n return this.pickerService;\n }\n\n reInit() {\n this.renderService.reInit();\n this.pickerService.reInit();\n }\n}\n"]}
|
package/es/interface/stage.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export interface IStageParams {
|
|
|
40
40
|
beforeRender: (stage: IStage) => void;
|
|
41
41
|
afterRender: (stage: IStage) => void;
|
|
42
42
|
afterClearScreen: (drawParams: any) => void;
|
|
43
|
+
afterClearRect: (drawParams: any) => void;
|
|
43
44
|
renderStyle?: string;
|
|
44
45
|
ticker?: ITicker;
|
|
45
46
|
pluginList?: string[];
|
|
@@ -101,6 +102,7 @@ export interface IStage extends INode {
|
|
|
101
102
|
beforeRender: ISyncHook<[IStage]>;
|
|
102
103
|
afterRender: ISyncHook<[IStage]>;
|
|
103
104
|
afterClearScreen: ISyncHook<[IRenderServiceDrawParams]>;
|
|
105
|
+
afterClearRect: ISyncHook<[IRenderServiceDrawParams]>;
|
|
104
106
|
};
|
|
105
107
|
option3d?: IOption3D;
|
|
106
108
|
set3dOptions: (options: IOption3D) => void;
|