@visactor/vrender-core 0.22.9-alpha.1 → 0.22.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/cjs/common/contribution-provider.d.ts +0 -16
  2. package/cjs/common/contribution-provider.js +2 -21
  3. package/cjs/common/contribution-provider.js.map +1 -1
  4. package/cjs/common/polygon.js +1 -0
  5. package/cjs/common/render-area.js +0 -1
  6. package/cjs/common/segment/index.js +3 -0
  7. package/cjs/common/segment/index.js.map +1 -1
  8. package/cjs/common/segment/step.d.ts +6 -0
  9. package/cjs/common/segment/step.js +19 -2
  10. package/cjs/common/segment/step.js.map +1 -1
  11. package/cjs/common/sort.js +1 -1
  12. package/cjs/common/split-path.js +1 -1
  13. package/cjs/core/global.d.ts +5 -7
  14. package/cjs/core/global.js +13 -13
  15. package/cjs/core/global.js.map +1 -1
  16. package/cjs/core/stage.d.ts +0 -1
  17. package/cjs/core/stage.js +0 -3
  18. package/cjs/core/stage.js.map +1 -1
  19. package/cjs/core/window.d.ts +4 -5
  20. package/cjs/core/window.js +13 -14
  21. package/cjs/core/window.js.map +1 -1
  22. package/cjs/event/event-system.js +10 -11
  23. package/cjs/event/event-system.js.map +1 -1
  24. package/cjs/graphic/graphic.d.ts +1 -1
  25. package/cjs/graphic/graphic.js +5 -12
  26. package/cjs/graphic/graphic.js.map +1 -1
  27. package/cjs/index.d.ts +0 -2
  28. package/cjs/index.js +2 -4
  29. package/cjs/index.js.map +1 -1
  30. package/cjs/interface/common.d.ts +1 -1
  31. package/cjs/interface/common.js.map +1 -1
  32. package/cjs/interface/global.d.ts +1 -2
  33. package/cjs/interface/global.js.map +1 -1
  34. package/cjs/interface/picker.d.ts +0 -1
  35. package/cjs/interface/picker.js.map +1 -1
  36. package/cjs/interface/render.d.ts +0 -3
  37. package/cjs/interface/render.js.map +1 -1
  38. package/cjs/interface/window.d.ts +0 -1
  39. package/cjs/interface/window.js.map +1 -1
  40. package/cjs/picker/global-picker-service.d.ts +0 -1
  41. package/cjs/picker/global-picker-service.js +0 -1
  42. package/cjs/picker/global-picker-service.js.map +1 -1
  43. package/cjs/picker/picker-service.d.ts +0 -1
  44. package/cjs/picker/picker-service.js +0 -3
  45. package/cjs/picker/picker-service.js.map +1 -1
  46. package/cjs/render/contributions/render/arc-render.d.ts +2 -2
  47. package/cjs/render/contributions/render/arc-render.js +3 -3
  48. package/cjs/render/contributions/render/arc-render.js.map +1 -1
  49. package/cjs/render/contributions/render/area-render.d.ts +2 -2
  50. package/cjs/render/contributions/render/area-render.js +3 -3
  51. package/cjs/render/contributions/render/area-render.js.map +1 -1
  52. package/cjs/render/contributions/render/base-render.d.ts +0 -2
  53. package/cjs/render/contributions/render/base-render.js +0 -3
  54. package/cjs/render/contributions/render/base-render.js.map +1 -1
  55. package/cjs/render/contributions/render/circle-render.d.ts +2 -2
  56. package/cjs/render/contributions/render/circle-render.js +3 -3
  57. package/cjs/render/contributions/render/circle-render.js.map +1 -1
  58. package/cjs/render/contributions/render/draw-contribution.d.ts +0 -1
  59. package/cjs/render/contributions/render/draw-contribution.js +0 -5
  60. package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
  61. package/cjs/render/contributions/render/glyph-render.d.ts +0 -1
  62. package/cjs/render/contributions/render/glyph-render.js +0 -1
  63. package/cjs/render/contributions/render/glyph-render.js.map +1 -1
  64. package/cjs/render/contributions/render/graphic-render.d.ts +0 -1
  65. package/cjs/render/contributions/render/graphic-render.js.map +1 -1
  66. package/cjs/render/contributions/render/group-render.d.ts +0 -1
  67. package/cjs/render/contributions/render/group-render.js +0 -4
  68. package/cjs/render/contributions/render/group-render.js.map +1 -1
  69. package/cjs/render/contributions/render/image-render.d.ts +2 -2
  70. package/cjs/render/contributions/render/image-render.js +3 -3
  71. package/cjs/render/contributions/render/image-render.js.map +1 -1
  72. package/cjs/render/contributions/render/path-render.d.ts +2 -2
  73. package/cjs/render/contributions/render/path-render.js +3 -3
  74. package/cjs/render/contributions/render/path-render.js.map +1 -1
  75. package/cjs/render/contributions/render/polygon-render.d.ts +2 -2
  76. package/cjs/render/contributions/render/polygon-render.js +3 -3
  77. package/cjs/render/contributions/render/polygon-render.js.map +1 -1
  78. package/cjs/render/contributions/render/rect-render.d.ts +2 -2
  79. package/cjs/render/contributions/render/rect-render.js +3 -3
  80. package/cjs/render/contributions/render/rect-render.js.map +1 -1
  81. package/cjs/render/contributions/render/symbol-render.d.ts +2 -2
  82. package/cjs/render/contributions/render/symbol-render.js +3 -3
  83. package/cjs/render/contributions/render/symbol-render.js.map +1 -1
  84. package/cjs/render/contributions/render/text-render.d.ts +2 -2
  85. package/cjs/render/contributions/render/text-render.js +3 -3
  86. package/cjs/render/contributions/render/text-render.js.map +1 -1
  87. package/cjs/render/render-service.d.ts +0 -1
  88. package/cjs/render/render-service.js +0 -3
  89. package/cjs/render/render-service.js.map +1 -1
  90. package/dist/index.es.js +121 -293
  91. package/es/common/contribution-provider.d.ts +0 -16
  92. package/es/common/contribution-provider.js +1 -20
  93. package/es/common/contribution-provider.js.map +1 -1
  94. package/es/common/polygon.js +2 -1
  95. package/es/common/render-area.js +1 -2
  96. package/es/common/segment/index.js +4 -1
  97. package/es/common/segment/index.js.map +1 -1
  98. package/es/common/segment/step.d.ts +6 -0
  99. package/es/common/segment/step.js +13 -0
  100. package/es/common/segment/step.js.map +1 -1
  101. package/es/common/sort.js +1 -1
  102. package/es/common/split-path.js +1 -1
  103. package/es/core/global.d.ts +5 -7
  104. package/es/core/global.js +12 -14
  105. package/es/core/global.js.map +1 -1
  106. package/es/core/stage.d.ts +0 -1
  107. package/es/core/stage.js +0 -3
  108. package/es/core/stage.js.map +1 -1
  109. package/es/core/window.d.ts +4 -5
  110. package/es/core/window.js +12 -15
  111. package/es/core/window.js.map +1 -1
  112. package/es/event/event-system.js +10 -11
  113. package/es/event/event-system.js.map +1 -1
  114. package/es/graphic/graphic.d.ts +1 -1
  115. package/es/graphic/graphic.js +5 -12
  116. package/es/graphic/graphic.js.map +1 -1
  117. package/es/index.d.ts +0 -2
  118. package/es/index.js +0 -4
  119. package/es/index.js.map +1 -1
  120. package/es/interface/common.d.ts +1 -1
  121. package/es/interface/common.js.map +1 -1
  122. package/es/interface/global.d.ts +1 -2
  123. package/es/interface/global.js.map +1 -1
  124. package/es/interface/picker.d.ts +0 -1
  125. package/es/interface/picker.js.map +1 -1
  126. package/es/interface/render.d.ts +0 -3
  127. package/es/interface/render.js.map +1 -1
  128. package/es/interface/window.d.ts +0 -1
  129. package/es/interface/window.js.map +1 -1
  130. package/es/picker/global-picker-service.d.ts +0 -1
  131. package/es/picker/global-picker-service.js +0 -1
  132. package/es/picker/global-picker-service.js.map +1 -1
  133. package/es/picker/picker-service.d.ts +0 -1
  134. package/es/picker/picker-service.js +0 -3
  135. package/es/picker/picker-service.js.map +1 -1
  136. package/es/render/contributions/render/arc-render.d.ts +2 -2
  137. package/es/render/contributions/render/arc-render.js +3 -3
  138. package/es/render/contributions/render/arc-render.js.map +1 -1
  139. package/es/render/contributions/render/area-render.d.ts +2 -2
  140. package/es/render/contributions/render/area-render.js +3 -3
  141. package/es/render/contributions/render/area-render.js.map +1 -1
  142. package/es/render/contributions/render/base-render.d.ts +0 -2
  143. package/es/render/contributions/render/base-render.js +0 -3
  144. package/es/render/contributions/render/base-render.js.map +1 -1
  145. package/es/render/contributions/render/circle-render.d.ts +2 -2
  146. package/es/render/contributions/render/circle-render.js +3 -3
  147. package/es/render/contributions/render/circle-render.js.map +1 -1
  148. package/es/render/contributions/render/draw-contribution.d.ts +0 -1
  149. package/es/render/contributions/render/draw-contribution.js +0 -5
  150. package/es/render/contributions/render/draw-contribution.js.map +1 -1
  151. package/es/render/contributions/render/glyph-render.d.ts +0 -1
  152. package/es/render/contributions/render/glyph-render.js +0 -1
  153. package/es/render/contributions/render/glyph-render.js.map +1 -1
  154. package/es/render/contributions/render/graphic-render.d.ts +0 -1
  155. package/es/render/contributions/render/graphic-render.js.map +1 -1
  156. package/es/render/contributions/render/group-render.d.ts +0 -1
  157. package/es/render/contributions/render/group-render.js +0 -4
  158. package/es/render/contributions/render/group-render.js.map +1 -1
  159. package/es/render/contributions/render/image-render.d.ts +2 -2
  160. package/es/render/contributions/render/image-render.js +3 -3
  161. package/es/render/contributions/render/image-render.js.map +1 -1
  162. package/es/render/contributions/render/path-render.d.ts +2 -2
  163. package/es/render/contributions/render/path-render.js +3 -3
  164. package/es/render/contributions/render/path-render.js.map +1 -1
  165. package/es/render/contributions/render/polygon-render.d.ts +2 -2
  166. package/es/render/contributions/render/polygon-render.js +3 -3
  167. package/es/render/contributions/render/polygon-render.js.map +1 -1
  168. package/es/render/contributions/render/rect-render.d.ts +2 -2
  169. package/es/render/contributions/render/rect-render.js +3 -3
  170. package/es/render/contributions/render/rect-render.js.map +1 -1
  171. package/es/render/contributions/render/symbol-render.d.ts +2 -2
  172. package/es/render/contributions/render/symbol-render.js +3 -3
  173. package/es/render/contributions/render/symbol-render.js.map +1 -1
  174. package/es/render/contributions/render/text-render.d.ts +2 -2
  175. package/es/render/contributions/render/text-render.js +3 -3
  176. package/es/render/contributions/render/text-render.js.map +1 -1
  177. package/es/render/render-service.d.ts +0 -1
  178. package/es/render/render-service.js +0 -3
  179. package/es/render/render-service.js.map +1 -1
  180. package/package.json +3 -3
  181. package/cjs/common/event-listener-manager.d.ts +0 -14
  182. package/cjs/common/event-listener-manager.js +0 -52
  183. package/cjs/common/event-listener-manager.js.map +0 -1
  184. package/cjs/common/event-transformer.d.ts +0 -12
  185. package/cjs/common/event-transformer.js +0 -73
  186. package/cjs/common/event-transformer.js.map +0 -1
  187. package/cjs/interface/event-listener-manager.d.ts +0 -7
  188. package/cjs/interface/event-listener-manager.js +0 -6
  189. package/cjs/interface/event-listener-manager.js.map +0 -1
  190. package/es/common/event-listener-manager.d.ts +0 -14
  191. package/es/common/event-listener-manager.js +0 -44
  192. package/es/common/event-listener-manager.js.map +0 -1
  193. package/es/common/event-transformer.d.ts +0 -12
  194. package/es/common/event-transformer.js +0 -63
  195. package/es/common/event-transformer.js.map +0 -1
  196. package/es/interface/event-listener-manager.d.ts +0 -7
  197. package/es/interface/event-listener-manager.js +0 -2
  198. package/es/interface/event-listener-manager.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/draw-contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAAwF;AAexF,+CAAgE;AAEhE,iFAA6E;AAC7E,oDAA2D;AAE3D,6CAA8F;AAC9F,kDAA+C;AAC/C,qCAAsE;AACtE,yDAAyD;AACzD,+DAA2D;AAE3D,wEAAoE;AACpE,wEAAoE;AACpE,sDAAmD;AAM5C,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAgBlC,YAIiD,aAA+B,EAK3D,gCAAyF;QAL7D,kBAAa,GAAb,aAAa,CAAkB;QAK3D,qCAAgC,GAAhC,gCAAgC,CAAyD;QAE5G,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,WAAW,GAAG,IAAI,eAAM,EAAE,CAAC;QAChC,IAAI,CAAC,iBAAiB,GAAG,IAAI,eAAM,EAAE,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,yBAAW,CAAC,MAAM,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,yBAAW,CAAC,YAAY,CAAC;QAC7C,IAAI,CAAC,IAAA,gBAAO,EAAC,IAAI,CAAC,aAAa,CAAC,EAAE;YAChC,IAAI,CAAC,aAAa,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAC3C;QACD,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC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,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;AA1bY,uBAAuB;IADnC,IAAA,2BAAU,GAAE;IAqBR,WAAA,IAAA,4BAAW,EAAC,sBAAa,CAAC,CAAA;IAG1B,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,sCAAmB,CAAC,CAAA;;GAxBlB,uBAAuB,CA0bnC;AA1bY,0DAAuB","file":"draw-contribution.js","sourcesContent":["import { injectable, inject, named, multiInject } from '../../../common/inversify-lite';\nimport type {\n IContext2d,\n MaybePromise,\n IGraphic,\n IGroup,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider,\n IDrawItemInterceptorContribution,\n IDrawContribution,\n IGlobal\n} from '../../../interface';\nimport { findNextGraphic, foreach } from '../../../common/sort';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { DefaultAttribute } from '../../../graphic/config';\nimport type { IAABBBounds, IBounds, IMatrix } from '@visactor/vutils';\nimport { Bounds, Logger, getRectIntersect, isArray, isRectIntersect } from '@visactor/vutils';\nimport { container } from '../../../container';\nimport { GraphicRender, IncrementalDrawContribution } from './symbol';\nimport { DrawItemInterceptor } from './draw-interceptor';\nimport { createColor } from '../../../common/canvas-utils';\nimport type { ILayerService } from '../../../interface/core';\nimport { boundsAllocate } from '../../../allocator/bounds-allocate';\nimport { matrixAllocate } from '../../../allocator/matrix-allocate';\nimport { application } from '../../../application';\n\n/**\n * 默认的渲染contribution,基于树状结构针对图元的渲染\n */\n@injectable()\nexport class DefaultDrawContribution implements IDrawContribution {\n declare currentRenderMap: Map<number, IGraphicRender>;\n declare defaultRenderMap: Map<number, IGraphicRender>;\n declare styleRenderMap: Map<string, Map<number, IGraphicRender>>;\n declare dirtyBounds: IBounds;\n declare backupDirtyBounds: IBounds;\n // 是否使用dirtyBounds\n declare useDirtyBounds: boolean;\n declare currentRenderService: IRenderService;\n declare InterceptorContributions: IDrawItemInterceptorContribution[];\n\n declare global: IGlobal;\n declare layerService: ILayerService;\n\n declare scrollMatrix?: IMatrix;\n\n constructor(\n // @inject(ContributionProvider)\n // @named(GraphicRender)\n // protected readonly contributions: ContributionProvider<IGraphicRender>,\n @multiInject(GraphicRender) protected readonly contributions: IGraphicRender[],\n // @inject(RenderSelector) protected readonly renderSelector: IRenderSelector, // 根据图元类型选择对应的renderItem进行渲染\n // 拦截器\n @inject(ContributionProvider)\n @named(DrawItemInterceptor)\n protected readonly drawItemInterceptorContributions: IContributionProvider<IDrawItemInterceptorContribution>\n ) {\n this.currentRenderMap = new Map();\n this.defaultRenderMap = new Map();\n this.styleRenderMap = new Map();\n this.dirtyBounds = new Bounds();\n this.backupDirtyBounds = new Bounds();\n this.global = application.global;\n this.layerService = application.layerService;\n if (!isArray(this.contributions)) {\n this.contributions = [this.contributions];\n }\n this.init();\n }\n\n reInit() {\n this.init();\n this.contributions.forEach(item => {\n item.reInit();\n });\n }\n\n init() {\n this.contributions.forEach(item => {\n if (item.style) {\n const map = this.styleRenderMap.get(item.style) || new Map();\n map.set(item.numberType, item);\n this.styleRenderMap.set(item.style, map);\n } else {\n this.defaultRenderMap.set(item.numberType, item);\n }\n });\n this.InterceptorContributions = this.drawItemInterceptorContributions\n .getContributions()\n .sort((a, b) => a.order - b.order);\n }\n\n prepareForDraw(renderService: IRenderService, drawContext: IDrawContext) {\n // 有dirtyBounds用dirtyBounds\n if (drawContext.updateBounds) {\n this.useDirtyBounds = true;\n } else {\n // 没有的话,看看是否需要跳过outRange的渲染\n this.useDirtyBounds = !drawContext.stage.params.optimize.disableCheckGraphicWidthOutRange;\n }\n }\n\n draw(renderService: IRenderService, drawContext: IDrawContext): MaybePromise<void> {\n this.prepareForDraw(renderService, drawContext);\n drawContext.drawContribution = this;\n this.currentRenderMap = this.styleRenderMap.get(drawContext.renderStyle) || this.defaultRenderMap;\n // this.startAtId = drawParams.startAtId;\n this.currentRenderService = renderService;\n // this.drawParams = drawParams;\n const { context, stage, viewBox, transMatrix } = drawContext;\n\n if (!context) {\n return;\n }\n // if (context.drawPromise) {\n // return;\n // }\n const dirtyBounds: IBounds | undefined = this.dirtyBounds.setValue(0, 0, viewBox.width(), viewBox.height());\n if (stage.dirtyBounds && !stage.dirtyBounds.empty()) {\n const b = getRectIntersect(dirtyBounds, stage.dirtyBounds, false);\n dirtyBounds.x1 = Math.floor(b.x1);\n dirtyBounds.y1 = Math.floor(b.y1);\n dirtyBounds.x2 = Math.ceil(b.x2);\n dirtyBounds.y2 = Math.ceil(b.y2);\n }\n // 如果dpr不是整数或者.5的小数,需要格式化dirtyBounds\n const d = context.dpr % 1;\n if (d || d !== 0.5) {\n dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr;\n dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr;\n dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr;\n dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr;\n }\n this.backupDirtyBounds.copy(dirtyBounds);\n 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,mEAAwF;AAexF,+CAAgE;AAEhE,iFAA6E;AAC7E,oDAA2D;AAE3D,6CAA8F;AAC9F,kDAA+C;AAC/C,qCAAsE;AACtE,yDAAyD;AACzD,+DAA2D;AAE3D,wEAAoE;AACpE,wEAAoE;AACpE,sDAAmD;AAM5C,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAgBlC,YAIiD,aAA+B,EAK3D,gCAAyF;QAL7D,kBAAa,GAAb,aAAa,CAAkB;QAK3D,qCAAgC,GAAhC,gCAAgC,CAAyD;QAE5G,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,WAAW,GAAG,IAAI,e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S,IAAI,GAAG,CAAC,IAAI,EAAE;oBAC9C,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;iBAClD;aACF;iBAAM;gBACL,OAAO,CAAC,SAAS,GAAG,IAAA,0BAAW,EAC7B,OAAO,EACP,KAAK,EACL;oBACE,UAAU,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,EAAE;iBAC5D,EACD,CAAC,EACD,CAAC,CACF,CAAC;gBACF,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;aACvC;SACF;IACH,CAAC;IAED,SAAS,CAAC,aAA6B,EAAE,UAAwB;QAC/D,OAAO;IACT,CAAC;CACF,CAAA;AAnbY,uBAAuB;IADnC,IAAA,2BAAU,GAAE;IAqBR,WAAA,IAAA,4BAAW,EAAC,sBAAa,CAAC,CAAA;IAG1B,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,sCAAmB,CAAC,CAAA;;GAxBlB,uBAAuB,CAmbnC;AAnbY,0DAAuB","file":"draw-contribution.js","sourcesContent":["import { injectable, inject, named, multiInject } from '../../../common/inversify-lite';\nimport type {\n IContext2d,\n MaybePromise,\n IGraphic,\n IGroup,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider,\n IDrawItemInterceptorContribution,\n IDrawContribution,\n IGlobal\n} from '../../../interface';\nimport { findNextGraphic, foreach } from '../../../common/sort';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { DefaultAttribute } from '../../../graphic/config';\nimport type { IAABBBounds, IBounds, IMatrix } from '@visactor/vutils';\nimport { Bounds, Logger, getRectIntersect, isArray, isRectIntersect } from '@visactor/vutils';\nimport { container } from '../../../container';\nimport { GraphicRender, IncrementalDrawContribution } from './symbol';\nimport { DrawItemInterceptor } from './draw-interceptor';\nimport { createColor } from '../../../common/canvas-utils';\nimport type { ILayerService } from '../../../interface/core';\nimport { boundsAllocate } from '../../../allocator/bounds-allocate';\nimport { matrixAllocate } from '../../../allocator/matrix-allocate';\nimport { application } from '../../../application';\n\n/**\n * 默认的渲染contribution,基于树状结构针对图元的渲染\n */\n@injectable()\nexport class DefaultDrawContribution implements IDrawContribution {\n declare currentRenderMap: Map<number, IGraphicRender>;\n declare defaultRenderMap: Map<number, IGraphicRender>;\n declare styleRenderMap: Map<string, Map<number, IGraphicRender>>;\n declare dirtyBounds: IBounds;\n declare backupDirtyBounds: IBounds;\n // 是否使用dirtyBounds\n declare useDirtyBounds: boolean;\n declare currentRenderService: IRenderService;\n declare InterceptorContributions: IDrawItemInterceptorContribution[];\n\n declare global: IGlobal;\n declare layerService: ILayerService;\n\n declare scrollMatrix?: IMatrix;\n\n constructor(\n // @inject(ContributionProvider)\n // @named(GraphicRender)\n // protected readonly contributions: ContributionProvider<IGraphicRender>,\n @multiInject(GraphicRender) protected readonly contributions: IGraphicRender[],\n // @inject(RenderSelector) protected readonly renderSelector: IRenderSelector, // 根据图元类型选择对应的renderItem进行渲染\n // 拦截器\n @inject(ContributionProvider)\n @named(DrawItemInterceptor)\n protected readonly drawItemInterceptorContributions: IContributionProvider<IDrawItemInterceptorContribution>\n ) {\n this.currentRenderMap = new Map();\n this.defaultRenderMap = new Map();\n this.styleRenderMap = new Map();\n this.dirtyBounds = new Bounds();\n this.backupDirtyBounds = new Bounds();\n this.global = application.global;\n this.layerService = application.layerService;\n if (!isArray(this.contributions)) {\n this.contributions = [this.contributions];\n }\n this.init();\n }\n\n 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"]}
@@ -2,7 +2,6 @@ import type { IGraphicAttribute, IContext2d, IGlyph, IMarkAttribute, IThemeAttri
2
2
  export declare class DefaultCanvasGlyphRender implements IGraphicRender {
3
3
  type: 'glyph';
4
4
  numberType: number;
5
- reInit(): void;
6
5
  drawShape(glyph: IGlyph, 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;
7
6
  draw(glyph: IGlyph, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams): void;
8
7
  }
@@ -16,7 +16,6 @@ let DefaultCanvasGlyphRender = class {
16
16
  constructor() {
17
17
  this.numberType = constants_1.GLYPH_NUMBER_TYPE;
18
18
  }
19
- reInit() {}
20
19
  drawShape(glyph, context, x, y, drawContext, params, fillCb, strokeCb) {
21
20
  drawContext.drawContribution && glyph.getSubGraphic().forEach((item => {
22
21
  const renderer = drawContext.drawContribution.getRenderContribution(item);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/glyph-render.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mEAA4D;AAC5D,kDAAkD;AAClD,0DAA+D;AAcxD,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAA9B;QAEL,eAAU,GAAW,6BAAiB,CAAC;IAyDzC,CAAC;IArDC,MAAM;QACJ,OAAO;IACT,CAAC;IAED,SAAS,CACP,KAAa,EACb,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ,QAIY;QAEZ,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE;YACjC,OAAO;SACR;QACD,KAAK,CAAC,aAAa,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACnC,MAAM,QAAQ,GAAG,WAAW,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;YAC1E,IAAI,QAAQ,IAAI,QAAQ,CAAC,SAAS,EAAE;gBAClC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;aAChF;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,KAAa,EAAE,aAA6B,EAAE,WAAyB,EAAE,MAAiC;QAC7G,MAAM,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;SACR;QAED,OAAO,CAAC,mBAAmB,EAAE,CAAC;QAE9B,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE;YACjC,OAAO;SACR;QACD,MAAM,UAAU,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;QACnC,MAAM,UAAU,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;QACzC,UAAU,CAAC,MAAM;YACf,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;gBACrB,WAAW,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;YACjF,CAAC,CAAC,CAAC;QAEL,OAAO,CAAC,sBAAsB,EAAE,CAAC;IACnC,CAAC;CACF,CAAA;AA3DY,wBAAwB;IADpC,IAAA,2BAAU,GAAE;GACA,wBAAwB,CA2DpC;AA3DY,4DAAwB","file":"glyph-render.js","sourcesContent":["import { injectable } from '../../../common/inversify-lite';\nimport { getTheme } from '../../../graphic/theme';\nimport { GLYPH_NUMBER_TYPE } from '../../../graphic/constants';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IGlyph,\n IMarkAttribute,\n IThemeAttribute,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams\n} from '../../../interface';\n\n@injectable()\nexport class DefaultCanvasGlyphRender implements IGraphicRender {\n type: 'glyph';\n numberType: number = GLYPH_NUMBER_TYPE;\n\n // constructor() {}\n\n reInit() {\n return;\n }\n\n drawShape(\n glyph: IGlyph,\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 (!drawContext.drawContribution) {\n return;\n }\n glyph.getSubGraphic().forEach(item => {\n const renderer = drawContext.drawContribution.getRenderContribution(item);\n if (renderer && renderer.drawShape) {\n renderer.drawShape(item, context, x, y, drawContext, params, fillCb, strokeCb);\n }\n });\n }\n\n draw(glyph: IGlyph, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const { context } = drawContext;\n if (!context) {\n return;\n }\n\n context.highPerformanceSave();\n\n if (!drawContext.drawContribution) {\n return;\n }\n const glyphTheme = getTheme(glyph);\n const subGraphic = glyph.getSubGraphic();\n subGraphic.length &&\n subGraphic.forEach(g => {\n drawContext.drawContribution.renderItem(g, drawContext, { theme: glyphTheme });\n });\n\n context.highPerformanceRestore();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/glyph-render.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mEAA4D;AAC5D,kDAAkD;AAClD,0DAA+D;AAcxD,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAA9B;QAEL,eAAU,GAAW,6BAAiB,CAAC;IAqDzC,CAAC;IAjDC,SAAS,CACP,KAAa,EACb,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ,QAIY;QAEZ,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE;YACjC,OAAO;SACR;QACD,KAAK,CAAC,aAAa,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACnC,MAAM,QAAQ,GAAG,WAAW,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;YAC1E,IAAI,QAAQ,IAAI,QAAQ,CAAC,SAAS,EAAE;gBAClC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;aAChF;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,KAAa,EAAE,aAA6B,EAAE,WAAyB,EAAE,MAAiC;QAC7G,MAAM,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;SACR;QAED,OAAO,CAAC,mBAAmB,EAAE,CAAC;QAE9B,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE;YACjC,OAAO;SACR;QACD,MAAM,UAAU,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;QACnC,MAAM,UAAU,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;QACzC,UAAU,CAAC,MAAM;YACf,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;gBACrB,WAAW,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;YACjF,CAAC,CAAC,CAAC;QAEL,OAAO,CAAC,sBAAsB,EAAE,CAAC;IACnC,CAAC;CACF,CAAA;AAvDY,wBAAwB;IADpC,IAAA,2BAAU,GAAE;GACA,wBAAwB,CAuDpC;AAvDY,4DAAwB","file":"glyph-render.js","sourcesContent":["import { injectable } from '../../../common/inversify-lite';\nimport { getTheme } from '../../../graphic/theme';\nimport { GLYPH_NUMBER_TYPE } from '../../../graphic/constants';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IGlyph,\n IMarkAttribute,\n IThemeAttribute,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams\n} from '../../../interface';\n\n@injectable()\nexport class DefaultCanvasGlyphRender implements IGraphicRender {\n type: 'glyph';\n numberType: number = GLYPH_NUMBER_TYPE;\n\n // constructor() {}\n\n drawShape(\n glyph: IGlyph,\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 (!drawContext.drawContribution) {\n return;\n }\n glyph.getSubGraphic().forEach(item => {\n const renderer = drawContext.drawContribution.getRenderContribution(item);\n if (renderer && renderer.drawShape) {\n renderer.drawShape(item, context, x, y, drawContext, params, fillCb, strokeCb);\n }\n });\n }\n\n draw(glyph: IGlyph, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const { context } = drawContext;\n if (!context) {\n return;\n }\n\n context.highPerformanceSave();\n\n if (!drawContext.drawContribution) {\n return;\n }\n const glyphTheme = getTheme(glyph);\n const subGraphic = glyph.getSubGraphic();\n subGraphic.length &&\n subGraphic.forEach(g => {\n drawContext.drawContribution.renderItem(g, drawContext, { theme: glyphTheme });\n });\n\n context.highPerformanceRestore();\n }\n}\n"]}
@@ -3,5 +3,4 @@ export declare abstract class AbstractGraphicRender implements IGraphicRender {
3
3
  type: string;
4
4
  numberType: number;
5
5
  abstract draw(graphic: IGraphic, renderService: IRenderService): void;
6
- abstract reInit(): void;
7
6
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/graphic-render.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mEAA4D;AAIrD,IAAe,qBAAqB,GAApC,MAAe,qBAAqB;CAO1C,CAAA;AAPqB,qBAAqB;IAD1C,IAAA,2BAAU,GAAE;GACS,qBAAqB,CAO1C;AAPqB,sDAAqB","file":"graphic-render.js","sourcesContent":["import { injectable } from '../../../common/inversify-lite';\nimport type { IGraphic, IGraphicRender, IRenderService } from '../../../interface';\n\n@injectable()\nexport abstract class AbstractGraphicRender implements IGraphicRender {\n type: string; // 图元类型\n numberType: number;\n\n abstract draw(graphic: IGraphic, renderService: IRenderService): void;\n\n abstract reInit(): void;\n}\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/graphic-render.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mEAA4D;AAIrD,IAAe,qBAAqB,GAApC,MAAe,qBAAqB;CAK1C,CAAA;AALqB,qBAAqB;IAD1C,IAAA,2BAAU,GAAE;GACS,qBAAqB,CAK1C;AALqB,sDAAqB","file":"graphic-render.js","sourcesContent":["import { injectable } from '../../../common/inversify-lite';\nimport type { IGraphic, IGraphicRender, IRenderService } from '../../../interface';\n\n@injectable()\nexport abstract class AbstractGraphicRender implements IGraphicRender {\n type: string; // 图元类型\n numberType: number;\n\n abstract draw(graphic: IGraphic, renderService: IRenderService): void;\n}\n"]}
@@ -5,7 +5,6 @@ export declare class DefaultCanvasGroupRender implements IGraphicRender {
5
5
  numberType: number;
6
6
  _groupRenderContribitions: IGroupRenderContribution[];
7
7
  constructor(groupRenderContribitions: IContributionProvider<IGroupRenderContribution>);
8
- reInit(): void;
9
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;
10
9
  draw(group: IGroup, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams): void;
11
10
  }
@@ -22,10 +22,6 @@ let DefaultCanvasGroupRender = class {
22
22
  constructor(groupRenderContribitions) {
23
23
  this.groupRenderContribitions = groupRenderContribitions, this.numberType = constants_2.GROUP_NUMBER_TYPE;
24
24
  }
25
- reInit() {
26
- this._groupRenderContribitions = this.groupRenderContribitions.getContributions() || [],
27
- this._groupRenderContribitions.push(contributions_1.defaultGroupBackgroundRenderContribution);
28
- }
29
25
  drawShape(group, context, x, y, drawContext, params, fillCb, strokeCb) {
30
26
  const groupAttribute = (0, theme_1.getTheme)(group, null == params ? void 0 : params.theme).group, {fill: fill = groupAttribute.fill, background: background, stroke: stroke = groupAttribute.stroke, opacity: opacity = groupAttribute.opacity, width: width = groupAttribute.width, height: height = groupAttribute.height, clip: clip = groupAttribute.clip, fillOpacity: fillOpacity = groupAttribute.fillOpacity, strokeOpacity: strokeOpacity = groupAttribute.strokeOpacity, cornerRadius: cornerRadius = groupAttribute.cornerRadius, path: path = groupAttribute.path, lineWidth: lineWidth = groupAttribute.lineWidth, visible: visible = groupAttribute.visible, fillStrokeOrder: fillStrokeOrder = groupAttribute.fillStrokeOrder, cornerType: cornerType = groupAttribute.cornerType, x: originX = groupAttribute.x, y: originY = groupAttribute.y} = group.attribute, fVisible = (0,
31
27
  utils_1.rectFillVisible)(opacity, fillOpacity, width, height, fill), sVisible = (0,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/group-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAA2E;AAc3E,kDAAkD;AAClD,sFAAkF;AAClF,6CAA2C;AAE3C,iFAA6E;AAC7E,qDAA4D;AAC5D,mCAAiF;AACjF,yDAAoE;AACpE,wEAAkE;AAClE,0DAA+D;AAC/D,iDAAmE;AACnE,mDAA2E;AAC3E,mDAA0D;AAC1D,8CAA2C;AAGpC,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAMnC,YAGqB,wBAAyE;QAAzE,6BAAwB,GAAxB,wBAAwB,CAAiD;QAP9F,eAAU,GAAW,6BAAiB,CAAC;IAQpC,CAAC;IAEJ,MAAM;QACJ,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC,wBAAwB,CAAC,gBAAgB,EAAE,IAAI,EAAE,CAAC;QACxF,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,wDAAwC,CAAC,CAAC;IAChF,CAAC;IAED,SAAS,CACP,KAAa,EACb,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACj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AAE,CAAC;aAClC;SACF;IACH,CAAC;CACF,CAAA;AA7WY,wBAAwB;IADpC,IAAA,2BAAU,GAAE;IAQR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,mCAAuB,CAAC,CAAA;;GARtB,wBAAwB,CA6WpC;AA7WY,4DAAwB","file":"group-render.js","sourcesContent":["import { inject, injectable, named } from '../../../common/inversify-lite';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IGroup,\n IMarkAttribute,\n IThemeAttribute,\n IGroupRenderContribution,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider\n} from '../../../interface';\nimport { getTheme } from '../../../graphic/theme';\nimport { getModelMatrix } from '../../../graphic/graphic-service/graphic-service';\nimport { isArray } from '@visactor/vutils';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { createRectPath } from '../../../common/shape/rect';\nimport { rectFillVisible, rectStrokeVisible, runFill, runStroke } from './utils';\nimport { GroupRenderContribution } from './contributions/constants';\nimport { mat4Allocate } from '../../../allocator/matrix-allocate';\nimport { GROUP_NUMBER_TYPE } from '../../../graphic/constants';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { defaultGroupBackgroundRenderContribution } from './contributions';\nimport { multiplyMat4Mat4 } from '../../../common/matrix';\nimport { vglobal } from '../../../modules';\n\n@injectable()\nexport class DefaultCanvasGroupRender implements IGraphicRender {\n type: 'group';\n numberType: number = GROUP_NUMBER_TYPE;\n\n _groupRenderContribitions: IGroupRenderContribution[];\n\n constructor(\n @inject(ContributionProvider)\n @named(GroupRenderContribution)\n protected readonly groupRenderContribitions: IContributionProvider<IGroupRenderContribution>\n ) {}\n\n reInit() {\n this._groupRenderContribitions = this.groupRenderContribitions.getContributions() || [];\n this._groupRenderContribitions.push(defaultGroupBackgroundRenderContribution);\n }\n\n drawShape(\n group: IGroup,\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 // const groupAttribute = graphicService.themeService.getCurrentTheme().groupAttribute;\n const groupAttribute = getTheme(group, params?.theme).group;\n const {\n fill = groupAttribute.fill,\n background,\n stroke = groupAttribute.stroke,\n opacity = groupAttribute.opacity,\n width = groupAttribute.width,\n height = groupAttribute.height,\n clip = groupAttribute.clip,\n fillOpacity = groupAttribute.fillOpacity,\n strokeOpacity = groupAttribute.strokeOpacity,\n cornerRadius = groupAttribute.cornerRadius,\n path = groupAttribute.path,\n lineWidth = groupAttribute.lineWidth,\n visible = groupAttribute.visible,\n fillStrokeOrder = groupAttribute.fillStrokeOrder,\n cornerType = groupAttribute.cornerType,\n x: originX = groupAttribute.x,\n y: originY = groupAttribute.y\n } = group.attribute;\n\n // 不绘制或者透明\n const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill);\n const sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height);\n const doFill = runFill(fill, background);\n const doStroke = runStroke(stroke, lineWidth);\n\n if (!(group.valid && visible)) {\n return;\n }\n\n if (!clip) {\n if (!(doFill || doStroke)) {\n return;\n }\n\n // 如果存在fillCb和strokeCb,那就不直接跳过\n if (!(fVisible || sVisible || fillCb || strokeCb || background)) {\n return;\n }\n }\n\n if (path && path.length && drawContext.drawContribution) {\n // 禁用fill和stroke\n const disableFill = context.disableFill;\n const disableStroke = context.disableStroke;\n const disableBeginPath = context.disableBeginPath;\n context.disableFill = true;\n context.disableStroke = true;\n context.disableBeginPath = true;\n path.forEach(g => {\n const rc = drawContext.drawContribution.getRenderContribution(g);\n rc.draw(g, drawContext.renderService, drawContext, params);\n });\n context.disableFill = disableFill;\n context.disableStroke = disableStroke;\n context.disableBeginPath = disableBeginPath;\n } else if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n context.beginPath();\n context.rect(x, y, width, height);\n } else {\n context.beginPath();\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache\n createRectPath(context, x, y, width, height, cornerRadius, cornerType !== 'bevel');\n }\n\n if (!this._groupRenderContribitions) {\n this._groupRenderContribitions = this.groupRenderContribitions.getContributions() || [];\n this._groupRenderContribitions.push(defaultGroupBackgroundRenderContribution);\n }\n\n const doFillOrStroke = {\n doFill,\n doStroke\n };\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(group, group.attribute, groupAttribute);\n\n this._groupRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.beforeFillStroke) {\n // c.useStyle && context.setCommonStyle(group, group.attribute, x, y, groupAttribute);\n c.drawShape(\n group,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n groupAttribute,\n drawContext,\n fillCb,\n strokeCb,\n doFillOrStroke\n );\n }\n });\n\n // beforeFillStroke contribition可以操作clip范围\n if (clip) {\n context.clip();\n }\n\n const _runFill = () => {\n if ((doFillOrStroke as any).doFill) {\n if (fillCb) {\n fillCb(context, group.attribute, groupAttribute);\n } else if (fVisible) {\n context.setCommonStyle(group, group.attribute, originX - x, originY - y, groupAttribute);\n context.fill();\n }\n }\n };\n\n const _runStroke = () => {\n if ((doFillOrStroke as any).doStroke) {\n if (strokeCb) {\n strokeCb(context, group.attribute, groupAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(group, group.attribute, originX - x, originY - y, groupAttribute);\n context.stroke();\n }\n }\n };\n\n if (!fillStrokeOrder) {\n _runFill();\n _runStroke();\n } else {\n _runStroke();\n _runFill();\n }\n\n this._groupRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.afterFillStroke) {\n // c.useStyle && context.setCommonStyle(group, group.attribute, x, y, groupAttribute);\n c.drawShape(\n group,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n groupAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n });\n }\n\n draw(group: IGroup, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const { context } = drawContext;\n if (!context) {\n return;\n }\n\n // debugger;\n const { clip, baseOpacity = 1, drawMode, x, y, width, height } = group.attribute;\n const lastNativeContext = context.nativeContext;\n const lastNativeCanvas = context.canvas.nativeCanvas;\n\n if (drawMode > 0) {\n // 绘制到新的Canvas上,然后再绘制回来\n const canvas = context.canvas;\n const newCanvas = vglobal.createCanvas({ width: canvas.width, height: canvas.height, dpr: 1 });\n const newContext = newCanvas.getContext('2d');\n const transform = context.nativeContext.getTransform();\n // 首先应用transform\n newContext.setTransform(transform.a, transform.b, transform.c, transform.d, transform.e, transform.f);\n // 然后将背景绘制到新的canvas上,只绘制group的Bounds区域\n // 如果drawMode === 1,则需要背景\n // 如果drawMode === 2,则不需要背景,只需要group即可\n if (drawMode === 1) {\n newContext.save();\n newContext.clearRect(0, 0, canvas.width, canvas.height);\n newContext.beginPath();\n\n newContext.rect(x, y, width, height);\n newContext.clip();\n newContext.drawImage(\n canvas.nativeCanvas,\n 0,\n 0,\n canvas.width,\n canvas.height,\n 0,\n 0,\n canvas.displayWidth,\n canvas.displayHeight\n );\n newContext.restore();\n }\n // 狸猫换太子,把新的context赋值给context\n context.nativeContext = newContext;\n canvas.nativeCanvas = newCanvas;\n }\n if (clip) {\n context.save();\n } else {\n context.highPerformanceSave();\n }\n const baseGlobalAlpha = context.baseGlobalAlpha;\n context.baseGlobalAlpha *= baseOpacity;\n\n const groupAttribute = getTheme(group, params?.theme).group;\n\n // const lastMatrix = context.modelMatrix;\n // if (context.camera) {\n // const m = group.transMatrix;\n // const matrix = createMat4();\n // mat3Tomat4(matrix, m);\n // const lastModelMatrix = context.modelMatrix;\n // if (lastModelMatrix) {\n // if (matrix) {\n // const m = createMat4();\n // context.modelMatrix = multiplyMat4Mat4(m, lastModelMatrix, matrix);\n // }\n // } else {\n // context.modelMatrix = matrix;\n // }\n // } else {\n // // group直接transform\n // context.transformFromMatrix(group.transMatrix, true);\n // }\n const lastModelMatrix = context.modelMatrix;\n const camera = context.camera;\n if (camera) {\n const nextModelMatrix = mat4Allocate.allocate();\n // 计算模型矩阵\n const modelMatrix = mat4Allocate.allocate();\n getModelMatrix(modelMatrix, group, groupAttribute);\n if (lastModelMatrix) {\n multiplyMat4Mat4(nextModelMatrix, lastModelMatrix, modelMatrix);\n } else {\n multiplyMat4Mat4(nextModelMatrix, nextModelMatrix, modelMatrix);\n }\n context.modelMatrix = nextModelMatrix;\n mat4Allocate.free(modelMatrix);\n context.setTransform(1, 0, 0, 1, 0, 0, true);\n } else {\n // group直接transform\n context.transformFromMatrix(group.transMatrix, true);\n }\n\n context.beginPath();\n // 如果跳过绘制,那就不绘制\n if (params.skipDraw) {\n this.drawShape(\n group,\n context,\n 0,\n 0,\n drawContext,\n params,\n () => false,\n () => false\n );\n } else {\n this.drawShape(group, context, 0, 0, drawContext);\n }\n\n // 绘制子元素的时候要添加scroll\n const { scrollX = groupAttribute.scrollX, scrollY = groupAttribute.scrollY } = group.attribute;\n if (scrollX || scrollY) {\n context.translate(scrollX, scrollY);\n }\n let p: any;\n if (params && params.drawingCb) {\n p = params.drawingCb();\n }\n\n if (context.modelMatrix !== lastModelMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastModelMatrix;\n\n context.baseGlobalAlpha = baseGlobalAlpha;\n\n if (drawMode > 0) {\n // 将原始的context和canvas恢复,另外将newCanvas上的内容绘制到lastCanvas上\n const newContext = context.nativeContext;\n const newCanvas = context.canvas.nativeCanvas;\n lastNativeContext.save();\n lastNativeContext.setTransform(context.dpr, 0, 0, context.dpr, 0, 0, true);\n // 如果drawMode === 1,则需要清一下之前的背景,否则背景就重复绘制了一次\n if (drawMode === 1) {\n newContext.rect(x, y, width, height);\n }\n lastNativeContext.drawImage(\n newCanvas,\n 0,\n 0,\n newCanvas.width,\n newCanvas.height,\n 0,\n 0,\n context.canvas.displayWidth,\n context.canvas.displayHeight\n );\n const transform = newContext.getTransform();\n lastNativeContext.setTransform(transform.a, transform.b, transform.c, transform.d, transform.e, transform.f);\n context.nativeContext = lastNativeContext;\n context.canvas.nativeCanvas = lastNativeCanvas;\n lastNativeContext.restore();\n }\n\n if (p && p.then) {\n p.then(() => {\n if (clip) {\n context.restore();\n } else {\n context.highPerformanceRestore();\n }\n });\n } else {\n if (clip) {\n context.restore();\n } else {\n context.highPerformanceRestore();\n }\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/group-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAA2E;AAc3E,kDAAkD;AAClD,sFAAkF;AAClF,6CAA2C;AAE3C,iFAA6E;AAC7E,qDAA4D;AAC5D,mCAAiF;AACjF,yDAAoE;AACpE,wEAAkE;AAClE,0DAA+D;AAC/D,iDAAmE;AACnE,mDAA2E;AAC3E,mDAA0D;AAC1D,8CAA2C;AAGpC,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAMnC,YAGqB,wBAAyE;QAAzE,6BAAwB,GAAxB,wBAAwB,CAAiD;QAP9F,eAAU,GAAW,6BAAiB,CAAC;IAQpC,CAAC;IAEJ,SAAS,CACP,KAAa,EACb,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ,QAIY;QAGZ,MAAM,cAAc,GAAG,IAAA,gBAAQ,EAAC,KAAK,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,KAAK,CAAC;QAC5D,MAAM,EACJ,IAAI,GAAG,cAAc,CAAC,IAAI,EAC1B,UAAU,EACV,MAAM,GAAG,cAAc,CAAC,MAAM,EAC9B,OAAO,GAA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named } from '../../../common/inversify-lite';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IGroup,\n IMarkAttribute,\n IThemeAttribute,\n IGroupRenderContribution,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider\n} from '../../../interface';\nimport { getTheme } from '../../../graphic/theme';\nimport { getModelMatrix } from '../../../graphic/graphic-service/graphic-service';\nimport { isArray } from '@visactor/vutils';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { createRectPath } from '../../../common/shape/rect';\nimport { rectFillVisible, rectStrokeVisible, runFill, runStroke } from './utils';\nimport { GroupRenderContribution } from './contributions/constants';\nimport { mat4Allocate } from '../../../allocator/matrix-allocate';\nimport { GROUP_NUMBER_TYPE } from '../../../graphic/constants';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { defaultGroupBackgroundRenderContribution } from './contributions';\nimport { multiplyMat4Mat4 } from '../../../common/matrix';\nimport { vglobal } from '../../../modules';\n\n@injectable()\nexport class DefaultCanvasGroupRender implements IGraphicRender {\n type: 'group';\n numberType: number = GROUP_NUMBER_TYPE;\n\n _groupRenderContribitions: IGroupRenderContribution[];\n\n constructor(\n @inject(ContributionProvider)\n @named(GroupRenderContribution)\n protected readonly groupRenderContribitions: IContributionProvider<IGroupRenderContribution>\n ) {}\n\n drawShape(\n group: IGroup,\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 // const groupAttribute = graphicService.themeService.getCurrentTheme().groupAttribute;\n const groupAttribute = getTheme(group, params?.theme).group;\n const {\n fill = groupAttribute.fill,\n background,\n stroke = groupAttribute.stroke,\n opacity = groupAttribute.opacity,\n width = groupAttribute.width,\n height = groupAttribute.height,\n clip = groupAttribute.clip,\n fillOpacity = groupAttribute.fillOpacity,\n strokeOpacity = groupAttribute.strokeOpacity,\n cornerRadius = groupAttribute.cornerRadius,\n path = groupAttribute.path,\n lineWidth = groupAttribute.lineWidth,\n visible = groupAttribute.visible,\n fillStrokeOrder = groupAttribute.fillStrokeOrder,\n cornerType = groupAttribute.cornerType,\n x: originX = groupAttribute.x,\n y: originY = groupAttribute.y\n } = group.attribute;\n\n // 不绘制或者透明\n const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill);\n const sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height);\n const doFill = runFill(fill, background);\n const doStroke = runStroke(stroke, lineWidth);\n\n if (!(group.valid && visible)) {\n return;\n }\n\n if (!clip) {\n if (!(doFill || doStroke)) {\n return;\n }\n\n // 如果存在fillCb和strokeCb,那就不直接跳过\n if (!(fVisible || sVisible || fillCb || strokeCb || background)) {\n return;\n }\n }\n\n if (path && path.length && drawContext.drawContribution) {\n // 禁用fill和stroke\n const disableFill = context.disableFill;\n const disableStroke = context.disableStroke;\n const disableBeginPath = context.disableBeginPath;\n context.disableFill = true;\n context.disableStroke = true;\n context.disableBeginPath = true;\n path.forEach(g => {\n const rc = drawContext.drawContribution.getRenderContribution(g);\n rc.draw(g, drawContext.renderService, drawContext, params);\n });\n context.disableFill = disableFill;\n context.disableStroke = disableStroke;\n context.disableBeginPath = disableBeginPath;\n } else if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n context.beginPath();\n context.rect(x, y, width, height);\n } else {\n context.beginPath();\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache\n createRectPath(context, x, y, width, height, cornerRadius, cornerType !== 'bevel');\n }\n\n if (!this._groupRenderContribitions) {\n this._groupRenderContribitions = this.groupRenderContribitions.getContributions() || [];\n this._groupRenderContribitions.push(defaultGroupBackgroundRenderContribution);\n }\n\n const doFillOrStroke = {\n doFill,\n doStroke\n };\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(group, group.attribute, groupAttribute);\n\n this._groupRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.beforeFillStroke) {\n // c.useStyle && context.setCommonStyle(group, group.attribute, x, y, groupAttribute);\n c.drawShape(\n group,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n groupAttribute,\n drawContext,\n fillCb,\n strokeCb,\n doFillOrStroke\n );\n }\n });\n\n // beforeFillStroke contribition可以操作clip范围\n if (clip) {\n context.clip();\n }\n\n const _runFill = () => {\n if ((doFillOrStroke as any).doFill) {\n if (fillCb) {\n fillCb(context, group.attribute, groupAttribute);\n } else if (fVisible) {\n context.setCommonStyle(group, group.attribute, originX - x, originY - y, groupAttribute);\n context.fill();\n }\n }\n };\n\n const _runStroke = () => {\n if ((doFillOrStroke as any).doStroke) {\n if (strokeCb) {\n strokeCb(context, group.attribute, groupAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(group, group.attribute, originX - x, originY - y, groupAttribute);\n context.stroke();\n }\n }\n };\n\n if (!fillStrokeOrder) {\n _runFill();\n _runStroke();\n } else {\n _runStroke();\n _runFill();\n }\n\n this._groupRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.afterFillStroke) {\n // c.useStyle && context.setCommonStyle(group, group.attribute, x, y, groupAttribute);\n c.drawShape(\n group,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n groupAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n });\n }\n\n draw(group: IGroup, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const { context } = drawContext;\n if (!context) {\n return;\n }\n\n // debugger;\n const { clip, baseOpacity = 1, drawMode, x, y, width, height } = group.attribute;\n const lastNativeContext = context.nativeContext;\n const lastNativeCanvas = context.canvas.nativeCanvas;\n\n if (drawMode > 0) {\n // 绘制到新的Canvas上,然后再绘制回来\n const canvas = context.canvas;\n const newCanvas = vglobal.createCanvas({ width: canvas.width, height: canvas.height, dpr: 1 });\n const newContext = newCanvas.getContext('2d');\n const transform = context.nativeContext.getTransform();\n // 首先应用transform\n newContext.setTransform(transform.a, transform.b, transform.c, transform.d, transform.e, transform.f);\n // 然后将背景绘制到新的canvas上,只绘制group的Bounds区域\n // 如果drawMode === 1,则需要背景\n // 如果drawMode === 2,则不需要背景,只需要group即可\n if (drawMode === 1) {\n newContext.save();\n newContext.clearRect(0, 0, canvas.width, canvas.height);\n newContext.beginPath();\n\n newContext.rect(x, y, width, height);\n newContext.clip();\n newContext.drawImage(\n canvas.nativeCanvas,\n 0,\n 0,\n canvas.width,\n canvas.height,\n 0,\n 0,\n canvas.displayWidth,\n canvas.displayHeight\n );\n newContext.restore();\n }\n // 狸猫换太子,把新的context赋值给context\n context.nativeContext = newContext;\n canvas.nativeCanvas = newCanvas;\n }\n if (clip) {\n context.save();\n } else {\n context.highPerformanceSave();\n }\n const baseGlobalAlpha = context.baseGlobalAlpha;\n context.baseGlobalAlpha *= baseOpacity;\n\n const groupAttribute = getTheme(group, params?.theme).group;\n\n // const lastMatrix = context.modelMatrix;\n // if (context.camera) {\n // const m = group.transMatrix;\n // const matrix = createMat4();\n // mat3Tomat4(matrix, m);\n // const lastModelMatrix = context.modelMatrix;\n // if (lastModelMatrix) {\n // if (matrix) {\n // const m = createMat4();\n // context.modelMatrix = multiplyMat4Mat4(m, lastModelMatrix, matrix);\n // }\n // } else {\n // context.modelMatrix = matrix;\n // }\n // } else {\n // // group直接transform\n // context.transformFromMatrix(group.transMatrix, true);\n // }\n const lastModelMatrix = context.modelMatrix;\n const camera = context.camera;\n if (camera) {\n const nextModelMatrix = mat4Allocate.allocate();\n // 计算模型矩阵\n const modelMatrix = mat4Allocate.allocate();\n getModelMatrix(modelMatrix, group, groupAttribute);\n if (lastModelMatrix) {\n multiplyMat4Mat4(nextModelMatrix, lastModelMatrix, modelMatrix);\n } else {\n multiplyMat4Mat4(nextModelMatrix, nextModelMatrix, modelMatrix);\n }\n context.modelMatrix = nextModelMatrix;\n mat4Allocate.free(modelMatrix);\n context.setTransform(1, 0, 0, 1, 0, 0, true);\n } else {\n // group直接transform\n context.transformFromMatrix(group.transMatrix, true);\n }\n\n context.beginPath();\n // 如果跳过绘制,那就不绘制\n if (params.skipDraw) {\n this.drawShape(\n group,\n context,\n 0,\n 0,\n drawContext,\n params,\n () => false,\n () => false\n );\n } else {\n this.drawShape(group, context, 0, 0, drawContext);\n }\n\n // 绘制子元素的时候要添加scroll\n const { scrollX = groupAttribute.scrollX, scrollY = groupAttribute.scrollY } = group.attribute;\n if (scrollX || scrollY) {\n context.translate(scrollX, scrollY);\n }\n let p: any;\n if (params && params.drawingCb) {\n p = params.drawingCb();\n }\n\n if (context.modelMatrix !== lastModelMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastModelMatrix;\n\n context.baseGlobalAlpha = baseGlobalAlpha;\n\n if (drawMode > 0) {\n // 将原始的context和canvas恢复,另外将newCanvas上的内容绘制到lastCanvas上\n const newContext = context.nativeContext;\n const newCanvas = context.canvas.nativeCanvas;\n lastNativeContext.save();\n lastNativeContext.setTransform(context.dpr, 0, 0, context.dpr, 0, 0, true);\n // 如果drawMode === 1,则需要清一下之前的背景,否则背景就重复绘制了一次\n if (drawMode === 1) {\n newContext.rect(x, y, width, height);\n }\n lastNativeContext.drawImage(\n newCanvas,\n 0,\n 0,\n newCanvas.width,\n newCanvas.height,\n 0,\n 0,\n context.canvas.displayWidth,\n context.canvas.displayHeight\n );\n const transform = newContext.getTransform();\n lastNativeContext.setTransform(transform.a, transform.b, transform.c, transform.d, transform.e, transform.f);\n context.nativeContext = lastNativeContext;\n context.canvas.nativeCanvas = lastNativeCanvas;\n lastNativeContext.restore();\n }\n\n if (p && p.then) {\n p.then(() => {\n if (clip) {\n context.restore();\n } else {\n context.highPerformanceRestore();\n }\n });\n } else {\n if (clip) {\n context.restore();\n } else {\n context.highPerformanceRestore();\n }\n }\n }\n}\n"]}
@@ -1,10 +1,10 @@
1
1
  import type { IGraphicAttribute, IContext2d, IMarkAttribute, IImage, IThemeAttribute, IGraphicRender, IImageRenderContribution, IContributionProvider, IDrawContext, IGraphicRenderDrawParams, IRenderService } from '../../../interface';
2
2
  import { BaseRender } from './base-render';
3
3
  export declare class DefaultCanvasImageRender extends BaseRender<IImage> implements IGraphicRender {
4
- protected readonly graphicRenderContributions: IContributionProvider<IImageRenderContribution>;
4
+ protected readonly imageRenderContribitions: IContributionProvider<IImageRenderContribution>;
5
5
  type: 'image';
6
6
  numberType: number;
7
- constructor(graphicRenderContributions: IContributionProvider<IImageRenderContribution>);
7
+ constructor(imageRenderContribitions: IContributionProvider<IImageRenderContribution>);
8
8
  drawShape(image: IImage, 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;
9
9
  draw(image: IImage, renderService: IRenderService, drawContext: IDrawContext): void;
10
10
  }
@@ -19,10 +19,10 @@ Object.defineProperty(exports, "__esModule", {
19
19
  const inversify_lite_1 = require("../../../common/inversify-lite"), contribution_provider_1 = require("../../../common/contribution-provider"), theme_1 = require("../../../graphic/theme"), constants_1 = require("./contributions/constants"), constants_2 = require("../../../graphic/constants"), vutils_1 = require("@visactor/vutils"), rect_1 = require("../../../common/shape/rect"), base_render_1 = require("./base-render"), contributions_1 = require("./contributions"), loader_1 = require("../../../resource-loader/loader"), repeatStr = [ "", "repeat-x", "repeat-y", "repeat" ];
20
20
 
21
21
  let DefaultCanvasImageRender = class extends base_render_1.BaseRender {
22
- constructor(graphicRenderContributions) {
23
- super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = constants_2.IMAGE_NUMBER_TYPE,
22
+ constructor(imageRenderContribitions) {
23
+ super(), this.imageRenderContribitions = imageRenderContribitions, this.numberType = constants_2.IMAGE_NUMBER_TYPE,
24
24
  this.builtinContributions = [ contributions_1.defaultImageRenderContribution, contributions_1.defaultImageBackgroundRenderContribution ],
25
- this.init(graphicRenderContributions);
25
+ this.init(imageRenderContribitions);
26
26
  }
27
27
  drawShape(image, context, x, y, drawContext, params, fillCb, strokeCb) {
28
28
  const imageAttribute = (0, theme_1.getTheme)(image).image, {repeatX: repeatX = imageAttribute.repeatX, repeatY: repeatY = imageAttribute.repeatY, x: originX = imageAttribute.x, y: originY = imageAttribute.y, cornerRadius: cornerRadius = imageAttribute.cornerRadius, fillStrokeOrder: fillStrokeOrder = imageAttribute.fillStrokeOrder, cornerType: cornerType = imageAttribute.cornerType, image: url} = image.attribute, data = this.valid(image, imageAttribute, fillCb);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/image-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAA2E;AAE3E,iFAA6E;AAC7E,kDAAkD;AAclD,yDAAoE;AAEpE,0DAA+D;AAE/D,6CAAqD;AACrD,qDAA4D;AAC5D,+CAA2C;AAC3C,mDAA2G;AAC3G,4DAAiE;AAEjE,MAAM,SAAS,GAAG,CAAC,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAGlD,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,wBAAkB;IAI9D,YAGqB,0BAA2E;QAE9F,KAAK,EAAE,CAAC;QAFW,+BAA0B,GAA1B,0BAA0B,CAAiD;QALhG,eAAU,GAAW,6BAAiB,CAAC;QAQrC,IAAI,CAAC,oBAAoB,GAAG,CAAC,8CAA8B,EAAE,wDAAwC,CAAC,CAAC;QACvG,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IACxC,CAAC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AAC;CACF,CAAA;AAvKY,wBAAwB;IADpC,IAAA,2BAAU,GAAE;IAMR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,mCAAuB,CAAC,CAAA;;GANtB,wBAAwB,CAuKpC;AAvKY,4DAAwB","file":"image-render.js","sourcesContent":["import { inject, injectable, named } from '../../../common/inversify-lite';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { getTheme } from '../../../graphic/theme';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IImage,\n IThemeAttribute,\n IGraphicRender,\n IImageRenderContribution,\n IContributionProvider,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService\n} from '../../../interface';\nimport { ImageRenderContribution } from './contributions/constants';\nimport { fillVisible, runFill } from './utils';\nimport { IMAGE_NUMBER_TYPE } from '../../../graphic/constants';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { isArray, isString } from '@visactor/vutils';\nimport { createRectPath } from '../../../common/shape/rect';\nimport { BaseRender } from './base-render';\nimport { defaultImageBackgroundRenderContribution, defaultImageRenderContribution } from './contributions';\nimport { ResourceLoader } from '../../../resource-loader/loader';\n\nconst repeatStr = ['', 'repeat-x', 'repeat-y', 'repeat'];\n\n@injectable()\nexport class DefaultCanvasImageRender extends BaseRender<IImage> implements IGraphicRender {\n type: 'image';\n numberType: number = IMAGE_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(ImageRenderContribution)\n protected readonly graphicRenderContributions: IContributionProvider<IImageRenderContribution>\n ) {\n super();\n this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution];\n this.init(graphicRenderContributions);\n }\n\n drawShape(\n image: IImage,\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 // const imageAttribute = graphicService.themeService.getCurrentTheme().imageAttribute;\n const imageAttribute = getTheme(image).image;\n const {\n repeatX = imageAttribute.repeatX,\n repeatY = imageAttribute.repeatY,\n x: originX = imageAttribute.x,\n y: originY = imageAttribute.y,\n cornerRadius = imageAttribute.cornerRadius,\n fillStrokeOrder = imageAttribute.fillStrokeOrder,\n cornerType = imageAttribute.cornerType,\n image: url\n } = image.attribute;\n\n const data = this.valid(image, imageAttribute, fillCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n if (!url || !image.resources) {\n return;\n }\n const res = image.resources.get(url);\n if (res.state !== 'success') {\n return;\n }\n\n const width = image.width;\n const height = image.height;\n context.beginPath();\n\n // deal with cornerRadius\n let needRestore = false;\n if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n context.rect(x, y, width, height);\n } else {\n // context.beginPath();\n createRectPath(context, x, y, width, height, cornerRadius, cornerType !== 'bevel');\n needRestore = true;\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(image, image.attribute, imageAttribute);\n // context.beginPath();\n // context.image(x, y, width, height);\n\n const _runFill = () => {\n if (doFill) {\n if (fillCb) {\n fillCb(context, image.attribute, imageAttribute);\n } else if (fVisible) {\n context.setCommonStyle(image, image.attribute, x, y, imageAttribute);\n let repeat = 0;\n if (repeatX === 'repeat') {\n repeat |= 0b0001;\n }\n if (repeatY === 'repeat') {\n repeat |= 0b0010;\n }\n if (repeat) {\n const pattern = context.createPattern(res.data, repeatStr[repeat]);\n context.fillStyle = pattern;\n context.translate(x, y, true);\n context.fillRect(0, 0, width, height);\n context.translate(-x, -y, true);\n } else {\n context.drawImage(res.data, x, y, width, height);\n }\n }\n }\n };\n\n const _runStroke = () => {\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, image.attribute, imageAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute);\n context.stroke();\n }\n }\n };\n\n if (!fillStrokeOrder) {\n if (needRestore) {\n context.save();\n context.clip();\n }\n this.beforeRenderStep(image, context, x, y, doFill, false, fVisible, false, imageAttribute, drawContext, fillCb);\n _runFill();\n if (needRestore) {\n context.restore();\n }\n _runStroke();\n } else {\n _runStroke();\n if (needRestore) {\n context.save();\n context.clip();\n }\n this.beforeRenderStep(image, context, x, y, doFill, false, fVisible, false, imageAttribute, drawContext, fillCb);\n _runFill();\n if (needRestore) {\n context.restore();\n }\n }\n\n this.afterRenderStep(image, context, x, y, doFill, false, fVisible, false, imageAttribute, drawContext, fillCb);\n }\n\n draw(image: IImage, renderService: IRenderService, drawContext: IDrawContext) {\n const { image: url } = image.attribute;\n\n if (!url || !image.resources) {\n return;\n }\n const res = image.resources.get(url);\n // if (res.state !== 'success') {\n // return;\n // }\n if (res.state === 'loading' && isString(url)) {\n ResourceLoader.improveImageLoading(url);\n return;\n } else if (res.state !== 'success') {\n return;\n }\n\n const { context } = renderService.drawParams;\n if (!context) {\n return;\n }\n const imageAttribute = getTheme(image).image;\n this._draw(image, imageAttribute, false, drawContext);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/image-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAA2E;AAE3E,iFAA6E;AAC7E,kDAAkD;AAclD,yDAAoE;AAEpE,0DAA+D;AAE/D,6CAAqD;AACrD,qDAA4D;AAC5D,+CAA2C;AAC3C,mDAA2G;AAC3G,4DAAiE;AAEjE,MAAM,SAAS,GAAG,CAAC,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAGlD,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,wBAAkB;I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AO,EAAE,GAAG,aAAa,CAAC,UAAU,CAAC;QAC7C,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;SACR;QACD,MAAM,cAAc,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC,KAAK,CAAC;QAC7C,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IACxD,CAAC;CACF,CAAA;AAvKY,wBAAwB;IADpC,IAAA,2BAAU,GAAE;IAMR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,mCAAuB,CAAC,CAAA;;GANtB,wBAAwB,CAuKpC;AAvKY,4DAAwB","file":"image-render.js","sourcesContent":["import { inject, injectable, named } from '../../../common/inversify-lite';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { getTheme } from '../../../graphic/theme';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IImage,\n IThemeAttribute,\n IGraphicRender,\n IImageRenderContribution,\n IContributionProvider,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService\n} from '../../../interface';\nimport { ImageRenderContribution } from './contributions/constants';\nimport { fillVisible, runFill } from './utils';\nimport { IMAGE_NUMBER_TYPE } from '../../../graphic/constants';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { isArray, isString } from '@visactor/vutils';\nimport { createRectPath } from '../../../common/shape/rect';\nimport { BaseRender } from './base-render';\nimport { defaultImageBackgroundRenderContribution, defaultImageRenderContribution } from './contributions';\nimport { ResourceLoader } from '../../../resource-loader/loader';\n\nconst repeatStr = ['', 'repeat-x', 'repeat-y', 'repeat'];\n\n@injectable()\nexport class DefaultCanvasImageRender extends BaseRender<IImage> implements IGraphicRender {\n type: 'image';\n numberType: number = IMAGE_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(ImageRenderContribution)\n protected readonly imageRenderContribitions: IContributionProvider<IImageRenderContribution>\n ) {\n super();\n this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution];\n this.init(imageRenderContribitions);\n }\n\n drawShape(\n image: IImage,\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 // const imageAttribute = graphicService.themeService.getCurrentTheme().imageAttribute;\n const imageAttribute = getTheme(image).image;\n const {\n repeatX = imageAttribute.repeatX,\n repeatY = imageAttribute.repeatY,\n x: originX = imageAttribute.x,\n y: originY = imageAttribute.y,\n cornerRadius = imageAttribute.cornerRadius,\n fillStrokeOrder = imageAttribute.fillStrokeOrder,\n cornerType = imageAttribute.cornerType,\n image: url\n } = image.attribute;\n\n const data = this.valid(image, imageAttribute, fillCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n if (!url || !image.resources) {\n return;\n }\n const res = image.resources.get(url);\n if (res.state !== 'success') {\n return;\n }\n\n const width = image.width;\n const height = image.height;\n context.beginPath();\n\n // deal with cornerRadius\n let needRestore = false;\n if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n context.rect(x, y, width, height);\n } else {\n // context.beginPath();\n createRectPath(context, x, y, width, height, cornerRadius, cornerType !== 'bevel');\n needRestore = true;\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(image, image.attribute, imageAttribute);\n // context.beginPath();\n // context.image(x, y, width, height);\n\n const _runFill = () => {\n if (doFill) {\n if (fillCb) {\n fillCb(context, image.attribute, imageAttribute);\n } else if (fVisible) {\n context.setCommonStyle(image, image.attribute, x, y, imageAttribute);\n let repeat = 0;\n if (repeatX === 'repeat') {\n repeat |= 0b0001;\n }\n if (repeatY === 'repeat') {\n repeat |= 0b0010;\n }\n if (repeat) {\n const pattern = context.createPattern(res.data, repeatStr[repeat]);\n context.fillStyle = pattern;\n context.translate(x, y, true);\n context.fillRect(0, 0, width, height);\n context.translate(-x, -y, true);\n } else {\n context.drawImage(res.data, x, y, width, height);\n }\n }\n }\n };\n\n const _runStroke = () => {\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, image.attribute, imageAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute);\n context.stroke();\n }\n }\n };\n\n if (!fillStrokeOrder) {\n if (needRestore) {\n context.save();\n context.clip();\n }\n this.beforeRenderStep(image, context, x, y, doFill, false, fVisible, false, imageAttribute, drawContext, fillCb);\n _runFill();\n if (needRestore) {\n context.restore();\n }\n _runStroke();\n } else {\n _runStroke();\n if (needRestore) {\n context.save();\n context.clip();\n }\n this.beforeRenderStep(image, context, x, y, doFill, false, fVisible, false, imageAttribute, drawContext, fillCb);\n _runFill();\n if (needRestore) {\n context.restore();\n }\n }\n\n this.afterRenderStep(image, context, x, y, doFill, false, fVisible, false, imageAttribute, drawContext, fillCb);\n }\n\n draw(image: IImage, renderService: IRenderService, drawContext: IDrawContext) {\n const { image: url } = image.attribute;\n\n if (!url || !image.resources) {\n return;\n }\n const res = image.resources.get(url);\n // if (res.state !== 'success') {\n // return;\n // }\n if (res.state === 'loading' && isString(url)) {\n ResourceLoader.improveImageLoading(url);\n return;\n } else if (res.state !== 'success') {\n return;\n }\n\n const { context } = renderService.drawParams;\n if (!context) {\n return;\n }\n const imageAttribute = getTheme(image).image;\n this._draw(image, imageAttribute, false, drawContext);\n }\n}\n"]}
@@ -1,11 +1,11 @@
1
1
  import type { IPath, IContext2d, IThemeAttribute, IGraphicAttribute, IMarkAttribute, IPathRenderContribution, IGraphicRender, IContributionProvider, IDrawContext, IGraphicRenderDrawParams, IRenderService, IPathGraphicAttribute } from '../../../interface';
2
2
  import { BaseRender } from './base-render';
3
3
  export declare class DefaultCanvasPathRender extends BaseRender<IPath> implements IGraphicRender {
4
- protected readonly graphicRenderContributions: IContributionProvider<IPathRenderContribution>;
4
+ protected readonly pathRenderContribitions: IContributionProvider<IPathRenderContribution>;
5
5
  type: 'path';
6
6
  numberType: number;
7
7
  tempTheme: Required<IPathGraphicAttribute>;
8
- constructor(graphicRenderContributions: IContributionProvider<IPathRenderContribution>);
8
+ constructor(pathRenderContribitions: IContributionProvider<IPathRenderContribution>);
9
9
  drawShape(path: IPath, 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;
10
10
  draw(path: IPath, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams): void;
11
11
  }
@@ -19,10 +19,10 @@ Object.defineProperty(exports, "__esModule", {
19
19
  const inversify_lite_1 = require("../../../common/inversify-lite"), contribution_provider_1 = require("../../../common/contribution-provider"), render_command_list_1 = require("../../../common/render-command-list"), theme_1 = require("../../../graphic/theme"), constants_1 = require("../../../graphic/constants"), constants_2 = require("./contributions/constants"), base_render_1 = require("./base-render"), path_contribution_render_1 = require("./contributions/path-contribution-render");
20
20
 
21
21
  let DefaultCanvasPathRender = class extends base_render_1.BaseRender {
22
- constructor(graphicRenderContributions) {
23
- super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = constants_1.PATH_NUMBER_TYPE,
22
+ constructor(pathRenderContribitions) {
23
+ super(), this.pathRenderContribitions = pathRenderContribitions, this.numberType = constants_1.PATH_NUMBER_TYPE,
24
24
  this.builtinContributions = [ path_contribution_render_1.defaultPathBackgroundRenderContribution, path_contribution_render_1.defaultPathTextureRenderContribution ],
25
- this.init(graphicRenderContributions);
25
+ this.init(pathRenderContribitions);
26
26
  }
27
27
  drawShape(path, context, x, y, drawContext, params, fillCb, strokeCb) {
28
28
  var _a, _b, _c;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/path-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAA2E;AAE3E,iFAA6E;AAC7E,6EAAwE;AAgBxE,kDAAkD;AAClD,0DAA8D;AAC9D,yDAAmE;AACnE,+CAA2C;AAC3C,uFAGkD;AAG3C,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,wBAAiB;IAK5D,YAGqB,0BAA0E;QAE7F,KAAK,EAAE,CAAC;QAFW,+BAA0B,GAA1B,0BAA0B,CAAgD;QAN/F,eAAU,GAAW,4BAAgB,CAAC;QASpC,IAAI,CAAC,oBAAoB,GAAG,CAAC,kEAAuC,EAAE,+DAAoC,CAAC,CAAC;QAC5G,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IACxC,CAAC;IAED,SAAS,CACP,IAAW,EACX,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ,QAIY;;QAGZ,MAAM,aAAa,GAAG,MAAA,IAAI,CAAC,SAAS,mCAAI,IAAA,gBAAQ,EAAC,IAAI,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,IAAI,CAAC;QAC3E,MAAM,EACJ,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC,CAAC,EAC5B,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC,CAAC,EAC5B,eAAe,GAAG,aAAa,CAAC,eAAe,EAChD,GAAG,IAAI,CAAC,SAAS,CAAC;QAEnB,MAAM,CAAC,GAAG,MAAA,IAAI,CAAC,CAAC,mCAAI,CAAC,CAAC;QAEtB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IA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AAU,GAAE;IAOR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,kCAAsB,CAAC,CAAA;;GAPrB,uBAAuB,CA8HnC;AA9HY,0DAAuB","file":"path-render.js","sourcesContent":["import { inject, injectable, named } from '../../../common/inversify-lite';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { renderCommandList } from '../../../common/render-command-list';\nimport type {\n IPath,\n ICustomPath2D,\n IContext2d,\n IThemeAttribute,\n IGraphicAttribute,\n IMarkAttribute,\n IPathRenderContribution,\n IGraphicRender,\n IContributionProvider,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService,\n IPathGraphicAttribute\n} from '../../../interface';\nimport { getTheme } from '../../../graphic/theme';\nimport { PATH_NUMBER_TYPE } from '../../../graphic/constants';\nimport { PathRenderContribution } from './contributions/constants';\nimport { BaseRender } from './base-render';\nimport {\n defaultPathBackgroundRenderContribution,\n defaultPathTextureRenderContribution\n} from './contributions/path-contribution-render';\n\n@injectable()\nexport class DefaultCanvasPathRender extends BaseRender<IPath> implements IGraphicRender {\n type: 'path';\n numberType: number = PATH_NUMBER_TYPE;\n tempTheme: Required<IPathGraphicAttribute>;\n\n constructor(\n @inject(ContributionProvider)\n @named(PathRenderContribution)\n protected readonly graphicRenderContributions: IContributionProvider<IPathRenderContribution>\n ) {\n super();\n this.builtinContributions = [defaultPathBackgroundRenderContribution, defaultPathTextureRenderContribution];\n this.init(graphicRenderContributions);\n }\n\n drawShape(\n path: IPath,\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 // const pathAttribute = graphicService.themeService.getCurrentTheme().pathAttribute;\n const pathAttribute = this.tempTheme ?? getTheme(path, params?.theme).path;\n const {\n x: originX = pathAttribute.x,\n y: originY = pathAttribute.y,\n fillStrokeOrder = pathAttribute.fillStrokeOrder\n } = path.attribute;\n\n const z = this.z ?? 0;\n\n const data = this.valid(path, pathAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n context.beginPath();\n if (path.pathShape) {\n renderCommandList((path.pathShape as ICustomPath2D).commandList, context, x, y, 1, 1, z);\n } else {\n const path2D = path.attribute.path ?? pathAttribute.path;\n renderCommandList((path2D as ICustomPath2D).commandList, context, x, y, 1, 1, z);\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute);\n\n this.beforeRenderStep(\n path,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n pathAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n\n const _runStroke = () => {\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, path.attribute, pathAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(path, path.attribute, originX - x, originY - y, pathAttribute);\n context.stroke();\n }\n }\n };\n const _runFill = () => {\n if (doFill) {\n if (fillCb) {\n fillCb(context, path.attribute, pathAttribute);\n } else if (fVisible) {\n context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute);\n context.fill();\n }\n }\n };\n\n if (!fillStrokeOrder) {\n _runFill();\n _runStroke();\n } else {\n _runStroke();\n _runFill();\n }\n\n this.afterRenderStep(\n path,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n pathAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(path: IPath, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const pathAttribute = getTheme(path, params?.theme).path;\n this.tempTheme = pathAttribute;\n this._draw(path, pathAttribute, false, drawContext, params);\n this.tempTheme = null;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/path-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAA2E;AAE3E,iFAA6E;AAC7E,6EAAwE;AAgBxE,kDAAkD;AAClD,0DAA8D;AAC9D,yDAAmE;AACnE,+CAA2C;AAC3C,uFAGkD;AAG3C,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,wBAAiB;IAK5D,YAGqB,uBAAuE;QAE1F,KAAK,EAAE,CAAC;QAFW,4BAAuB,GAAvB,uBAAuB,CAAgD;QAN5F,eAAU,GAAW,4BAAgB,CAAC;QASpC,IAAI,CAAC,oBAAoB,GAAG,CAAC,kEAAuC,EAAE,+DAAoC,CAAC,CAAC;QAC5G,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACrC,CAAC;IAED,SAAS,CACP,IAAW,EACX,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ,QAIY;;QAGZ,MAAM,aAAa,GAAG,MAAA,IAAI,CAAC,SAAS,mCAAI,IAAA,gBAAQ,EAAC,IAAI,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,IAAI,CAAC;QAC3E,MAAM,EACJ,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC,CAAC,EAC5B,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC,CAAC,EAC5B,eAAe,GAAG,aAAa,CAAC,eAAe,EAChD,GAAG,IAAI,CAAC,SAAS,CAAC;QAEnB,MAAM,CAAC,GAAG,MAAA,IAAI,CAAC,CAAC,mCAAI,CAAC,CAAC;QAEtB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC/D,IAAI,CAAC,IAAI,EAAE;YACT,OAAO;SACR;QACD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CAAC,CAAA;;GAPrB,uBAAuB,CA8HnC;AA9HY,0DAAuB","file":"path-render.js","sourcesContent":["import { inject, injectable, named } from '../../../common/inversify-lite';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { renderCommandList } from '../../../common/render-command-list';\nimport type {\n IPath,\n ICustomPath2D,\n IContext2d,\n IThemeAttribute,\n IGraphicAttribute,\n IMarkAttribute,\n IPathRenderContribution,\n IGraphicRender,\n IContributionProvider,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService,\n IPathGraphicAttribute\n} from '../../../interface';\nimport { getTheme } from '../../../graphic/theme';\nimport { PATH_NUMBER_TYPE } from '../../../graphic/constants';\nimport { PathRenderContribution } from './contributions/constants';\nimport { BaseRender } from './base-render';\nimport {\n defaultPathBackgroundRenderContribution,\n defaultPathTextureRenderContribution\n} from './contributions/path-contribution-render';\n\n@injectable()\nexport class DefaultCanvasPathRender extends BaseRender<IPath> implements IGraphicRender {\n type: 'path';\n numberType: number = PATH_NUMBER_TYPE;\n tempTheme: Required<IPathGraphicAttribute>;\n\n constructor(\n @inject(ContributionProvider)\n @named(PathRenderContribution)\n protected readonly pathRenderContribitions: IContributionProvider<IPathRenderContribution>\n ) {\n super();\n this.builtinContributions = [defaultPathBackgroundRenderContribution, defaultPathTextureRenderContribution];\n this.init(pathRenderContribitions);\n }\n\n drawShape(\n path: IPath,\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 // const pathAttribute = graphicService.themeService.getCurrentTheme().pathAttribute;\n const pathAttribute = this.tempTheme ?? getTheme(path, params?.theme).path;\n const {\n x: originX = pathAttribute.x,\n y: originY = pathAttribute.y,\n fillStrokeOrder = pathAttribute.fillStrokeOrder\n } = path.attribute;\n\n const z = this.z ?? 0;\n\n const data = this.valid(path, pathAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n context.beginPath();\n if (path.pathShape) {\n renderCommandList((path.pathShape as ICustomPath2D).commandList, context, x, y, 1, 1, z);\n } else {\n const path2D = path.attribute.path ?? pathAttribute.path;\n renderCommandList((path2D as ICustomPath2D).commandList, context, x, y, 1, 1, z);\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute);\n\n this.beforeRenderStep(\n path,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n pathAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n\n const _runStroke = () => {\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, path.attribute, pathAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(path, path.attribute, originX - x, originY - y, pathAttribute);\n context.stroke();\n }\n }\n };\n const _runFill = () => {\n if (doFill) {\n if (fillCb) {\n fillCb(context, path.attribute, pathAttribute);\n } else if (fVisible) {\n context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute);\n context.fill();\n }\n }\n };\n\n if (!fillStrokeOrder) {\n _runFill();\n _runStroke();\n } else {\n _runStroke();\n _runFill();\n }\n\n this.afterRenderStep(\n path,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n pathAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(path: IPath, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const pathAttribute = getTheme(path, params?.theme).path;\n this.tempTheme = pathAttribute;\n this._draw(path, pathAttribute, false, drawContext, params);\n this.tempTheme = null;\n }\n}\n"]}
@@ -1,10 +1,10 @@
1
1
  import type { IGraphicAttribute, IContext2d, IMarkAttribute, IPolygon, IThemeAttribute, IGraphicRender, IPolygonRenderContribution, IContributionProvider, IDrawContext, IGraphicRenderDrawParams, IRenderService } from '../../../interface';
2
2
  import { BaseRender } from './base-render';
3
3
  export declare class DefaultCanvasPolygonRender extends BaseRender<IPolygon> implements IGraphicRender {
4
- protected readonly graphicRenderContributions: IContributionProvider<IPolygonRenderContribution>;
4
+ protected readonly polygonRenderContribitions: IContributionProvider<IPolygonRenderContribution>;
5
5
  type: 'polygon';
6
6
  numberType: number;
7
- constructor(graphicRenderContributions: IContributionProvider<IPolygonRenderContribution>);
7
+ constructor(polygonRenderContribitions: IContributionProvider<IPolygonRenderContribution>);
8
8
  drawShape(polygon: IPolygon, 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;
9
9
  draw(polygon: IPolygon, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams): void;
10
10
  }
@@ -19,10 +19,10 @@ Object.defineProperty(exports, "__esModule", {
19
19
  const vutils_1 = require("@visactor/vutils"), inversify_lite_1 = require("../../../common/inversify-lite"), theme_1 = require("../../../graphic/theme"), constants_1 = require("../../../graphic/constants"), polygon_1 = require("../../../common/polygon"), constants_2 = require("./contributions/constants"), contribution_provider_1 = require("../../../common/contribution-provider"), base_render_1 = require("./base-render"), polygon_contribution_render_1 = require("./contributions/polygon-contribution-render");
20
20
 
21
21
  let DefaultCanvasPolygonRender = class extends base_render_1.BaseRender {
22
- constructor(graphicRenderContributions) {
23
- super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = constants_1.POLYGON_NUMBER_TYPE,
22
+ constructor(polygonRenderContribitions) {
23
+ super(), this.polygonRenderContribitions = polygonRenderContribitions, this.numberType = constants_1.POLYGON_NUMBER_TYPE,
24
24
  this.builtinContributions = [ polygon_contribution_render_1.defaultPolygonBackgroundRenderContribution, polygon_contribution_render_1.defaultPolygonTextureRenderContribution ],
25
- this.init(graphicRenderContributions);
25
+ this.init(polygonRenderContribitions);
26
26
  }
27
27
  drawShape(polygon, context, x, y, drawContext, params, fillCb, strokeCb) {
28
28
  const polygonAttribute = (0, theme_1.getTheme)(polygon, null == params ? void 0 : params.theme).polygon, {points: points = polygonAttribute.points, cornerRadius: cornerRadius = polygonAttribute.cornerRadius, x: originX = polygonAttribute.x, y: originY = polygonAttribute.y, closePath: closePath = polygonAttribute.closePath, fillStrokeOrder: fillStrokeOrder = polygonAttribute.fillStrokeOrder} = polygon.attribute, data = this.valid(polygon, polygonAttribute, fillCb, strokeCb);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/polygon-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA2C;AAC3C,mEAA2E;AAC3E,kDAAkD;AAClD,0DAAiE;AAcjE,qDAA0E;AAC1E,yDAAsE;AAEtE,iFAA6E;AAC7E,+CAA2C;AAC3C,6FAGqD;AAG9C,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,wBAAoB;IAIlE,YAGqB,0BAA6E;QAEhG,KAAK,EAAE,CAAC;QAFW,+BAA0B,GAA1B,0BAA0B,CAAmD;QALlG,eAAU,GAAW,+BAAmB,CAAC;QAQvC,IAAI,CAAC,oBAAoB,GAAG,CAAC,wEAA0C,EAAE,qEAAuC,CAAC,CAAC;QAClH,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IACxC,CAAC;IAED,SAAS,CACP,OAAiB,EACjB,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ,QAIY;QAGZ,MAAM,gBAAgB,GAAG,IAAA,gBAAQ,EAAC,OAAO,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE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CAAC,EACD,CAAC,EACD,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,MAAM,EACN,QAAQ,CACT,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,OAAiB,EAAE,aAA6B,EAAE,WAAyB,EAAE,MAAiC;QACjH,MAAM,gBAAgB,GAAG,IAAA,gBAAQ,EAAC,OAAO,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,OAAO,CAAC;QAClE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC;CACF,CAAA;AAjIY,0BAA0B;IADtC,IAAA,2BAAU,GAAE;IAMR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,qCAAyB,CAAC,CAAA;;GANxB,0BAA0B,CAiItC;AAjIY,gEAA0B","file":"polygon-render.js","sourcesContent":["import { isArray } from '@visactor/vutils';\nimport { inject, injectable, named } from '../../../common/inversify-lite';\nimport { getTheme } from '../../../graphic/theme';\nimport { POLYGON_NUMBER_TYPE } from '../../../graphic/constants';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IPolygon,\n IThemeAttribute,\n IGraphicRender,\n IPolygonRenderContribution,\n IContributionProvider,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService\n} from '../../../interface';\nimport { drawPolygon, drawRoundedPolygon } from '../../../common/polygon';\nimport { PolygonRenderContribution } from './contributions/constants';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { BaseRender } from './base-render';\nimport {\n defaultPolygonBackgroundRenderContribution,\n defaultPolygonTextureRenderContribution\n} from './contributions/polygon-contribution-render';\n\n@injectable()\nexport class DefaultCanvasPolygonRender extends BaseRender<IPolygon> implements IGraphicRender {\n type: 'polygon';\n numberType: number = POLYGON_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(PolygonRenderContribution)\n protected readonly graphicRenderContributions: IContributionProvider<IPolygonRenderContribution>\n ) {\n super();\n this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution];\n this.init(graphicRenderContributions);\n }\n\n drawShape(\n polygon: IPolygon,\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 // const polygonAttribute = graphicService.themeService.getCurrentTheme().polygonAttribute;\n const polygonAttribute = getTheme(polygon, params?.theme).polygon;\n const {\n points = polygonAttribute.points,\n cornerRadius = polygonAttribute.cornerRadius,\n x: originX = polygonAttribute.x,\n y: originY = polygonAttribute.y,\n closePath = polygonAttribute.closePath,\n fillStrokeOrder = polygonAttribute.fillStrokeOrder\n } = polygon.attribute;\n\n const data = this.valid(polygon, polygonAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n context.beginPath();\n\n if ((cornerRadius as number) <= 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n drawPolygon(context.camera ? context : context.nativeContext, points, x, y);\n } else {\n // FIXME: type\n drawRoundedPolygon(context.camera ? context : context.nativeContext, points, x, y, cornerRadius, closePath);\n }\n // polygon 默认闭合\n closePath && context.closePath();\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(polygon, polygon.attribute, polygonAttribute);\n\n this.beforeRenderStep(\n polygon,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n polygonAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n\n const _runFill = () => {\n if (doFill) {\n if (fillCb) {\n fillCb(context, polygon.attribute, polygonAttribute);\n } else if (fVisible) {\n // 存在fill\n context.setCommonStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute);\n context.fill();\n }\n }\n };\n const _runStroke = () => {\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, polygon.attribute, polygonAttribute);\n } else if (sVisible) {\n // 存在stroke\n context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute);\n context.stroke();\n }\n }\n };\n\n if (!fillStrokeOrder) {\n _runFill();\n _runStroke();\n } else {\n _runStroke();\n _runFill();\n }\n\n this.afterRenderStep(\n polygon,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n polygonAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(polygon: IPolygon, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const polygonAttribute = getTheme(polygon, params?.theme).polygon;\n this._draw(polygon, polygonAttribute, false, drawContext, params);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/polygon-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA2C;AAC3C,mEAA2E;AAC3E,kDAAkD;AAClD,0DAAiE;AAcjE,qDAA0E;AAC1E,yDAAsE;AAEtE,iFAA6E;AAC7E,+CAA2C;AAC3C,6FAGqD;AAG9C,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,wBAAoB;IAIlE,YAGqB,0BAA6E;QAEhG,KAAK,EAAE,CAAC;QAFW,+BAA0B,GAA1B,0BAA0B,CAAmD;QALlG,eAAU,GAAW,+BAAmB,CAAC;QAQvC,IAAI,CAAC,oBAAoB,GAAG,CAAC,wEAA0C,EAAE,qEAAuC,CAAC,CAAC;QAClH,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IACxC,CAAC;IAED,SAAS,CACP,O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,IAAI,CAAC,eAAe,EAAE;YACpB,QAAQ,EAAE,CAAC;YACX,UAAU,EAAE,CAAC;SACd;aAAM;YACL,UAAU,EAAE,CAAC;YACb,QAAQ,EAAE,CAAC;SACZ;QAED,IAAI,CAAC,eAAe,CAClB,OAAO,EACP,OAAO,EACP,CAAC,EACD,CAAC,EACD,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,MAAM,EACN,QAAQ,CACT,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,OAAiB,EAAE,aAA6B,EAAE,WAAyB,EAAE,MAAiC;QACjH,MAAM,gBAAgB,GAAG,IAAA,gBAAQ,EAAC,OAAO,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,OAAO,CAAC;QAClE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC;CACF,CAAA;AAjIY,0BAA0B;IADtC,IAAA,2BAAU,GAAE;IAMR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,qCAAyB,CAAC,CAAA;;GANxB,0BAA0B,CAiItC;AAjIY,gEAA0B","file":"polygon-render.js","sourcesContent":["import { isArray } from '@visactor/vutils';\nimport { inject, injectable, named } from '../../../common/inversify-lite';\nimport { getTheme } from '../../../graphic/theme';\nimport { POLYGON_NUMBER_TYPE } from '../../../graphic/constants';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IPolygon,\n IThemeAttribute,\n IGraphicRender,\n IPolygonRenderContribution,\n IContributionProvider,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService\n} from '../../../interface';\nimport { drawPolygon, drawRoundedPolygon } from '../../../common/polygon';\nimport { PolygonRenderContribution } from './contributions/constants';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { BaseRender } from './base-render';\nimport {\n defaultPolygonBackgroundRenderContribution,\n defaultPolygonTextureRenderContribution\n} from './contributions/polygon-contribution-render';\n\n@injectable()\nexport class DefaultCanvasPolygonRender extends BaseRender<IPolygon> implements IGraphicRender {\n type: 'polygon';\n numberType: number = POLYGON_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(PolygonRenderContribution)\n protected readonly polygonRenderContribitions: IContributionProvider<IPolygonRenderContribution>\n ) {\n super();\n this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution];\n this.init(polygonRenderContribitions);\n }\n\n drawShape(\n polygon: IPolygon,\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 // const polygonAttribute = graphicService.themeService.getCurrentTheme().polygonAttribute;\n const polygonAttribute = getTheme(polygon, params?.theme).polygon;\n const {\n points = polygonAttribute.points,\n cornerRadius = polygonAttribute.cornerRadius,\n x: originX = polygonAttribute.x,\n y: originY = polygonAttribute.y,\n closePath = polygonAttribute.closePath,\n fillStrokeOrder = polygonAttribute.fillStrokeOrder\n } = polygon.attribute;\n\n const data = this.valid(polygon, polygonAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n context.beginPath();\n\n if ((cornerRadius as number) <= 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n drawPolygon(context.camera ? context : context.nativeContext, points, x, y);\n } else {\n // FIXME: type\n drawRoundedPolygon(context.camera ? context : context.nativeContext, points, x, y, cornerRadius, closePath);\n }\n // polygon 默认闭合\n closePath && context.closePath();\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(polygon, polygon.attribute, polygonAttribute);\n\n this.beforeRenderStep(\n polygon,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n polygonAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n\n const _runFill = () => {\n if (doFill) {\n if (fillCb) {\n fillCb(context, polygon.attribute, polygonAttribute);\n } else if (fVisible) {\n // 存在fill\n context.setCommonStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute);\n context.fill();\n }\n }\n };\n const _runStroke = () => {\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, polygon.attribute, polygonAttribute);\n } else if (sVisible) {\n // 存在stroke\n context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute);\n context.stroke();\n }\n }\n };\n\n if (!fillStrokeOrder) {\n _runFill();\n _runStroke();\n } else {\n _runStroke();\n _runFill();\n }\n\n this.afterRenderStep(\n polygon,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n polygonAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(polygon: IPolygon, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const polygonAttribute = getTheme(polygon, params?.theme).polygon;\n this._draw(polygon, polygonAttribute, false, drawContext, params);\n }\n}\n"]}