@visactor/vrender-core 1.0.9-alpha.2 → 1.0.10
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/graphic/glyph.js +1 -6
- package/cjs/graphic/glyph.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 -12
- 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/graphic/glyph.js +1 -6
- package/es/graphic/glyph.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,IA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C9C,KAAK,IAAI,CAAC,OAAO,CAAC,WAAW,GAAG,MAAC,KAAa,CAAC,SAAS,CAAC,OAAO,mCAAI,CAAC,CAAC,CAAC;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;q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I,CAAC,CAAC,CAAC;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;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
|
@@ -14611,10 +14611,6 @@ class Glyph extends Graphic {
|
|
|
14611
14611
|
}
|
|
14612
14612
|
}
|
|
14613
14613
|
});
|
|
14614
|
-
this.subGraphic.forEach((graphic, index) => {
|
|
14615
|
-
graphic.updateNormalAttrs(subAttrs[index]);
|
|
14616
|
-
graphic.applyStateAttrs(subAttrs[index], states, hasAnimation);
|
|
14617
|
-
});
|
|
14618
14614
|
this.updateNormalAttrs(stateAttrs);
|
|
14619
14615
|
this.currentStates = states;
|
|
14620
14616
|
this.applyStateAttrs(stateAttrs, states, hasAnimation);
|
|
@@ -14623,10 +14619,6 @@ class Glyph extends Graphic {
|
|
|
14623
14619
|
this.stopStateAnimates();
|
|
14624
14620
|
if (this.hasState() && this.normalAttrs) {
|
|
14625
14621
|
this.currentStates = [];
|
|
14626
|
-
this.subGraphic.forEach(graphic => {
|
|
14627
|
-
graphic.applyStateAttrs(graphic.normalAttrs, this.currentStates, hasAnimation, true);
|
|
14628
|
-
graphic.normalAttrs = null;
|
|
14629
|
-
});
|
|
14630
14622
|
this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, true);
|
|
14631
14623
|
}
|
|
14632
14624
|
else {
|
|
@@ -21850,7 +21842,7 @@ let DefaultDrawContribution = class DefaultDrawContribution {
|
|
|
21850
21842
|
return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
|
|
21851
21843
|
}
|
|
21852
21844
|
clearScreen(renderService, context, drawContext) {
|
|
21853
|
-
var _a, _b;
|
|
21845
|
+
var _a, _b, _c;
|
|
21854
21846
|
const { clear, viewBox } = drawContext;
|
|
21855
21847
|
const x = 0;
|
|
21856
21848
|
const y = 0;
|
|
@@ -21858,8 +21850,11 @@ let DefaultDrawContribution = class DefaultDrawContribution {
|
|
|
21858
21850
|
const height = viewBox.height();
|
|
21859
21851
|
if (clear) {
|
|
21860
21852
|
context.clearRect(x, y, width, height);
|
|
21861
|
-
|
|
21862
|
-
|
|
21853
|
+
if ((_a = renderService.drawParams) === null || _a === void 0 ? void 0 : _a.stage) {
|
|
21854
|
+
renderService.drawParams.stage.hooks.afterClearRect.call(renderService.drawParams);
|
|
21855
|
+
}
|
|
21856
|
+
const stage = (_b = renderService.drawParams) === null || _b === void 0 ? void 0 : _b.stage;
|
|
21857
|
+
stage && (context.globalAlpha = (_c = stage.attribute.opacity) !== null && _c !== void 0 ? _c : 1);
|
|
21863
21858
|
if (stage && stage.backgroundImg && stage.resources) {
|
|
21864
21859
|
const res = stage.resources.get(clear);
|
|
21865
21860
|
if (res && res.state === 'success' && res.data) {
|
|
@@ -22678,6 +22673,9 @@ class Stage extends Group {
|
|
|
22678
22673
|
this.afterClearScreen = (drawParams) => {
|
|
22679
22674
|
this._afterClearScreen && this._afterClearScreen(drawParams);
|
|
22680
22675
|
};
|
|
22676
|
+
this.afterClearRect = (drawParams) => {
|
|
22677
|
+
this._afterClearRect && this._afterClearRect(drawParams);
|
|
22678
|
+
};
|
|
22681
22679
|
this.afterRender = (stage) => {
|
|
22682
22680
|
this.renderCount++;
|
|
22683
22681
|
this._afterRender && this._afterRender(stage);
|
|
@@ -22694,7 +22692,8 @@ class Stage extends Group {
|
|
|
22694
22692
|
this.hooks = {
|
|
22695
22693
|
beforeRender: new SyncHook(['stage']),
|
|
22696
22694
|
afterRender: new SyncHook(['stage']),
|
|
22697
|
-
afterClearScreen: new SyncHook(['stage'])
|
|
22695
|
+
afterClearScreen: new SyncHook(['stage']),
|
|
22696
|
+
afterClearRect: new SyncHook(['stage'])
|
|
22698
22697
|
};
|
|
22699
22698
|
this.global = application.global;
|
|
22700
22699
|
if (!this.global.env && isBrowserEnv()) {
|
|
@@ -22744,9 +22743,11 @@ class Stage extends Group {
|
|
|
22744
22743
|
this.hooks.beforeRender.tap('constructor', this.beforeRender);
|
|
22745
22744
|
this.hooks.afterRender.tap('constructor', this.afterRender);
|
|
22746
22745
|
this.hooks.afterClearScreen.tap('constructor', this.afterClearScreen);
|
|
22746
|
+
this.hooks.afterClearRect.tap('constructor', this.afterClearRect);
|
|
22747
22747
|
this._beforeRender = params.beforeRender;
|
|
22748
22748
|
this._afterRender = params.afterRender;
|
|
22749
22749
|
this._afterClearScreen = params.afterClearScreen;
|
|
22750
|
+
this._afterClearRect = params.afterClearRect;
|
|
22750
22751
|
this.supportInteractiveLayer = params.interactiveLayer !== false;
|
|
22751
22752
|
if (!params.optimize) {
|
|
22752
22753
|
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({
|