@visactor/vrender-core 0.23.0-alpha.2 → 0.23.0-alpha.3

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.
Files changed (96) hide show
  1. package/cjs/canvas/empty-context.d.ts +1 -0
  2. package/cjs/canvas/empty-context.js +4 -0
  3. package/cjs/canvas/empty-context.js.map +1 -1
  4. package/cjs/color-string/index.js +2 -1
  5. package/cjs/common/enums.js +1 -2
  6. package/cjs/common/path-svg.js +2 -1
  7. package/cjs/common/performance-raf.d.ts +2 -0
  8. package/cjs/common/performance-raf.js +8 -3
  9. package/cjs/common/performance-raf.js.map +1 -1
  10. package/cjs/common/store.js +1 -2
  11. package/cjs/core/global.d.ts +3 -0
  12. package/cjs/core/global.js +13 -3
  13. package/cjs/core/global.js.map +1 -1
  14. package/cjs/core/stage.d.ts +1 -0
  15. package/cjs/core/stage.js +7 -6
  16. package/cjs/core/stage.js.map +1 -1
  17. package/cjs/graphic/graphic.js.map +1 -1
  18. package/cjs/interface/context.d.ts +1 -0
  19. package/cjs/interface/context.js.map +1 -1
  20. package/cjs/interface/global.d.ts +2 -0
  21. package/cjs/interface/global.js.map +1 -1
  22. package/cjs/interface/graphic.d.ts +1 -1
  23. package/cjs/interface/graphic.js.map +1 -1
  24. package/cjs/interface/render.d.ts +6 -0
  25. package/cjs/interface/render.js.map +1 -1
  26. package/cjs/interface/stage.d.ts +1 -1
  27. package/cjs/interface/stage.js.map +1 -1
  28. package/cjs/render/contributions/render/arc-render.d.ts +4 -2
  29. package/cjs/render/contributions/render/arc-render.js +19 -17
  30. package/cjs/render/contributions/render/arc-render.js.map +1 -1
  31. package/cjs/render/contributions/render/base-render.d.ts +2 -2
  32. package/cjs/render/contributions/render/base-render.js +2 -2
  33. package/cjs/render/contributions/render/base-render.js.map +1 -1
  34. package/cjs/render/contributions/render/draw-contribution.d.ts +1 -0
  35. package/cjs/render/contributions/render/draw-contribution.js +23 -19
  36. package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
  37. package/cjs/render/contributions/render/draw-interceptor.js +1 -0
  38. package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
  39. package/cjs/render/contributions/render/group-render.d.ts +2 -2
  40. package/cjs/render/contributions/render/group-render.js +14 -10
  41. package/cjs/render/contributions/render/group-render.js.map +1 -1
  42. package/cjs/render/contributions/render/rect-render.d.ts +3 -1
  43. package/cjs/render/contributions/render/rect-render.js +17 -15
  44. package/cjs/render/contributions/render/rect-render.js.map +1 -1
  45. package/cjs/render/contributions/render/symbol-render.d.ts +4 -2
  46. package/cjs/render/contributions/render/symbol-render.js +16 -11
  47. package/cjs/render/contributions/render/symbol-render.js.map +1 -1
  48. package/dist/index.es.js +222 -172
  49. package/es/canvas/empty-context.d.ts +1 -0
  50. package/es/canvas/empty-context.js +4 -0
  51. package/es/canvas/empty-context.js.map +1 -1
  52. package/es/color-string/index.js +2 -1
  53. package/es/common/enums.js +1 -2
  54. package/es/common/path-svg.js +2 -1
  55. package/es/common/performance-raf.d.ts +2 -0
  56. package/es/common/performance-raf.js +8 -3
  57. package/es/common/performance-raf.js.map +1 -1
  58. package/es/common/store.js +1 -2
  59. package/es/core/global.d.ts +3 -0
  60. package/es/core/global.js +14 -2
  61. package/es/core/global.js.map +1 -1
  62. package/es/core/stage.d.ts +1 -0
  63. package/es/core/stage.js +7 -6
  64. package/es/core/stage.js.map +1 -1
  65. package/es/graphic/graphic.js.map +1 -1
  66. package/es/interface/context.d.ts +1 -0
  67. package/es/interface/context.js.map +1 -1
  68. package/es/interface/global.d.ts +2 -0
  69. package/es/interface/global.js.map +1 -1
  70. package/es/interface/graphic.d.ts +1 -1
  71. package/es/interface/graphic.js.map +1 -1
  72. package/es/interface/render.d.ts +6 -0
  73. package/es/interface/render.js.map +1 -1
  74. package/es/interface/stage.d.ts +1 -1
  75. package/es/interface/stage.js.map +1 -1
  76. package/es/render/contributions/render/arc-render.d.ts +4 -2
  77. package/es/render/contributions/render/arc-render.js +19 -17
  78. package/es/render/contributions/render/arc-render.js.map +1 -1
  79. package/es/render/contributions/render/base-render.d.ts +2 -2
  80. package/es/render/contributions/render/base-render.js +2 -2
  81. package/es/render/contributions/render/base-render.js.map +1 -1
  82. package/es/render/contributions/render/draw-contribution.d.ts +1 -0
  83. package/es/render/contributions/render/draw-contribution.js +23 -19
  84. package/es/render/contributions/render/draw-contribution.js.map +1 -1
  85. package/es/render/contributions/render/draw-interceptor.js +1 -0
  86. package/es/render/contributions/render/draw-interceptor.js.map +1 -1
  87. package/es/render/contributions/render/group-render.d.ts +2 -2
  88. package/es/render/contributions/render/group-render.js +14 -10
  89. package/es/render/contributions/render/group-render.js.map +1 -1
  90. package/es/render/contributions/render/rect-render.d.ts +3 -1
  91. package/es/render/contributions/render/rect-render.js +17 -14
  92. package/es/render/contributions/render/rect-render.js.map +1 -1
  93. package/es/render/contributions/render/symbol-render.d.ts +4 -2
  94. package/es/render/contributions/render/symbol-render.js +16 -11
  95. package/es/render/contributions/render/symbol-render.js.map +1 -1
  96. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/base-render.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,sCAAsC,EAAE,uCAAuC,EAAE,MAAM,iBAAiB,CAAC;AAElH,MAAM,MAAM,GAAsD,EAAE,CAAC,EAAE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AAC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE;YACnE,OAAO,CAAC,sBAAsB,EAAE,CAAC;YACjC,OAAO;SACR;QAED,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QAC5D,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QAEX,IAAI,OAAO,CAAC,WAAW,KAAK,eAAe,EAAE;YAC3C,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACxC;QACD,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;QAEtC,OAAO,CAAC,sBAAsB,EAAE,CAAC;IACnC,CAAC;CAsHF","file":"base-render.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\nimport type {\n IGraphicAttribute,\n ICamera,\n IContext2d,\n IGraphic,\n mat4,\n IDrawContext,\n IGraphicRenderDrawParams,\n IMarkAttribute,\n IThemeAttribute,\n IContributionProvider,\n IBaseRenderContribution,\n ITransform\n} from '../../../interface';\nimport { getModelMatrix, shouldUseMat4 } from '../../../graphic/graphic-service/graphic-service';\nimport { mat4Allocate } from '../../../allocator/matrix-allocate';\nimport { fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { multiplyMat4Mat4 } from '../../../common/matrix';\nimport { getTheme } from '../../../graphic';\nimport { renderCommandList } from '../../../common/render-command-list';\nimport { defaultBaseClipRenderAfterContribution, defaultBaseClipRenderBeforeContribution } from './contributions';\n\nconst result: IPointLike & { z: number; lastModelMatrix: mat4 } = { x: 0, y: 0, z: 0, lastModelMatrix: null };\n\nexport abstract class BaseRender<T extends IGraphic> {\n camera: ICamera;\n declare z: number;\n\n builtinContributions: IBaseRenderContribution<T, T['attribute']>[];\n\n // declare renderContribitions: IContributionProvider<IBaseRenderContribution<T, T['attribute']>> | null;\n\n protected _beforeRenderContribitions: IBaseRenderContribution<T, T['attribute']>[];\n protected _afterRenderContribitions: IBaseRenderContribution<T, T['attribute']>[];\n protected _renderContribitions: IBaseRenderContribution<T, T['attribute']>[];\n\n init(contributions?: IContributionProvider<IBaseRenderContribution<T, T['attribute']>>) {\n if (contributions) {\n // this.renderContribitions = contributions;\n this._renderContribitions = contributions.getContributions();\n }\n if (!this._renderContribitions) {\n this._renderContribitions = [];\n }\n if (!this.builtinContributions) {\n this.builtinContributions = [];\n }\n this.builtinContributions.push(defaultBaseClipRenderBeforeContribution);\n this.builtinContributions.push(defaultBaseClipRenderAfterContribution);\n this.builtinContributions.forEach(item => this._renderContribitions.push(item));\n if (this._renderContribitions.length) {\n this._renderContribitions.sort((a, b) => b.order - a.order);\n this._beforeRenderContribitions = this._renderContribitions.filter(\n c => c.time === BaseRenderContributionTime.beforeFillStroke\n );\n this._afterRenderContribitions = this._renderContribitions.filter(\n c => c.time === BaseRenderContributionTime.afterFillStroke\n );\n }\n }\n\n beforeRenderStep(\n graphic: T,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<T['attribute']>,\n drawContext: IDrawContext,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n params?: any\n ) {\n this._beforeRenderContribitions &&\n this._beforeRenderContribitions.forEach(c => {\n if (\n c.supportedAppName &&\n graphic.stage &&\n graphic.stage.params &&\n graphic.stage.params.context &&\n graphic.stage.params.context.appName\n ) {\n const names = Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName];\n if (!names.includes(graphic.stage.params.context.appName)) {\n return;\n }\n }\n c.drawShape(\n graphic,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n graphicAttribute,\n drawContext,\n fillCb,\n strokeCb,\n params\n );\n });\n }\n\n afterRenderStep(\n graphic: T,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<T['attribute']>,\n drawContext: IDrawContext,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n params?: any\n ) {\n this._afterRenderContribitions &&\n this._afterRenderContribitions.forEach(c => {\n if (\n c.supportedAppName &&\n graphic.stage &&\n graphic.stage.params &&\n graphic.stage.params.context &&\n graphic.stage.params.context.appName\n ) {\n const names = Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName];\n if (!names.includes(graphic.stage.params.context.appName)) {\n return;\n }\n }\n c.drawShape(\n graphic,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n graphicAttribute,\n drawContext,\n fillCb,\n strokeCb,\n params\n );\n });\n }\n\n drawPathProxy(\n graphic: T,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n if (!graphic.pathProxy) {\n return false;\n }\n\n const themeAttributes = (getTheme(graphic, params?.theme) as any)[graphic.type.replace('3d', '')];\n\n const {\n fill = themeAttributes.fill,\n stroke = themeAttributes.stroke,\n opacity = themeAttributes.opacity,\n fillOpacity = themeAttributes.fillOpacity,\n lineWidth = themeAttributes.lineWidth,\n strokeOpacity = themeAttributes.strokeOpacity,\n visible = themeAttributes.visible,\n x: originX = themeAttributes.x,\n y: originY = themeAttributes.y\n } = graphic.attribute;\n // 不绘制或者透明\n const fVisible = fillVisible(opacity, fillOpacity, fill);\n const sVisible = strokeVisible(opacity, strokeOpacity);\n const doFill = runFill(fill);\n const doStroke = runStroke(stroke, lineWidth);\n\n if (!visible) {\n return true;\n }\n\n if (!(doFill || doStroke)) {\n return true;\n }\n\n // 如果存在fillCb和strokeCb,那就不直接跳过\n if (!(fVisible || sVisible || fillCb || strokeCb)) {\n return true;\n }\n\n context.beginPath();\n const path = typeof graphic.pathProxy === 'function' ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;\n renderCommandList(path.commandList, context, x, y);\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(graphic, graphic.attribute, themeAttributes);\n\n this.beforeRenderStep(\n graphic,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n themeAttributes,\n drawContext,\n fillCb,\n strokeCb\n );\n\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, graphic.attribute, themeAttributes);\n } else if (sVisible) {\n context.setStrokeStyle(graphic, graphic.attribute, x - originX, y - originY, themeAttributes);\n context.stroke();\n }\n }\n if (doFill) {\n if (fillCb) {\n fillCb(context, graphic.attribute, themeAttributes);\n } else if (fVisible) {\n context.setCommonStyle(graphic, graphic.attribute, x - originX, y - originY, themeAttributes);\n context.fill();\n }\n }\n\n this.afterRenderStep(\n graphic,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n themeAttributes,\n drawContext,\n fillCb,\n strokeCb\n );\n return true;\n }\n\n valid(graphic: IGraphic, defaultAttribute: IGraphicAttribute, fillCb?: any, strokeCb?: any) {\n const {\n fill = defaultAttribute.fill,\n background,\n stroke = defaultAttribute.stroke,\n opacity = defaultAttribute.opacity,\n fillOpacity = defaultAttribute.fillOpacity,\n lineWidth = defaultAttribute.lineWidth,\n strokeOpacity = defaultAttribute.strokeOpacity,\n visible = defaultAttribute.visible\n } = graphic.attribute;\n const fVisible = fillVisible(opacity, fillOpacity, fill);\n const sVisible = strokeVisible(opacity, strokeOpacity);\n const doFill = runFill(fill, background);\n const doStroke = runStroke(stroke, lineWidth);\n\n if (!(graphic.valid && visible)) {\n return false;\n }\n\n if (!(doFill || doStroke)) {\n return false;\n }\n\n // 如果存在fillCb和strokeCb,以及background那就不直接跳过\n if (!(fVisible || sVisible || fillCb || strokeCb || background)) {\n return false;\n }\n return {\n fVisible,\n sVisible,\n doFill,\n doStroke\n };\n }\n\n /**\n * 进行2d或3d变换\n * @param graphic\n * @param graphicAttribute\n * @param context\n * @param use3dMatrixIn3dMode 是否在3d模式使用3d矩阵\n * @returns\n */\n transform(\n graphic: IGraphic,\n graphicAttribute: Partial<IGraphicAttribute>,\n context: IContext2d,\n use3dMatrixIn3dMode: boolean = false\n ): IPointLike & { z: number; lastModelMatrix: mat4 } {\n // const transMatrix = graphic.transMatrix;\n const {\n x = graphicAttribute.x,\n y = graphicAttribute.y,\n z = graphicAttribute.z,\n scaleX = graphicAttribute.scaleX,\n scaleY = graphicAttribute.scaleY,\n angle = graphicAttribute.angle,\n postMatrix\n } = graphic.attribute;\n // const onlyTranslate = transMatrix.onlyTranslate() && !postMatrix;\n\n // 存在3d变换的时候,需要计算3d矩阵\n const lastModelMatrix = context.modelMatrix;\n const camera = context.camera;\n // const result: IPointLike & { z: number; lastModelMatrix: mat4 } = { x, y, z, lastModelMatrix };\n result.x = x;\n result.y = y;\n result.z = z;\n result.lastModelMatrix = lastModelMatrix;\n\n // 是否应该进行3d变换\n const shouldTransform3d = camera && (use3dMatrixIn3dMode || shouldUseMat4(graphic));\n\n // 是否仅有translate\n const onlyTranslate = shouldTransform3d\n ? graphic.transMatrix.onlyTranslate() && !postMatrix\n : scaleX === 1 && scaleY === 1 && angle === 0 && !postMatrix;\n\n if (shouldTransform3d) {\n const nextModelMatrix = mat4Allocate.allocate();\n // 计算模型矩阵\n const modelMatrix = mat4Allocate.allocate();\n getModelMatrix(modelMatrix, graphic, graphicAttribute as ITransform);\n // 合并模型矩阵\n if (lastModelMatrix) {\n multiplyMat4Mat4(nextModelMatrix, lastModelMatrix, modelMatrix);\n } else {\n multiplyMat4Mat4(nextModelMatrix, nextModelMatrix, modelMatrix);\n }\n result.x = 0;\n result.y = 0;\n result.z = 0;\n context.modelMatrix = nextModelMatrix;\n context.setTransform(1, 0, 0, 1, 0, 0, true);\n mat4Allocate.free(modelMatrix);\n // 有旋转的情况下需要手动计算模型矩阵\n // TODO: 这里暂时都使用模型矩阵,因为视角旋转的时候如果当不固定角度那也需要用到模型矩阵\n }\n\n // 如果只有位移,且没计算3d变换矩阵,那么不设置context的2d矩阵\n if (onlyTranslate && !lastModelMatrix) {\n const point = graphic.getOffsetXY(graphicAttribute as ITransform);\n result.x += point.x;\n result.y += point.y;\n result.z = z;\n // 当前context有rotate/scale,重置matrix\n context.setTransformForCurrent();\n } else if (shouldTransform3d) {\n // 如果计算了3d矩阵,那么就不需要2d矩阵计算了\n result.x = 0;\n result.y = 0;\n result.z = 0;\n context.setTransform(1, 0, 0, 1, 0, 0, true);\n } else {\n if (camera && context.project) {\n const point = graphic.getOffsetXY(graphicAttribute as ITransform);\n result.x += point.x;\n result.y += point.y;\n // result.x = 0;\n // result.y = 0;\n // 位置直接通过project设置,而2d变换通过变换矩阵完成\n this.transformWithoutTranslate(context, result.x, result.y, result.z, scaleX, scaleY, angle);\n } else {\n // 如果是纯2d的情况,那么直接设置context的2d矩阵\n // 性能较差\n context.transformFromMatrix(graphic.transMatrix, true);\n result.x = 0;\n result.y = 0;\n result.z = 0;\n }\n }\n\n return result;\n }\n\n /**\n * 将3d的transform转成context2d的transform\n * @param graphic\n * @param graphicAttribute\n * @param z\n * @param context\n */\n transformUseContext2d(graphic: IGraphic, graphicAttribute: IGraphicAttribute, z: number, context: IContext2d) {\n const camera = context.camera;\n this.camera = camera;\n if (camera) {\n const bounds = graphic.AABBBounds;\n const width = bounds.x2 - bounds.x1;\n const height = bounds.y2 - bounds.y1;\n const p1 = context.project(0, 0, z);\n const p2 = context.project(width, 0, z);\n const p3 = context.project(width, height, z);\n const _p1 = { x: 0, y: 0 };\n const _p2 = { x: width, y: 0 };\n const _p3 = { x: width, y: height };\n\n context.camera = null;\n\n // 生成3维矩阵\n /* Adapted from phoria.js by ecomfe\n * https://github.com/kevinroast/phoria.js\n * Licensed under the BSD-3-Clause\n\n * url: https://github.com/kevinroast/phoria.js/blob/736c6b854a679df180f8a6e689aeb218efa6dc01/scripts/phoria-renderer.js\n * License: https://github.com/kevinroast/phoria.js/blob/master/LICENSE\n * @license\n */\n const denom = 1.0 / (_p1.x * (_p3.y - _p2.y) - _p2.x * _p3.y + _p3.x * _p2.y + (_p2.x - _p3.x) * _p1.y);\n // calculate context transformation matrix\n const m11 = -(_p1.y * (p3.x - p2.x) - _p2.y * p3.x + _p3.y * p2.x + (_p2.y - _p3.y) * p1.x) * denom;\n const m12 = (_p2.y * p3.y + _p1.y * (p2.y - p3.y) - _p3.y * p2.y + (_p3.y - _p2.y) * p1.y) * denom;\n const m21 = (_p1.x * (p3.x - p2.x) - _p2.x * p3.x + _p3.x * p2.x + (_p2.x - _p3.x) * p1.x) * denom;\n const m22 = -(_p2.x * p3.y + _p1.x * (p2.y - p3.y) - _p3.x * p2.y + (_p3.x - _p2.x) * p1.y) * denom;\n const dx =\n (_p1.x * (_p3.y * p2.x - _p2.y * p3.x) +\n _p1.y * (_p2.x * p3.x - _p3.x * p2.x) +\n (_p3.x * _p2.y - _p2.x * _p3.y) * p1.x) *\n denom;\n const dy =\n (_p1.x * (_p3.y * p2.y - _p2.y * p3.y) +\n _p1.y * (_p2.x * p3.y - _p3.x * p2.y) +\n (_p3.x * _p2.y - _p2.x * _p3.y) * p1.y) *\n denom;\n\n context.setTransform(m11, m12, m21, m22, dx, dy, true);\n }\n }\n\n /**\n * transformUseContext2d的后处理\n * @param graphic\n * @param graphicAttribute\n * @param z\n * @param context\n */\n restoreTransformUseContext2d(graphic: IGraphic, graphicAttribute: IGraphicAttribute, z: number, context: IContext2d) {\n if (this.camera) {\n context.camera = this.camera;\n }\n }\n\n protected transformWithoutTranslate(\n context: IContext2d,\n x: number,\n y: number,\n z: number,\n scaleX: number,\n scaleY: number,\n angle: number\n ) {\n const p = context.project(x, y, z);\n context.translate(p.x, p.y, false);\n context.scale(scaleX, scaleY, false);\n context.rotate(angle, false);\n context.translate(-p.x, -p.y, false);\n context.setTransformForCurrent();\n }\n\n _draw(\n graphic: T,\n defaultAttr: IGraphicAttribute,\n computed3dMatrix: boolean,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams\n ) {\n const { context } = drawContext;\n if (!context) {\n return;\n }\n // 如果hide,直接跳过后续绘制\n const { renderable } = graphic.attribute;\n if (renderable === false) {\n return;\n }\n\n context.highPerformanceSave();\n\n const data = this.transform(graphic, defaultAttr, context, computed3dMatrix);\n const { x, y, z, lastModelMatrix } = data;\n\n this.z = z;\n if (this.drawPathProxy(graphic, context, x, y, drawContext, params)) {\n context.highPerformanceRestore();\n return;\n }\n\n this.drawShape(graphic, context, x, y, drawContext, params);\n this.z = 0;\n\n if (context.modelMatrix !== lastModelMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastModelMatrix;\n\n context.highPerformanceRestore();\n }\n\n drawShape?(\n path: T,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ): void;\n\n // abstract drawShape(\n // graphic: T,\n // context: IContext2d,\n // x: number,\n // y: number,\n // drawContext: IDrawContext,\n // params?: IGraphicRenderDrawParams,\n // fillCb?: (\n // ctx: IContext2d,\n // markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n // themeAttribute: IThemeAttribute\n // ) => boolean,\n // strokeCb?: (\n // ctx: IContext2d,\n // markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n // themeAttribute: IThemeAttribute\n // ) => boolean\n // ): void;\n\n // drawPathProxy(\n // graphic: T,\n // context: IContext2d,\n // x: number,\n // y: number,\n // drawContext: IDrawContext,\n // params?: IGraphicRenderDrawParams,\n // fillCb?: (\n // ctx: IContext2d,\n // markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n // themeAttribute: IThemeAttribute\n // ) => boolean,\n // strokeCb?: (\n // ctx: IContext2d,\n // markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n // themeAttribute: IThemeAttribute\n // ) => boolean\n // ) {\n // if (!graphic.pathProxy) {\n // return false;\n // }\n\n // const themeAttributes = getTheme(graphic)[graphic.type];\n\n // const {\n // fill = themeAttributes.fill == null ? !!graphic.attribute.fillColor : themeAttributes.fill,\n // stroke = themeAttributes.stroke == null ? !!graphic.attribute.strokeColor : themeAttributes.stroke,\n // opacity = themeAttributes.opacity,\n // fillOpacity = themeAttributes.fillOpacity,\n // lineWidth = themeAttributes.lineWidth,\n // strokeOpacity = themeAttributes.strokeOpacity,\n // visible = themeAttributes.visible\n // } = graphic.attribute;\n // // 不绘制或者透明\n // const fVisible = fillVisible(opacity, fillOpacity);\n // const sVisible = strokeVisible(opacity, strokeOpacity);\n // const doFill = runFill(fill);\n // const doStroke = runStroke(stroke, lineWidth);\n\n // if (!visible) {\n // return true;\n // }\n\n // if (!(doFill || doStroke)) {\n // return true;\n // }\n\n // // 如果存在fillCb和strokeCb,那就不直接跳过\n // if (!(fVisible || sVisible || fillCb || strokeCb)) {\n // return true;\n // }\n\n // context.beginPath();\n\n // const path = typeof graphic.pathProxy === 'function' ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;\n // renderCommandList(path.commandList, context, x, y);\n\n // // shadow\n // context.setShadowBlendStyle && context.setShadowBlendStyle(graphic, graphic.attribute, themeAttributes);\n\n // if (doStroke) {\n // if (strokeCb) {\n // strokeCb(context, graphic.attribute, themeAttributes);\n // } else if (sVisible) {\n // context.setStrokeStyle(graphic, graphic.attribute, 0, 0, themeAttributes);\n // context.stroke();\n // }\n // }\n // if (doFill) {\n // if (fillCb) {\n // fillCb(context, graphic.attribute, themeAttributes);\n // } else if (fVisible) {\n // context.setCommonStyle(graphic, graphic.attribute, 0, 0, themeAttributes);\n // context.fill();\n // }\n // }\n // return true;\n // }\n}\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/base-render.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,sCAAsC,EAAE,uCAAuC,EAAE,MAAM,iBAAiB,CAAC;AAElH,MAAM,MAAM,GAAsD,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;AAE9G,MAAM,OAAgB,UAAU;IAY9B,IAAI,CAAC,aAAiF;QACpF,IAAI,aAAa,EAAE;YAEjB,IAAI,CAAC,oBAAoB,GAAG,aAAa,CAAC,gBAAgB,EAAE,CAAC;SAC9D;QACD,IAAI,CAAC,IAAI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IAAI,EAAE,cAAc,CAAC,CAAC;QACxF,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QAEX,IAAI,OAAO,CAAC,WAAW,KAAK,eAAe,EAAE;YAC3C,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACxC;QACD,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;QAEtC,OAAO,CAAC,sBAAsB,EAAE,CAAC;IACnC,CAAC;CAuHF","file":"base-render.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\nimport type {\n IGraphicAttribute,\n ICamera,\n IContext2d,\n IGraphic,\n mat4,\n IDrawContext,\n IGraphicRenderDrawParams,\n IMarkAttribute,\n IThemeAttribute,\n IContributionProvider,\n IBaseRenderContribution,\n ITransform\n} from '../../../interface';\nimport { getModelMatrix, shouldUseMat4 } from '../../../graphic/graphic-service/graphic-service';\nimport { mat4Allocate } from '../../../allocator/matrix-allocate';\nimport { fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { multiplyMat4Mat4 } from '../../../common/matrix';\nimport { getTheme } from '../../../graphic';\nimport { renderCommandList } from '../../../common/render-command-list';\nimport { defaultBaseClipRenderAfterContribution, defaultBaseClipRenderBeforeContribution } from './contributions';\n\nconst result: IPointLike & { z: number; lastModelMatrix: mat4 } = { x: 0, y: 0, z: 0, lastModelMatrix: null };\n\nexport abstract class BaseRender<T extends IGraphic> {\n camera: ICamera;\n declare z: number;\n\n builtinContributions: IBaseRenderContribution<T, T['attribute']>[];\n\n // declare renderContribitions: IContributionProvider<IBaseRenderContribution<T, T['attribute']>> | null;\n\n protected _beforeRenderContribitions: IBaseRenderContribution<T, T['attribute']>[];\n protected _afterRenderContribitions: IBaseRenderContribution<T, T['attribute']>[];\n protected _renderContribitions: IBaseRenderContribution<T, T['attribute']>[];\n\n init(contributions?: IContributionProvider<IBaseRenderContribution<T, T['attribute']>>) {\n if (contributions) {\n // this.renderContribitions = contributions;\n this._renderContribitions = contributions.getContributions();\n }\n if (!this._renderContribitions) {\n this._renderContribitions = [];\n }\n if (!this.builtinContributions) {\n this.builtinContributions = [];\n }\n this.builtinContributions.push(defaultBaseClipRenderBeforeContribution);\n this.builtinContributions.push(defaultBaseClipRenderAfterContribution);\n this.builtinContributions.forEach(item => this._renderContribitions.push(item));\n if (this._renderContribitions.length) {\n this._renderContribitions.sort((a, b) => b.order - a.order);\n this._beforeRenderContribitions = this._renderContribitions.filter(\n c => c.time === BaseRenderContributionTime.beforeFillStroke\n );\n this._afterRenderContribitions = this._renderContribitions.filter(\n c => c.time === BaseRenderContributionTime.afterFillStroke\n );\n }\n }\n\n beforeRenderStep(\n graphic: T,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<T['attribute']>,\n drawContext: IDrawContext,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n params?: any\n ) {\n this._beforeRenderContribitions &&\n this._beforeRenderContribitions.forEach(c => {\n if (\n c.supportedAppName &&\n graphic.stage &&\n graphic.stage.params &&\n graphic.stage.params.context &&\n graphic.stage.params.context.appName\n ) {\n const names = Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName];\n if (!names.includes(graphic.stage.params.context.appName)) {\n return;\n }\n }\n c.drawShape(\n graphic,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n graphicAttribute,\n drawContext,\n fillCb,\n strokeCb,\n params\n );\n });\n }\n\n afterRenderStep(\n graphic: T,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<T['attribute']>,\n drawContext: IDrawContext,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n params?: any\n ) {\n this._afterRenderContribitions &&\n this._afterRenderContribitions.forEach(c => {\n if (\n c.supportedAppName &&\n graphic.stage &&\n graphic.stage.params &&\n graphic.stage.params.context &&\n graphic.stage.params.context.appName\n ) {\n const names = Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName];\n if (!names.includes(graphic.stage.params.context.appName)) {\n return;\n }\n }\n c.drawShape(\n graphic,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n graphicAttribute,\n drawContext,\n fillCb,\n strokeCb,\n params\n );\n });\n }\n\n drawPathProxy(\n graphic: T,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n if (!graphic.pathProxy) {\n return false;\n }\n\n const themeAttributes = (getTheme(graphic, params?.theme) as any)[graphic.type.replace('3d', '')];\n\n const {\n fill = themeAttributes.fill,\n stroke = themeAttributes.stroke,\n opacity = themeAttributes.opacity,\n fillOpacity = themeAttributes.fillOpacity,\n lineWidth = themeAttributes.lineWidth,\n strokeOpacity = themeAttributes.strokeOpacity,\n visible = themeAttributes.visible,\n x: originX = themeAttributes.x,\n y: originY = themeAttributes.y\n } = graphic.attribute;\n // 不绘制或者透明\n const fVisible = fillVisible(opacity, fillOpacity, fill);\n const sVisible = strokeVisible(opacity, strokeOpacity);\n const doFill = runFill(fill);\n const doStroke = runStroke(stroke, lineWidth);\n\n if (!visible) {\n return true;\n }\n\n if (!(doFill || doStroke)) {\n return true;\n }\n\n // 如果存在fillCb和strokeCb,那就不直接跳过\n if (!(fVisible || sVisible || fillCb || strokeCb)) {\n return true;\n }\n\n context.beginPath();\n const path = typeof graphic.pathProxy === 'function' ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;\n renderCommandList(path.commandList, context, x, y);\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(graphic, graphic.attribute, themeAttributes);\n\n this.beforeRenderStep(\n graphic,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n themeAttributes,\n drawContext,\n fillCb,\n strokeCb\n );\n\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, graphic.attribute, themeAttributes);\n } else if (sVisible) {\n context.setStrokeStyle(graphic, graphic.attribute, x - originX, y - originY, themeAttributes);\n context.stroke();\n }\n }\n if (doFill) {\n if (fillCb) {\n fillCb(context, graphic.attribute, themeAttributes);\n } else if (fVisible) {\n context.setCommonStyle(graphic, graphic.attribute, x - originX, y - originY, themeAttributes);\n context.fill();\n }\n }\n\n this.afterRenderStep(\n graphic,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n themeAttributes,\n drawContext,\n fillCb,\n strokeCb\n );\n return true;\n }\n\n valid(graphic: IGraphic, defaultAttribute: IGraphicAttribute, fillCb?: any, strokeCb?: any) {\n const {\n fill = defaultAttribute.fill,\n background,\n stroke = defaultAttribute.stroke,\n opacity = defaultAttribute.opacity,\n fillOpacity = defaultAttribute.fillOpacity,\n lineWidth = defaultAttribute.lineWidth,\n strokeOpacity = defaultAttribute.strokeOpacity,\n visible = defaultAttribute.visible\n } = graphic.attribute;\n const fVisible = fillVisible(opacity, fillOpacity, fill);\n const sVisible = strokeVisible(opacity, strokeOpacity);\n const doFill = runFill(fill, background);\n const doStroke = runStroke(stroke, lineWidth);\n\n if (!(graphic.valid && visible)) {\n return false;\n }\n\n if (!(doFill || doStroke)) {\n return false;\n }\n\n // 如果存在fillCb和strokeCb,以及background那就不直接跳过\n if (!(fVisible || sVisible || fillCb || strokeCb || background)) {\n return false;\n }\n return {\n fVisible,\n sVisible,\n doFill,\n doStroke\n };\n }\n\n /**\n * 进行2d或3d变换\n * @param graphic\n * @param graphicAttribute\n * @param context\n * @param use3dMatrixIn3dMode 是否在3d模式使用3d矩阵\n * @returns\n */\n transform(\n graphic: IGraphic,\n graphicAttribute: Partial<IGraphicAttribute>,\n context: IContext2d,\n use3dMatrixIn3dMode: boolean = false\n ): IPointLike & { z: number; lastModelMatrix: mat4 } {\n // const transMatrix = graphic.transMatrix;\n const {\n x = graphicAttribute.x,\n y = graphicAttribute.y,\n z = graphicAttribute.z,\n scaleX = graphicAttribute.scaleX,\n scaleY = graphicAttribute.scaleY,\n angle = graphicAttribute.angle,\n postMatrix\n } = graphic.attribute;\n // const onlyTranslate = transMatrix.onlyTranslate() && !postMatrix;\n\n // 存在3d变换的时候,需要计算3d矩阵\n const lastModelMatrix = context.modelMatrix;\n const camera = context.camera;\n // const result: IPointLike & { z: number; lastModelMatrix: mat4 } = { x, y, z, lastModelMatrix };\n result.x = x;\n result.y = y;\n result.z = z;\n result.lastModelMatrix = lastModelMatrix;\n\n // 是否应该进行3d变换\n const shouldTransform3d = camera && (use3dMatrixIn3dMode || shouldUseMat4(graphic));\n\n // 是否仅有translate\n const onlyTranslate = shouldTransform3d\n ? graphic.transMatrix.onlyTranslate() && !postMatrix\n : scaleX === 1 && scaleY === 1 && angle === 0 && !postMatrix;\n\n if (shouldTransform3d) {\n const nextModelMatrix = mat4Allocate.allocate();\n // 计算模型矩阵\n const modelMatrix = mat4Allocate.allocate();\n getModelMatrix(modelMatrix, graphic, graphicAttribute as ITransform);\n // 合并模型矩阵\n if (lastModelMatrix) {\n multiplyMat4Mat4(nextModelMatrix, lastModelMatrix, modelMatrix);\n } else {\n multiplyMat4Mat4(nextModelMatrix, nextModelMatrix, modelMatrix);\n }\n result.x = 0;\n result.y = 0;\n result.z = 0;\n context.modelMatrix = nextModelMatrix;\n context.setTransform(1, 0, 0, 1, 0, 0, true);\n mat4Allocate.free(modelMatrix);\n // 有旋转的情况下需要手动计算模型矩阵\n // TODO: 这里暂时都使用模型矩阵,因为视角旋转的时候如果当不固定角度那也需要用到模型矩阵\n }\n\n // 如果只有位移,且没计算3d变换矩阵,那么不设置context的2d矩阵\n if (onlyTranslate && !lastModelMatrix) {\n const point = graphic.getOffsetXY(graphicAttribute as ITransform);\n result.x += point.x;\n result.y += point.y;\n result.z = z;\n // 当前context有rotate/scale,重置matrix\n context.setTransformForCurrent();\n } else if (shouldTransform3d) {\n // 如果计算了3d矩阵,那么就不需要2d矩阵计算了\n result.x = 0;\n result.y = 0;\n result.z = 0;\n context.setTransform(1, 0, 0, 1, 0, 0, true);\n } else {\n if (camera && context.project) {\n const point = graphic.getOffsetXY(graphicAttribute as ITransform);\n result.x += point.x;\n result.y += point.y;\n // result.x = 0;\n // result.y = 0;\n // 位置直接通过project设置,而2d变换通过变换矩阵完成\n this.transformWithoutTranslate(context, result.x, result.y, result.z, scaleX, scaleY, angle);\n } else {\n // 如果是纯2d的情况,那么直接设置context的2d矩阵\n // 性能较差\n context.transformFromMatrix(graphic.transMatrix, true);\n result.x = 0;\n result.y = 0;\n result.z = 0;\n }\n }\n\n return result;\n }\n\n /**\n * 将3d的transform转成context2d的transform\n * @param graphic\n * @param graphicAttribute\n * @param z\n * @param context\n */\n transformUseContext2d(graphic: IGraphic, graphicAttribute: IGraphicAttribute, z: number, context: IContext2d) {\n const camera = context.camera;\n this.camera = camera;\n if (camera) {\n const bounds = graphic.AABBBounds;\n const width = bounds.x2 - bounds.x1;\n const height = bounds.y2 - bounds.y1;\n const p1 = context.project(0, 0, z);\n const p2 = context.project(width, 0, z);\n const p3 = context.project(width, height, z);\n const _p1 = { x: 0, y: 0 };\n const _p2 = { x: width, y: 0 };\n const _p3 = { x: width, y: height };\n\n context.camera = null;\n\n // 生成3维矩阵\n /* Adapted from phoria.js by ecomfe\n * https://github.com/kevinroast/phoria.js\n * Licensed under the BSD-3-Clause\n\n * url: https://github.com/kevinroast/phoria.js/blob/736c6b854a679df180f8a6e689aeb218efa6dc01/scripts/phoria-renderer.js\n * License: https://github.com/kevinroast/phoria.js/blob/master/LICENSE\n * @license\n */\n const denom = 1.0 / (_p1.x * (_p3.y - _p2.y) - _p2.x * _p3.y + _p3.x * _p2.y + (_p2.x - _p3.x) * _p1.y);\n // calculate context transformation matrix\n const m11 = -(_p1.y * (p3.x - p2.x) - _p2.y * p3.x + _p3.y * p2.x + (_p2.y - _p3.y) * p1.x) * denom;\n const m12 = (_p2.y * p3.y + _p1.y * (p2.y - p3.y) - _p3.y * p2.y + (_p3.y - _p2.y) * p1.y) * denom;\n const m21 = (_p1.x * (p3.x - p2.x) - _p2.x * p3.x + _p3.x * p2.x + (_p2.x - _p3.x) * p1.x) * denom;\n const m22 = -(_p2.x * p3.y + _p1.x * (p2.y - p3.y) - _p3.x * p2.y + (_p3.x - _p2.x) * p1.y) * denom;\n const dx =\n (_p1.x * (_p3.y * p2.x - _p2.y * p3.x) +\n _p1.y * (_p2.x * p3.x - _p3.x * p2.x) +\n (_p3.x * _p2.y - _p2.x * _p3.y) * p1.x) *\n denom;\n const dy =\n (_p1.x * (_p3.y * p2.y - _p2.y * p3.y) +\n _p1.y * (_p2.x * p3.y - _p3.x * p2.y) +\n (_p3.x * _p2.y - _p2.x * _p3.y) * p1.y) *\n denom;\n\n context.setTransform(m11, m12, m21, m22, dx, dy, true);\n }\n }\n\n /**\n * transformUseContext2d的后处理\n * @param graphic\n * @param graphicAttribute\n * @param z\n * @param context\n */\n restoreTransformUseContext2d(graphic: IGraphic, graphicAttribute: IGraphicAttribute, z: number, context: IContext2d) {\n if (this.camera) {\n context.camera = this.camera;\n }\n }\n\n protected transformWithoutTranslate(\n context: IContext2d,\n x: number,\n y: number,\n z: number,\n scaleX: number,\n scaleY: number,\n angle: number\n ) {\n const p = context.project(x, y, z);\n context.translate(p.x, p.y, false);\n context.scale(scaleX, scaleY, false);\n context.rotate(angle, false);\n context.translate(-p.x, -p.y, false);\n context.setTransformForCurrent();\n }\n\n _draw(\n graphic: T,\n defaultAttr: IGraphicAttribute,\n computed3dMatrix: boolean,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n themeAttribute?: IGraphicAttribute\n ) {\n const { context } = drawContext;\n if (!context) {\n return;\n }\n // 如果hide,直接跳过后续绘制\n const { renderable } = graphic.attribute;\n if (renderable === false) {\n return;\n }\n\n context.highPerformanceSave();\n\n const data = this.transform(graphic, defaultAttr, context, computed3dMatrix);\n const { x, y, z, lastModelMatrix } = data;\n\n this.z = z;\n if (this.drawPathProxy(graphic, context, x, y, drawContext, params)) {\n context.highPerformanceRestore();\n return;\n }\n\n this.drawShape(graphic, context, x, y, drawContext, params, null, null, themeAttribute);\n this.z = 0;\n\n if (context.modelMatrix !== lastModelMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastModelMatrix;\n\n context.highPerformanceRestore();\n }\n\n drawShape?(\n path: T,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n themeAttribute?: IGraphicAttribute\n ): void;\n\n // abstract drawShape(\n // graphic: T,\n // context: IContext2d,\n // x: number,\n // y: number,\n // drawContext: IDrawContext,\n // params?: IGraphicRenderDrawParams,\n // fillCb?: (\n // ctx: IContext2d,\n // markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n // themeAttribute: IThemeAttribute\n // ) => boolean,\n // strokeCb?: (\n // ctx: IContext2d,\n // markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n // themeAttribute: IThemeAttribute\n // ) => boolean\n // ): void;\n\n // drawPathProxy(\n // graphic: T,\n // context: IContext2d,\n // x: number,\n // y: number,\n // drawContext: IDrawContext,\n // params?: IGraphicRenderDrawParams,\n // fillCb?: (\n // ctx: IContext2d,\n // markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n // themeAttribute: IThemeAttribute\n // ) => boolean,\n // strokeCb?: (\n // ctx: IContext2d,\n // markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n // themeAttribute: IThemeAttribute\n // ) => boolean\n // ) {\n // if (!graphic.pathProxy) {\n // return false;\n // }\n\n // const themeAttributes = getTheme(graphic)[graphic.type];\n\n // const {\n // fill = themeAttributes.fill == null ? !!graphic.attribute.fillColor : themeAttributes.fill,\n // stroke = themeAttributes.stroke == null ? !!graphic.attribute.strokeColor : themeAttributes.stroke,\n // opacity = themeAttributes.opacity,\n // fillOpacity = themeAttributes.fillOpacity,\n // lineWidth = themeAttributes.lineWidth,\n // strokeOpacity = themeAttributes.strokeOpacity,\n // visible = themeAttributes.visible\n // } = graphic.attribute;\n // // 不绘制或者透明\n // const fVisible = fillVisible(opacity, fillOpacity);\n // const sVisible = strokeVisible(opacity, strokeOpacity);\n // const doFill = runFill(fill);\n // const doStroke = runStroke(stroke, lineWidth);\n\n // if (!visible) {\n // return true;\n // }\n\n // if (!(doFill || doStroke)) {\n // return true;\n // }\n\n // // 如果存在fillCb和strokeCb,那就不直接跳过\n // if (!(fVisible || sVisible || fillCb || strokeCb)) {\n // return true;\n // }\n\n // context.beginPath();\n\n // const path = typeof graphic.pathProxy === 'function' ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;\n // renderCommandList(path.commandList, context, x, y);\n\n // // shadow\n // context.setShadowBlendStyle && context.setShadowBlendStyle(graphic, graphic.attribute, themeAttributes);\n\n // if (doStroke) {\n // if (strokeCb) {\n // strokeCb(context, graphic.attribute, themeAttributes);\n // } else if (sVisible) {\n // context.setStrokeStyle(graphic, graphic.attribute, 0, 0, themeAttributes);\n // context.stroke();\n // }\n // }\n // if (doFill) {\n // if (fillCb) {\n // fillCb(context, graphic.attribute, themeAttributes);\n // } else if (fVisible) {\n // context.setCommonStyle(graphic, graphic.attribute, 0, 0, themeAttributes);\n // context.fill();\n // }\n // }\n // return true;\n // }\n}\n"]}
@@ -22,6 +22,7 @@ export declare class DefaultDrawContribution implements IDrawContribution {
22
22
  doRegister(): void;
23
23
  protected _findNextGraphic(group: IGroup): IGraphic | null;
24
24
  renderGroup(group: IGroup, drawContext: IDrawContext, parentMatrix: IMatrix, skipSort?: boolean): void;
25
+ _renderInGroup: (skipSort: boolean, group: IGroup, drawContext: IDrawContext, nextM: IMatrix) => void;
25
26
  protected _increaseRender(group: IGroup, drawContext: IDrawContext): void;
26
27
  getRenderContribution(graphic: IGraphic): IGraphicRender | null;
27
28
  renderItem(graphic: IGraphic, drawContext: IDrawContext, params?: IGraphicRenderDrawParams): void;
@@ -37,7 +37,14 @@ import { application } from "../../../application";
37
37
  let DefaultDrawContribution = class {
38
38
  constructor(contributions, drawItemInterceptorContributions) {
39
39
  this.contributions = contributions, this.drawItemInterceptorContributions = drawItemInterceptorContributions,
40
- this.currentRenderMap = new Map, this.defaultRenderMap = new Map, this.styleRenderMap = new Map,
40
+ this._renderInGroup = (skipSort, group, drawContext, nextM) => {
41
+ var _a;
42
+ skipSort ? group.forEachChildren((item => {
43
+ drawContext.break || (item.isContainer ? this.renderGroup(item, drawContext, nextM) : this.renderItem(item, drawContext));
44
+ })) : foreach(group, DefaultAttribute.zIndex, (item => {
45
+ drawContext.break || (item.isContainer ? this.renderGroup(item, drawContext, nextM) : this.renderItem(item, drawContext));
46
+ }), !1, !!(null === (_a = drawContext.context) || void 0 === _a ? void 0 : _a.camera));
47
+ }, this.currentRenderMap = new Map, this.defaultRenderMap = new Map, this.styleRenderMap = new Map,
41
48
  this.dirtyBounds = new Bounds, this.backupDirtyBounds = new Bounds, this.global = application.global,
42
49
  this.layerService = application.layerService, isArray(this.contributions) || (this.contributions = [ this.contributions ]),
43
50
  this.init();
@@ -69,18 +76,17 @@ let DefaultDrawContribution = class {
69
76
  (d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr,
70
77
  dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr,
71
78
  dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds),
72
- context.inuse = !0, context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f),
73
- context.clearMatrix(), context.setTransformForCurrent(!0), context.translate(viewBox.x1, viewBox.y1, !0),
74
- context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()),
79
+ context.save(), context.reset(!1), context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f),
80
+ context.clearMatrix(!1), context.translate(viewBox.x1, viewBox.y1, !0), context.beginPath(),
81
+ context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()),
75
82
  context.clip(), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0),
76
83
  this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext),
77
- context.save(), renderService.renderTreeRoots.sort(((a, b) => {
84
+ renderService.renderTreeRoots.sort(((a, b) => {
78
85
  var _a, _b;
79
86
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
80
87
  })).forEach((group => {
81
88
  group.isContainer ? this.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : this.renderItem(group, drawContext);
82
- })), context.restore(), context.setClearMatrix(1, 0, 0, 1, 0, 0), context.inuse = !1,
83
- context.draw();
89
+ })), context.restore(), context.draw();
84
90
  }
85
91
  doRegister() {
86
92
  throw new Error("暂不支持");
@@ -106,15 +112,13 @@ let DefaultDrawContribution = class {
106
112
  nextM = matrixAllocate.allocateByObj(parentMatrix).multiply(gm.a, gm.b, gm.c, gm.d, gm.e, gm.f),
107
113
  this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(nextM.getInverse());
108
114
  }
115
+ drawContext.isGroupScroll = !(!group.attribute.scrollX && !group.attribute.scrollY),
109
116
  this.renderItem(group, drawContext, {
110
- drawingCb: () => {
111
- var _a;
112
- skipSort ? group.forEachChildren((item => {
113
- drawContext.break || (item.isContainer ? this.renderGroup(item, drawContext, nextM) : this.renderItem(item, drawContext));
114
- })) : foreach(group, DefaultAttribute.zIndex, (item => {
115
- drawContext.break || (item.isContainer ? this.renderGroup(item, drawContext, nextM) : this.renderItem(item, drawContext));
116
- }), !1, !!(null === (_a = drawContext.context) || void 0 === _a ? void 0 : _a.camera));
117
- }
117
+ renderInGroupParams: {
118
+ skipSort: skipSort,
119
+ nextM: nextM
120
+ },
121
+ renderInGroup: this._renderInGroup
118
122
  }), this.useDirtyBounds && (this.dirtyBounds.copy(tempBounds), boundsAllocate.free(tempBounds),
119
123
  matrixAllocate.free(nextM));
120
124
  }
@@ -166,11 +170,11 @@ let DefaultDrawContribution = class {
166
170
  }
167
171
  const renderer = this.getRenderContribution(graphic);
168
172
  if (!renderer) return;
169
- let tempBounds, retrans = this.scrollMatrix && (0 !== this.scrollMatrix.e || 0 !== this.scrollMatrix.f);
170
- if (graphic.parent) {
173
+ let tempBounds, retrans = !1;
174
+ if (drawContext.isGroupScroll) {
171
175
  const {scrollX: scrollX = 0, scrollY: scrollY = 0} = graphic.parent.attribute;
172
- (scrollX || scrollY) && (retrans = !0, this.scrollMatrix || (this.scrollMatrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0)),
173
- this.scrollMatrix.translate(-scrollX, -scrollY));
176
+ retrans = !0, this.scrollMatrix || (this.scrollMatrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0)),
177
+ this.scrollMatrix.translate(-scrollX, -scrollY);
174
178
  }
175
179
  if (retrans && (tempBounds = this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix)),
176
180
  this.useDirtyBounds && !graphic.isContainer && "empty" !== graphic.attribute.boundsMode && !isRectIntersect(graphic.AABBBounds, null != tempBounds ? tempBounds : this.dirtyBounds, !1)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/draw-contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAexF,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAM5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,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,WAAW,CAC7B,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;AAnbY,uBAAuB;IADnC,UAAU,EAAE;IAqBR,WAAA,WAAW,CAAC,aAAa,CAAC,CAAA;IAG1B,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,mBAAmB,CAAC,CAAA;;GAxBlB,uBAAuB,CAmbnC;SAnbY,uBAAuB","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 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 context.inuse = true;\n context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f);\n // 初始化context\n context.clearMatrix();\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 // // 渲染的时候图元的起始位置就是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.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 this.renderItem(group, drawContext, {\n drawingCb: () => {\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\n if (this.useDirtyBounds) {\n this.dirtyBounds.copy(tempBounds);\n boundsAllocate.free(tempBounds);\n matrixAllocate.free(nextM);\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 = this.scrollMatrix && (this.scrollMatrix.e !== 0 || this.scrollMatrix.f !== 0);\n let tempBounds: IBounds;\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,OAAO,EAAE,UAAU,EAAE,MAAM,E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,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;AAtcY,uBAAuB;IADnC,UAAU,EAAE;IAqBR,WAAA,WAAW,CAAC,aAAa,CAAC,CAAA;IAG1B,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,mBAAmB,CAAC,CAAA;;GAxBlB,uBAAuB,CAscnC;SAtcY,uBAAuB","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 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.save();\n context.reset(false);\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 // // 渲染的时候图元的起始位置就是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"]}
@@ -75,6 +75,7 @@ let CommonDrawItemInterceptorContribution = class {
75
75
  this.order = 1, this.interceptors = [ new ShadowRootDrawItemInterceptorContribution, new Canvas3DDrawItemInterceptor, new InteractiveDrawItemInterceptorContribution, new DebugDrawItemInterceptorContribution ];
76
76
  }
77
77
  afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
78
+ if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
78
79
  for (let i = 0; i < this.interceptors.length; i++) if (this.interceptors[i].afterDrawItem && this.interceptors[i].afterDrawItem(graphic, renderService, drawContext, drawContribution, params)) return !0;
79
80
  return !1;
80
81
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/draw-interceptor.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAYlE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAG5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;AASrE,MAAM,eAAe,GAAG,IAAI,UAAU,EAAE,CAAC;AACzC,MAAM,qBAAqB,GAAG,IAAI,UAAU,EAAE,CAAC;AAK/C,MAAM,OAAO,yCAAyC;IAAtD;QACE,UAAK,GAAW,CAAC,CAAC;IAoFpB,CAAC;IAnFC,aAAa,CACX,OAAiB,EACjB,aAA6B,EAC7B,WAAyB,EACzB,gBAAmC,EACnC,MAAiC;QAGjC,IACE,OAAO,CAAC,SAAS,CAAC,aAAa,IAAI,IAAI;YACvC,OAAO,CAAC,UAAU;YAClB,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,GAAG,CAAC,EAC9C;YACA,OAAO,KAAK,CAAC;SACd;QACD,IACE,OAAO,CAAC,SAAS,CAAC,aAAa,GAAG,CAAC;YACnC,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa;YAChC,CAAC,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,GAAG,CAAC,CAAC,EACtE;YACA,IAAI,CAAC,QAAQ,CAAC,OAAO,EA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I,IAAI,CACf,CAAC;YACJ,CAAC,EACD,WAAW,CACZ,CAAC;SACH;aAAM;YACL,gBAAgB,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;SACnD;QACD,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;QACtB,OAAO,CAAC,OAAO,EAAE,CAAC;QAElB,IAAI,OAAO,CAAC,WAAW,KAAK,eAAe,EAAE;YAC3C,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACxC;QACD,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;QAEtC,WAAW,CAAC,eAAe,GAAG,KAAK,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa,CAAC,OAAmB;QAC/B,OAAO,CAAC,sBAAsB,EAAE,CAAC;IACnC,CAAC;CACF","file":"draw-interceptor.js","sourcesContent":["import { injectable } from '../../../common/inversify-lite';\nimport { AABBBounds } from '@visactor/vutils';\nimport { mat3Tomat4, multiplyMat4Mat4 } from '../../../common/matrix';\nimport { graphicCreator } from '../../../graphic/graphic-creator';\nimport type {\n IContext2d,\n IDrawContext,\n IDrawContribution,\n IDrawItemInterceptorContribution,\n IGraphic,\n IGraphicRenderDrawParams,\n IGroup,\n ILayer,\n IRenderService\n} from '../../../interface';\nimport { mat4Allocate, matrixAllocate } from '../../../allocator/matrix-allocate';\nimport { draw3dItem } from '../../../common/3d-interceptor';\n\n// 拦截器\nexport const DrawItemInterceptor = Symbol.for('DrawItemInterceptor');\n\n// @injectable()\n// export class DefaultDrawItemInterceptor implements IDrawItemInterceptor {\n// drawItem(graphic: IGraphic, renderService: IRenderService, params?: IGraphicRenderDrawParams): boolean {\n// return false;\n// }\n// }\n\nconst tempDirtyBounds = new AABBBounds();\nconst tempBackupDirtyBounds = new AABBBounds();\n/**\n * 影子节点拦截器,用于渲染影子节点\n */\n// @injectable()\nexport class ShadowRootDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n afterDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 如果graphic没设置shadowRootIdx,shadowRoot设置了,那就使用shadowRoot的shadowRootIdx\n if (\n graphic.attribute.shadowRootIdx == null &&\n graphic.shadowRoot &&\n graphic.shadowRoot.attribute.shadowRootIdx < 0\n ) {\n return false;\n }\n if (\n graphic.attribute.shadowRootIdx > 0 ||\n !graphic.attribute.shadowRootIdx ||\n (graphic.shadowRoot && graphic.shadowRoot.attribute.shadowRootIdx > 0)\n ) {\n this.drawItem(graphic, renderService, drawContext, drawContribution, params);\n }\n return false;\n }\n\n beforeDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 如果graphic没设置shadowRootIdx,shadowRoot设置了,那就使用shadowRoot的shadowRootIdx\n if (\n graphic.attribute.shadowRootIdx == null &&\n graphic.shadowRoot &&\n graphic.shadowRoot.attribute.shadowRootIdx > 0\n ) {\n return false;\n }\n if (graphic.attribute.shadowRootIdx < 0 || (graphic.shadowRoot && graphic.shadowRoot.attribute.shadowRootIdx < 0)) {\n this.drawItem(graphic, renderService, drawContext, drawContribution, params);\n }\n return false;\n }\n\n protected drawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n if (!graphic.shadowRoot) {\n return false;\n }\n\n const { context } = drawContext;\n context.highPerformanceSave();\n // 直接transform\n context.transformFromMatrix(graphic.transMatrix, true);\n\n // 变换dirtyBounds\n if (drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {\n tempDirtyBounds.copy(drawContribution.dirtyBounds);\n tempBackupDirtyBounds.copy(drawContribution.backupDirtyBounds);\n const m = graphic.globalTransMatrix.getInverse();\n drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m);\n drawContribution.backupDirtyBounds.copy(drawContribution.dirtyBounds);\n }\n\n // 设置context的transform到上一个节点\n drawContribution.renderGroup(graphic.shadowRoot, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0));\n\n context.highPerformanceRestore();\n\n if (drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {\n drawContribution.dirtyBounds.copy(tempDirtyBounds);\n drawContribution.backupDirtyBounds.copy(tempBackupDirtyBounds);\n }\n\n return true;\n }\n}\n\n// @injectable()\nexport class DebugDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n\n afterDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n if (graphic.attribute._debug_bounds) {\n this.drawItem(graphic, renderService, drawContext, drawContribution, params);\n }\n return false;\n }\n\n protected drawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n if (!graphic.attribute._debug_bounds) {\n return false;\n }\n\n const { context } = drawContext;\n context.highPerformanceSave();\n // 直接transform\n graphic.parent && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);\n graphic.glyphHost &&\n graphic.glyphHost.parent &&\n context.setTransformFromMatrix(graphic.glyphHost.parent.globalTransMatrix, true);\n\n const b = graphic.AABBBounds;\n\n if (graphic.attribute._debug_bounds !== true) {\n graphic.attribute._debug_bounds(context, graphic);\n }\n context.strokeRect(b.x1, b.y1, b.width(), b.height());\n\n context.highPerformanceRestore();\n\n return true;\n }\n}\n\n@injectable()\nexport class CommonDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n interceptors: IDrawItemInterceptorContribution[];\n constructor() {\n this.interceptors = [\n new ShadowRootDrawItemInterceptorContribution(),\n new Canvas3DDrawItemInterceptor(),\n new InteractiveDrawItemInterceptorContribution(),\n new DebugDrawItemInterceptorContribution()\n ];\n }\n afterDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n for (let i = 0; i < this.interceptors.length; i++) {\n if (\n this.interceptors[i].afterDrawItem &&\n this.interceptors[i].afterDrawItem(graphic, renderService, drawContext, drawContribution, params)\n ) {\n return true;\n }\n }\n return false;\n }\n\n beforeDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 【性能方案】判定写在外层,减少遍历判断耗时,10000条数据减少1ms\n if (\n (!graphic.in3dMode || drawContext.in3dInterceptor) &&\n !graphic.shadowRoot &&\n !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)\n ) {\n return false;\n }\n\n for (let i = 0; i < this.interceptors.length; i++) {\n if (\n this.interceptors[i].beforeDrawItem &&\n this.interceptors[i].beforeDrawItem(graphic, renderService, drawContext, drawContribution, params)\n ) {\n return true;\n }\n }\n return false;\n }\n}\n\n/**\n * 交互层节点拦截器,用于支持交互层图元\n */\n// @injectable()\nexport class InteractiveDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n processing: boolean;\n // afterDrawItem(\n // graphic: IGraphic,\n // renderService: IRenderService,\n // drawContext: IDrawContext,\n // drawContribution: IDrawContribution,\n // params?: IGraphicRenderDrawParams\n // ): boolean {\n\n // if (graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx) {\n // this.drawItem(graphic, renderService, drawContext, drawContribution, params);\n // }\n // return false;\n // }\n\n beforeDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n if (this.processing) {\n return false;\n }\n // 判断是否在交互层\n if (graphic.baseGraphic) {\n return this.beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params);\n }\n return this.beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params);\n }\n\n /**\n * 用于提升interactive\n * @param graphic\n * @param renderService\n * @param drawContext\n * @param drawContribution\n * @param params\n */\n beforeSetInteractive(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n let interactiveGraphic: IGraphic = graphic.interactiveGraphic;\n if (graphic.attribute.globalZIndex) {\n if (!interactiveGraphic) {\n interactiveGraphic = graphic.clone();\n graphic.interactiveGraphic = interactiveGraphic;\n interactiveGraphic.baseGraphic = graphic;\n }\n // 设置位置\n // const m = graphic.globalTransMatrix;\n interactiveGraphic.setAttributes(\n {\n globalZIndex: 0,\n zIndex: graphic.attribute.globalZIndex\n },\n false,\n { skipUpdateCallback: true }\n );\n // 添加到交互层中\n drawContext.stage.tryInitInteractiveLayer();\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n const shadowRoot = this.getShadowRoot(interactiveLayer);\n shadowRoot.add(interactiveGraphic);\n }\n return true;\n } else if (interactiveGraphic) {\n // 从交互层中删除\n drawContext.stage.tryInitInteractiveLayer();\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n const shadowRoot = this.getShadowRoot(interactiveLayer);\n shadowRoot.removeChild(interactiveGraphic);\n }\n graphic.interactiveGraphic = null;\n interactiveGraphic.baseGraphic = null;\n }\n return false;\n }\n\n /**\n * 用于绘制interactive\n * @param graphic\n * @param renderService\n * @param drawContext\n * @param drawContribution\n * @param params\n */\n beforeDrawInteractive(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 默认使用原始的图元\n const baseGraphic = graphic.baseGraphic as IGraphic;\n // 如果主图元被删除了,那把交互图元这个也删除\n // 一直往上找\n let intree = !!baseGraphic.stage;\n let _g = baseGraphic.parent;\n while (intree && _g) {\n if ((_g as any).stage === _g) {\n break;\n }\n intree = !!_g.stage;\n _g = _g.parent;\n }\n if (!intree) {\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n const shadowRoot = this.getShadowRoot(interactiveLayer);\n shadowRoot.removeChild(graphic);\n }\n return true;\n }\n if (baseGraphic) {\n this.processing = true;\n const { context } = drawContext;\n context.highPerformanceSave();\n // 直接transform\n context.setTransformFromMatrix(baseGraphic.parent.globalTransMatrix, true);\n // context.fillRect(0, 0, 100, 100);\n // 设置context的transform到上一个节点\n baseGraphic.isContainer\n ? drawContribution.renderGroup(baseGraphic as IGroup, drawContext, baseGraphic.parent.globalTransMatrix)\n : drawContribution.renderItem(baseGraphic, drawContext);\n\n context.highPerformanceRestore();\n this.processing = false;\n\n return true;\n }\n return false;\n }\n getShadowRoot(interactiveLayer: ILayer) {\n // 获取绑定影子节点的group\n let group = interactiveLayer.getElementById('_interactive_group') as IGroup;\n if (!group) {\n group = graphicCreator.CreateGraphic('group', {});\n group.id = '_interactive_group';\n interactiveLayer.add(group);\n }\n return group.shadowRoot ?? group.attachShadow();\n }\n}\n\n/**\n * 3d拦截器,用于渲染3d视角\n */\n// @injectable()\nexport class Canvas3DDrawItemInterceptor implements IDrawItemInterceptorContribution {\n // canvas?: ICanvas;\n order: number = 1;\n\n beforeDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ) {\n if (!graphic.in3dMode || drawContext.in3dInterceptor) {\n return false;\n }\n\n drawContext.in3dInterceptor = true;\n const { context, stage } = renderService.drawParams;\n const canvas = context.canvas;\n\n // 使用3d模式渲染\n context.save();\n this.initCanvasCtx(context);\n context.camera = stage.camera;\n\n // 将三维矩阵换成四维矩阵\n const m = context.currentMatrix;\n m.a /= context.dpr;\n m.b /= context.dpr;\n m.c /= context.dpr;\n m.d /= context.dpr;\n m.e /= context.dpr;\n m.f /= context.dpr;\n const matrix = mat4Allocate.allocate();\n mat3Tomat4(matrix, m);\n const lastModelMatrix = context.modelMatrix;\n if (lastModelMatrix) {\n if (matrix) {\n const m = mat4Allocate.allocate();\n context.modelMatrix = multiplyMat4Mat4(m, lastModelMatrix, matrix);\n }\n } else {\n context.modelMatrix = matrix;\n }\n context.setTransform(1, 0, 0, 1, 0, 0, true);\n\n // 设置context的transform到上一个节点\n if (graphic.isContainer) {\n draw3dItem(\n context,\n graphic,\n (isPie: boolean, is3d: boolean) => {\n return drawContribution.renderGroup(\n graphic as IGroup,\n drawContext,\n graphic.parent.globalTransMatrix,\n !isPie && is3d\n );\n },\n drawContext\n );\n } else {\n drawContribution.renderItem(graphic, drawContext);\n }\n context.camera = null;\n context.restore();\n\n if (context.modelMatrix !== lastModelMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastModelMatrix;\n\n drawContext.in3dInterceptor = false;\n return true;\n }\n\n initCanvasCtx(context: IContext2d) {\n context.setTransformForCurrent();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/draw-interceptor.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAYlE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAG5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;AASrE,MAAM,eAAe,GAAG,IAAI,UAAU,EAAE,CAAC;A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,CAAC,eAAe,GAAG,KAAK,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa,CAAC,OAAmB;QAC/B,OAAO,CAAC,sBAAsB,EAAE,CAAC;IACnC,CAAC;CACF","file":"draw-interceptor.js","sourcesContent":["import { injectable } from '../../../common/inversify-lite';\nimport { AABBBounds } from '@visactor/vutils';\nimport { mat3Tomat4, multiplyMat4Mat4 } from '../../../common/matrix';\nimport { graphicCreator } from '../../../graphic/graphic-creator';\nimport type {\n IContext2d,\n IDrawContext,\n IDrawContribution,\n IDrawItemInterceptorContribution,\n IGraphic,\n IGraphicRenderDrawParams,\n IGroup,\n ILayer,\n IRenderService\n} from '../../../interface';\nimport { mat4Allocate, matrixAllocate } from '../../../allocator/matrix-allocate';\nimport { draw3dItem } from '../../../common/3d-interceptor';\n\n// 拦截器\nexport const DrawItemInterceptor = Symbol.for('DrawItemInterceptor');\n\n// @injectable()\n// export class DefaultDrawItemInterceptor implements IDrawItemInterceptor {\n// drawItem(graphic: IGraphic, renderService: IRenderService, params?: IGraphicRenderDrawParams): boolean {\n// return false;\n// }\n// }\n\nconst tempDirtyBounds = new AABBBounds();\nconst tempBackupDirtyBounds = new AABBBounds();\n/**\n * 影子节点拦截器,用于渲染影子节点\n */\n// @injectable()\nexport class ShadowRootDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n afterDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 如果graphic没设置shadowRootIdx,shadowRoot设置了,那就使用shadowRoot的shadowRootIdx\n if (\n graphic.attribute.shadowRootIdx == null &&\n graphic.shadowRoot &&\n graphic.shadowRoot.attribute.shadowRootIdx < 0\n ) {\n return false;\n }\n if (\n graphic.attribute.shadowRootIdx > 0 ||\n !graphic.attribute.shadowRootIdx ||\n (graphic.shadowRoot && graphic.shadowRoot.attribute.shadowRootIdx > 0)\n ) {\n this.drawItem(graphic, renderService, drawContext, drawContribution, params);\n }\n return false;\n }\n\n beforeDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 如果graphic没设置shadowRootIdx,shadowRoot设置了,那就使用shadowRoot的shadowRootIdx\n if (\n graphic.attribute.shadowRootIdx == null &&\n graphic.shadowRoot &&\n graphic.shadowRoot.attribute.shadowRootIdx > 0\n ) {\n return false;\n }\n if (graphic.attribute.shadowRootIdx < 0 || (graphic.shadowRoot && graphic.shadowRoot.attribute.shadowRootIdx < 0)) {\n this.drawItem(graphic, renderService, drawContext, drawContribution, params);\n }\n return false;\n }\n\n protected drawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n if (!graphic.shadowRoot) {\n return false;\n }\n\n const { context } = drawContext;\n context.highPerformanceSave();\n // 直接transform\n context.transformFromMatrix(graphic.transMatrix, true);\n\n // 变换dirtyBounds\n if (drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {\n tempDirtyBounds.copy(drawContribution.dirtyBounds);\n tempBackupDirtyBounds.copy(drawContribution.backupDirtyBounds);\n const m = graphic.globalTransMatrix.getInverse();\n drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m);\n drawContribution.backupDirtyBounds.copy(drawContribution.dirtyBounds);\n }\n\n // 设置context的transform到上一个节点\n drawContribution.renderGroup(graphic.shadowRoot, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0));\n\n context.highPerformanceRestore();\n\n if (drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {\n drawContribution.dirtyBounds.copy(tempDirtyBounds);\n drawContribution.backupDirtyBounds.copy(tempBackupDirtyBounds);\n }\n\n return true;\n }\n}\n\n// @injectable()\nexport class DebugDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n\n afterDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n if (graphic.attribute._debug_bounds) {\n this.drawItem(graphic, renderService, drawContext, drawContribution, params);\n }\n return false;\n }\n\n protected drawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n if (!graphic.attribute._debug_bounds) {\n return false;\n }\n\n const { context } = drawContext;\n context.highPerformanceSave();\n // 直接transform\n graphic.parent && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);\n graphic.glyphHost &&\n graphic.glyphHost.parent &&\n context.setTransformFromMatrix(graphic.glyphHost.parent.globalTransMatrix, true);\n\n const b = graphic.AABBBounds;\n\n if (graphic.attribute._debug_bounds !== true) {\n graphic.attribute._debug_bounds(context, graphic);\n }\n context.strokeRect(b.x1, b.y1, b.width(), b.height());\n\n context.highPerformanceRestore();\n\n return true;\n }\n}\n\n@injectable()\nexport class CommonDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n interceptors: IDrawItemInterceptorContribution[];\n constructor() {\n this.interceptors = [\n new ShadowRootDrawItemInterceptorContribution(),\n new Canvas3DDrawItemInterceptor(),\n new InteractiveDrawItemInterceptorContribution(),\n new DebugDrawItemInterceptorContribution()\n ];\n }\n afterDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 【性能方案】判定写在外层,减少遍历判断耗时,10000条数据减少1ms\n if (\n (!graphic.in3dMode || drawContext.in3dInterceptor) &&\n !graphic.shadowRoot &&\n !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)\n ) {\n return false;\n }\n\n for (let i = 0; i < this.interceptors.length; i++) {\n if (\n this.interceptors[i].afterDrawItem &&\n this.interceptors[i].afterDrawItem(graphic, renderService, drawContext, drawContribution, params)\n ) {\n return true;\n }\n }\n return false;\n }\n\n beforeDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 【性能方案】判定写在外层,减少遍历判断耗时,10000条数据减少1ms\n if (\n (!graphic.in3dMode || drawContext.in3dInterceptor) &&\n !graphic.shadowRoot &&\n !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)\n ) {\n return false;\n }\n\n for (let i = 0; i < this.interceptors.length; i++) {\n if (\n this.interceptors[i].beforeDrawItem &&\n this.interceptors[i].beforeDrawItem(graphic, renderService, drawContext, drawContribution, params)\n ) {\n return true;\n }\n }\n return false;\n }\n}\n\n/**\n * 交互层节点拦截器,用于支持交互层图元\n */\n// @injectable()\nexport class InteractiveDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n processing: boolean;\n // afterDrawItem(\n // graphic: IGraphic,\n // renderService: IRenderService,\n // drawContext: IDrawContext,\n // drawContribution: IDrawContribution,\n // params?: IGraphicRenderDrawParams\n // ): boolean {\n\n // if (graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx) {\n // this.drawItem(graphic, renderService, drawContext, drawContribution, params);\n // }\n // return false;\n // }\n\n beforeDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n if (this.processing) {\n return false;\n }\n // 判断是否在交互层\n if (graphic.baseGraphic) {\n return this.beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params);\n }\n return this.beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params);\n }\n\n /**\n * 用于提升interactive\n * @param graphic\n * @param renderService\n * @param drawContext\n * @param drawContribution\n * @param params\n */\n beforeSetInteractive(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n let interactiveGraphic: IGraphic = graphic.interactiveGraphic;\n if (graphic.attribute.globalZIndex) {\n if (!interactiveGraphic) {\n interactiveGraphic = graphic.clone();\n graphic.interactiveGraphic = interactiveGraphic;\n interactiveGraphic.baseGraphic = graphic;\n }\n // 设置位置\n // const m = graphic.globalTransMatrix;\n interactiveGraphic.setAttributes(\n {\n globalZIndex: 0,\n zIndex: graphic.attribute.globalZIndex\n },\n false,\n { skipUpdateCallback: true }\n );\n // 添加到交互层中\n drawContext.stage.tryInitInteractiveLayer();\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n const shadowRoot = this.getShadowRoot(interactiveLayer);\n shadowRoot.add(interactiveGraphic);\n }\n return true;\n } else if (interactiveGraphic) {\n // 从交互层中删除\n drawContext.stage.tryInitInteractiveLayer();\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n const shadowRoot = this.getShadowRoot(interactiveLayer);\n shadowRoot.removeChild(interactiveGraphic);\n }\n graphic.interactiveGraphic = null;\n interactiveGraphic.baseGraphic = null;\n }\n return false;\n }\n\n /**\n * 用于绘制interactive\n * @param graphic\n * @param renderService\n * @param drawContext\n * @param drawContribution\n * @param params\n */\n beforeDrawInteractive(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 默认使用原始的图元\n const baseGraphic = graphic.baseGraphic as IGraphic;\n // 如果主图元被删除了,那把交互图元这个也删除\n // 一直往上找\n let intree = !!baseGraphic.stage;\n let _g = baseGraphic.parent;\n while (intree && _g) {\n if ((_g as any).stage === _g) {\n break;\n }\n intree = !!_g.stage;\n _g = _g.parent;\n }\n if (!intree) {\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n const shadowRoot = this.getShadowRoot(interactiveLayer);\n shadowRoot.removeChild(graphic);\n }\n return true;\n }\n if (baseGraphic) {\n this.processing = true;\n const { context } = drawContext;\n context.highPerformanceSave();\n // 直接transform\n context.setTransformFromMatrix(baseGraphic.parent.globalTransMatrix, true);\n // context.fillRect(0, 0, 100, 100);\n // 设置context的transform到上一个节点\n baseGraphic.isContainer\n ? drawContribution.renderGroup(baseGraphic as IGroup, drawContext, baseGraphic.parent.globalTransMatrix)\n : drawContribution.renderItem(baseGraphic, drawContext);\n\n context.highPerformanceRestore();\n this.processing = false;\n\n return true;\n }\n return false;\n }\n getShadowRoot(interactiveLayer: ILayer) {\n // 获取绑定影子节点的group\n let group = interactiveLayer.getElementById('_interactive_group') as IGroup;\n if (!group) {\n group = graphicCreator.CreateGraphic('group', {});\n group.id = '_interactive_group';\n interactiveLayer.add(group);\n }\n return group.shadowRoot ?? group.attachShadow();\n }\n}\n\n/**\n * 3d拦截器,用于渲染3d视角\n */\n// @injectable()\nexport class Canvas3DDrawItemInterceptor implements IDrawItemInterceptorContribution {\n // canvas?: ICanvas;\n order: number = 1;\n\n beforeDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ) {\n if (!graphic.in3dMode || drawContext.in3dInterceptor) {\n return false;\n }\n\n drawContext.in3dInterceptor = true;\n const { context, stage } = renderService.drawParams;\n const canvas = context.canvas;\n\n // 使用3d模式渲染\n context.save();\n this.initCanvasCtx(context);\n context.camera = stage.camera;\n\n // 将三维矩阵换成四维矩阵\n const m = context.currentMatrix;\n m.a /= context.dpr;\n m.b /= context.dpr;\n m.c /= context.dpr;\n m.d /= context.dpr;\n m.e /= context.dpr;\n m.f /= context.dpr;\n const matrix = mat4Allocate.allocate();\n mat3Tomat4(matrix, m);\n const lastModelMatrix = context.modelMatrix;\n if (lastModelMatrix) {\n if (matrix) {\n const m = mat4Allocate.allocate();\n context.modelMatrix = multiplyMat4Mat4(m, lastModelMatrix, matrix);\n }\n } else {\n context.modelMatrix = matrix;\n }\n context.setTransform(1, 0, 0, 1, 0, 0, true);\n\n // 设置context的transform到上一个节点\n if (graphic.isContainer) {\n draw3dItem(\n context,\n graphic,\n (isPie: boolean, is3d: boolean) => {\n return drawContribution.renderGroup(\n graphic as IGroup,\n drawContext,\n graphic.parent.globalTransMatrix,\n !isPie && is3d\n );\n },\n drawContext\n );\n } else {\n drawContribution.renderItem(graphic, drawContext);\n }\n context.camera = null;\n context.restore();\n\n if (context.modelMatrix !== lastModelMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastModelMatrix;\n\n drawContext.in3dInterceptor = false;\n return true;\n }\n\n initCanvasCtx(context: IContext2d) {\n context.setTransformForCurrent();\n }\n}\n"]}
@@ -1,10 +1,10 @@
1
- import type { IGraphicAttribute, IContext2d, IGroup, IMarkAttribute, IThemeAttribute, IGroupRenderContribution, IDrawContext, IRenderService, IGraphicRender, IGraphicRenderDrawParams, IContributionProvider } from '../../../interface';
1
+ import type { IGraphicAttribute, IContext2d, IGroup, IMarkAttribute, IThemeAttribute, IGroupRenderContribution, IDrawContext, IRenderService, IGraphicRender, IGraphicRenderDrawParams, IContributionProvider, IGroupGraphicAttribute } from '../../../interface';
2
2
  export declare class DefaultCanvasGroupRender implements IGraphicRender {
3
3
  protected readonly groupRenderContribitions: IContributionProvider<IGroupRenderContribution>;
4
4
  type: 'group';
5
5
  numberType: number;
6
6
  _groupRenderContribitions: IGroupRenderContribution[];
7
7
  constructor(groupRenderContribitions: IContributionProvider<IGroupRenderContribution>);
8
- drawShape(group: IGroup, context: IContext2d, x: number, y: number, drawContext: IDrawContext, params?: IGraphicRenderDrawParams, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
8
+ drawShape(group: IGroup, context: IContext2d, x: number, y: number, drawContext: IDrawContext, params?: IGraphicRenderDrawParams, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, groupAttribute?: Required<IGroupGraphicAttribute>): void;
9
9
  draw(group: IGroup, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams): void;
10
10
  }