@visactor/vrender-core 0.19.0-alpha.1 → 0.19.1

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 (181) hide show
  1. package/cjs/common/text.d.ts +3 -2
  2. package/cjs/common/text.js +20 -4
  3. package/cjs/common/text.js.map +1 -1
  4. package/cjs/core/contributions/env/base-contribution.d.ts +1 -0
  5. package/cjs/core/contributions/env/base-contribution.js +3 -0
  6. package/cjs/core/contributions/env/base-contribution.js.map +1 -1
  7. package/cjs/core/contributions/textMeasure/AtextMeasure.d.ts +1 -1
  8. package/cjs/core/contributions/textMeasure/AtextMeasure.js +8 -4
  9. package/cjs/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
  10. package/cjs/core/global.d.ts +1 -0
  11. package/cjs/core/global.js +3 -0
  12. package/cjs/core/global.js.map +1 -1
  13. package/cjs/core/stage.d.ts +4 -0
  14. package/cjs/core/stage.js +6 -1
  15. package/cjs/core/stage.js.map +1 -1
  16. package/cjs/event/event-manager.js +9 -3
  17. package/cjs/event/event-manager.js.map +1 -1
  18. package/cjs/event/event-target.js +0 -2
  19. package/cjs/event/event-target.js.map +1 -1
  20. package/cjs/graphic/config.js +4 -0
  21. package/cjs/graphic/config.js.map +1 -1
  22. package/cjs/graphic/graphic-service/graphic-service.d.ts +1 -0
  23. package/cjs/graphic/graphic-service/graphic-service.js +23 -5
  24. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  25. package/cjs/graphic/graphic.d.ts +1 -0
  26. package/cjs/graphic/graphic.js +9 -6
  27. package/cjs/graphic/graphic.js.map +1 -1
  28. package/cjs/graphic/rect3d.js +1 -1
  29. package/cjs/graphic/rect3d.js.map +1 -1
  30. package/cjs/graphic/richtext/frame.js +9 -9
  31. package/cjs/graphic/richtext/frame.js.map +1 -1
  32. package/cjs/graphic/richtext/line.d.ts +2 -2
  33. package/cjs/graphic/richtext/line.js +9 -6
  34. package/cjs/graphic/richtext/line.js.map +1 -1
  35. package/cjs/graphic/richtext/paragraph.d.ts +2 -0
  36. package/cjs/graphic/richtext/paragraph.js +5 -5
  37. package/cjs/graphic/richtext/paragraph.js.map +1 -1
  38. package/cjs/graphic/richtext/utils.js +4 -2
  39. package/cjs/graphic/richtext/utils.js.map +1 -1
  40. package/cjs/graphic/richtext.d.ts +6 -0
  41. package/cjs/graphic/richtext.js +16 -4
  42. package/cjs/graphic/richtext.js.map +1 -1
  43. package/cjs/graphic/text.js +1 -1
  44. package/cjs/graphic/text.js.map +1 -1
  45. package/cjs/graphic/theme.js +0 -2
  46. package/cjs/graphic/theme.js.map +1 -1
  47. package/cjs/interface/animate.d.ts +1 -0
  48. package/cjs/interface/animate.js.map +1 -1
  49. package/cjs/interface/contribution.d.ts +1 -0
  50. package/cjs/interface/contribution.js.map +1 -1
  51. package/cjs/interface/event.d.ts +0 -3
  52. package/cjs/interface/event.js.map +1 -1
  53. package/cjs/interface/global.d.ts +2 -0
  54. package/cjs/interface/global.js.map +1 -1
  55. package/cjs/interface/graphic/richText.d.ts +6 -2
  56. package/cjs/interface/graphic/richText.js.map +1 -1
  57. package/cjs/interface/graphic/theme.d.ts +0 -3
  58. package/cjs/interface/graphic/theme.js.map +1 -1
  59. package/cjs/interface/graphic.d.ts +25 -19
  60. package/cjs/interface/graphic.js.map +1 -1
  61. package/cjs/interface/stage.d.ts +8 -0
  62. package/cjs/interface/stage.js.map +1 -1
  63. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +5 -3
  64. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  65. package/cjs/plugins/builtin-plugin/html-attribute-plugin.d.ts +21 -4
  66. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +116 -54
  67. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  68. package/cjs/plugins/builtin-plugin/react-attribute-plugin.d.ts +8 -1
  69. package/cjs/plugins/builtin-plugin/react-attribute-plugin.js +32 -43
  70. package/cjs/plugins/builtin-plugin/react-attribute-plugin.js.map +1 -1
  71. package/cjs/render/contributions/render/base-render.js +8 -0
  72. package/cjs/render/contributions/render/base-render.js.map +1 -1
  73. package/cjs/render/contributions/render/contributions/rect-contribution-render.js +4 -2
  74. package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  75. package/cjs/render/contributions/render/contributions/text-contribution-render.js +9 -3
  76. package/cjs/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
  77. package/cjs/render/contributions/render/draw-contribution.js +2 -2
  78. package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
  79. package/cjs/render/contributions/render/draw-interceptor.js +7 -0
  80. package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
  81. package/cjs/render/contributions/render/rect3d-render.js +1 -1
  82. package/cjs/render/contributions/render/rect3d-render.js.map +1 -1
  83. package/cjs/render/contributions/render/text-render.js +2 -2
  84. package/cjs/render/contributions/render/text-render.js.map +1 -1
  85. package/cjs/render/contributions/render/utils.js +1 -1
  86. package/cjs/render/contributions/render/utils.js.map +1 -1
  87. package/cjs/render/render-modules.js +1 -1
  88. package/cjs/render/render-modules.js.map +1 -1
  89. package/cjs/render/render-service.js +1 -1
  90. package/cjs/render/render-service.js.map +1 -1
  91. package/es/common/text.d.ts +3 -2
  92. package/es/common/text.js +13 -0
  93. package/es/common/text.js.map +1 -1
  94. package/es/core/contributions/env/base-contribution.d.ts +1 -0
  95. package/es/core/contributions/env/base-contribution.js +3 -0
  96. package/es/core/contributions/env/base-contribution.js.map +1 -1
  97. package/es/core/contributions/textMeasure/AtextMeasure.d.ts +1 -1
  98. package/es/core/contributions/textMeasure/AtextMeasure.js +8 -4
  99. package/es/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
  100. package/es/core/global.d.ts +1 -0
  101. package/es/core/global.js +3 -0
  102. package/es/core/global.js.map +1 -1
  103. package/es/core/stage.d.ts +4 -0
  104. package/es/core/stage.js +6 -1
  105. package/es/core/stage.js.map +1 -1
  106. package/es/event/event-manager.js +9 -3
  107. package/es/event/event-manager.js.map +1 -1
  108. package/es/event/event-target.js +0 -2
  109. package/es/event/event-target.js.map +1 -1
  110. package/es/graphic/config.js +4 -0
  111. package/es/graphic/config.js.map +1 -1
  112. package/es/graphic/graphic-service/graphic-service.d.ts +1 -0
  113. package/es/graphic/graphic-service/graphic-service.js +23 -8
  114. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  115. package/es/graphic/graphic.d.ts +1 -0
  116. package/es/graphic/graphic.js +9 -6
  117. package/es/graphic/graphic.js.map +1 -1
  118. package/es/graphic/rect3d.js +1 -1
  119. package/es/graphic/rect3d.js.map +1 -1
  120. package/es/graphic/richtext/frame.js +9 -9
  121. package/es/graphic/richtext/frame.js.map +1 -1
  122. package/es/graphic/richtext/line.d.ts +2 -2
  123. package/es/graphic/richtext/line.js +9 -6
  124. package/es/graphic/richtext/line.js.map +1 -1
  125. package/es/graphic/richtext/paragraph.d.ts +2 -0
  126. package/es/graphic/richtext/paragraph.js +5 -5
  127. package/es/graphic/richtext/paragraph.js.map +1 -1
  128. package/es/graphic/richtext/utils.js +4 -2
  129. package/es/graphic/richtext/utils.js.map +1 -1
  130. package/es/graphic/richtext.d.ts +6 -0
  131. package/es/graphic/richtext.js +16 -4
  132. package/es/graphic/richtext.js.map +1 -1
  133. package/es/graphic/text.js +1 -1
  134. package/es/graphic/text.js.map +1 -1
  135. package/es/graphic/theme.js +1 -3
  136. package/es/graphic/theme.js.map +1 -1
  137. package/es/interface/animate.d.ts +1 -0
  138. package/es/interface/animate.js.map +1 -1
  139. package/es/interface/contribution.d.ts +1 -0
  140. package/es/interface/contribution.js.map +1 -1
  141. package/es/interface/event.d.ts +0 -3
  142. package/es/interface/event.js.map +1 -1
  143. package/es/interface/global.d.ts +2 -0
  144. package/es/interface/global.js.map +1 -1
  145. package/es/interface/graphic/richText.d.ts +6 -2
  146. package/es/interface/graphic/richText.js.map +1 -1
  147. package/es/interface/graphic/theme.d.ts +0 -3
  148. package/es/interface/graphic/theme.js.map +1 -1
  149. package/es/interface/graphic.d.ts +25 -19
  150. package/es/interface/graphic.js.map +1 -1
  151. package/es/interface/stage.d.ts +8 -0
  152. package/es/interface/stage.js.map +1 -1
  153. package/es/plugins/builtin-plugin/flex-layout-plugin.js +5 -3
  154. package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  155. package/es/plugins/builtin-plugin/html-attribute-plugin.d.ts +21 -4
  156. package/es/plugins/builtin-plugin/html-attribute-plugin.js +117 -54
  157. package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  158. package/es/plugins/builtin-plugin/react-attribute-plugin.d.ts +8 -1
  159. package/es/plugins/builtin-plugin/react-attribute-plugin.js +32 -42
  160. package/es/plugins/builtin-plugin/react-attribute-plugin.js.map +1 -1
  161. package/es/render/contributions/render/base-render.js +8 -0
  162. package/es/render/contributions/render/base-render.js.map +1 -1
  163. package/es/render/contributions/render/contributions/rect-contribution-render.js +4 -2
  164. package/es/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  165. package/es/render/contributions/render/contributions/text-contribution-render.js +9 -3
  166. package/es/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
  167. package/es/render/contributions/render/draw-contribution.js +2 -2
  168. package/es/render/contributions/render/draw-contribution.js.map +1 -1
  169. package/es/render/contributions/render/draw-interceptor.js +7 -0
  170. package/es/render/contributions/render/draw-interceptor.js.map +1 -1
  171. package/es/render/contributions/render/rect3d-render.js +1 -1
  172. package/es/render/contributions/render/rect3d-render.js.map +1 -1
  173. package/es/render/contributions/render/text-render.js +2 -2
  174. package/es/render/contributions/render/text-render.js.map +1 -1
  175. package/es/render/contributions/render/utils.js +1 -1
  176. package/es/render/contributions/render/utils.js.map +1 -1
  177. package/es/render/render-modules.js +1 -1
  178. package/es/render/render-modules.js.map +1 -1
  179. package/es/render/render-service.js +1 -1
  180. package/es/render/render-service.js.map +1 -1
  181. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugins/builtin-plug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IStage } from '../../interface';\nimport { getTheme } from '../../graphic';\nimport type { IPlugin, IPluginService } from '../../interface';\nimport { Generator } from '../../common/generator';\nimport { isNumber } from '../../canvas/util';\nimport { parsePadding } from '../../common/utils';\nimport type { IAABBBounds } from '@visactor/vutils';\nimport { AABBBounds, isArray } from '@visactor/vutils';\nimport { application } from '../../application';\n\nconst _tempBounds = new AABBBounds();\n\ntype IAnchorPosMap = {\n 'flex-start': number;\n 'flex-end': number;\n center: number;\n};\n\nexport class FlexLayoutPlugin implements IPlugin {\n name: 'FlexLayoutPlugin' = 'FlexLayoutPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n id: number = Generator.GenAutoIncrementId();\n key: string = this.name + this.id;\n tempBounds: AABBBounds = new AABBBounds();\n pause: boolean;\n skipBoundsTrigger: boolean;\n\n pauseLayout(p: boolean) {\n this.pause = p;\n }\n\n tryLayoutChildren(graphic: IGraphic) {\n if (graphic.firstChild) {\n this.tryLayout(graphic.firstChild as IGraphic);\n }\n }\n\n tryLayout(graphic: IGraphic, force: boolean = true) {\n if (this.pause) {\n return;\n }\n const p = graphic.parent;\n if (!(force || (p && graphic.needUpdateLayout()))) {\n return;\n }\n const theme = getTheme(p).group;\n const { display = theme.display } = p.attribute;\n if (display !== 'flex') {\n return;\n }\n const {\n // width,\n // height,\n flexDirection = theme.flexDirection,\n flexWrap = theme.flexWrap,\n alignItems = theme.alignItems,\n clip = theme.clip\n } = p.attribute;\n const { alignContent = alignItems ?? theme.alignContent } = p.attribute;\n // if (!(width && height)) {\n // return;\n // }\n\n let { width, height, justifyContent = theme.justifyContent } = p.attribute;\n const children = p.getChildren() as IGraphic[];\n if (width == null || height == null) {\n // 计算子节点flex排列后的宽高\n let childrenWidth = 0;\n let childrenHeight = 0;\n let boundsLegal = 0;\n children.forEach((child: IGraphic) => {\n const bounds = this.getAABBBounds(child);\n if (bounds.empty()) {\n return;\n }\n if (flexDirection === 'column' || flexDirection === 'column-reverse') {\n childrenHeight += bounds.height();\n childrenWidth = Math.max(childrenWidth, bounds.width());\n } else {\n childrenWidth += bounds.width();\n childrenHeight = Math.max(childrenHeight, bounds.height());\n }\n boundsLegal += bounds.x1;\n boundsLegal += bounds.y1;\n boundsLegal += bounds.x2;\n boundsLegal += bounds.y2;\n });\n // judgement children bounds legal\n if (!isFinite(boundsLegal)) {\n return;\n }\n width = childrenWidth;\n height = childrenHeight;\n }\n\n p.attribute.width = width;\n p.attribute.height = height;\n\n // 这里使用p._AABBBounds可能会将非布局造成的bounds更新也会触发重新布局\n // TODO: 增加layout前预处理,在非递归布局前将子节点及其全部父节点_AABBBounds更新\n this.tempBounds.copy(p._AABBBounds);\n const result = {\n main: { len: width, field: 'x' },\n cross: { len: height, field: 'y' }\n };\n const main = result.main;\n const cross = result.cross;\n if (flexDirection === 'column' || flexDirection === 'column-reverse') {\n main.len = height;\n cross.len = width;\n main.field = 'y';\n cross.field = 'x';\n }\n if (flexDirection === 'row-reverse' || flexDirection === 'column-reverse') {\n if (justifyContent === 'flex-start') {\n justifyContent = 'flex-end';\n } else if (justifyContent === 'flex-end') {\n justifyContent = 'flex-start';\n } else {\n children.reverse();\n }\n }\n\n // 计算宽度\n let mainLen = 0;\n let crossLen = 0;\n const mianLenArray: { mainLen: number; crossLen: number }[] = [];\n children.forEach((c: IGraphic) => {\n const b = this.getAABBBounds(c);\n if (b.empty()) {\n return;\n }\n const ml = main.field === 'x' ? b.width() : b.height();\n const cl = cross.field === 'x' ? b.width() : b.height();\n mianLenArray.push({ mainLen: ml, crossLen: cl });\n mainLen += ml;\n crossLen = Math.max(crossLen, cl);\n });\n // 解析main\n const mainList: { idx: number; mainLen: number; crossLen: number }[] = [];\n if (mainLen > main.len && flexWrap === 'wrap') {\n let tempMainL = 0;\n let tempCrossL = 0;\n mianLenArray.forEach(({ mainLen, crossLen }, i) => {\n if (tempMainL + mainLen > main.len) {\n if (tempMainL === 0) {\n mainList.push({ idx: i, mainLen: tempMainL + mainLen, crossLen });\n tempMainL = 0;\n tempCrossL = 0;\n } else {\n mainList.push({ idx: i - 1, mainLen: tempMainL, crossLen });\n tempMainL = mainLen;\n tempCrossL = crossLen;\n }\n } else {\n tempMainL += mainLen;\n tempCrossL = Math.max(tempCrossL, crossLen);\n }\n });\n mainList.push({ idx: mianLenArray.length - 1, mainLen: tempMainL, crossLen: tempCrossL });\n } else {\n mainList.push({ idx: mianLenArray.length - 1, mainLen: mainLen, crossLen });\n }\n\n // 布局main\n let lastIdx: number = 0;\n mainList.forEach(s => {\n this.layoutMain(p, children, justifyContent, main, mianLenArray, lastIdx, s);\n lastIdx = s.idx + 1;\n });\n\n crossLen = mainList.reduce((a, b) => a + b.crossLen, 0);\n\n // 布局cross\n\n if (mainList.length === 1) {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': 0,\n 'flex-end': cross.len,\n center: cross.len / 2\n };\n this.layoutCross(children, alignItems, cross, anchorPosMap, mianLenArray, mainList[0], 0);\n } else {\n if (alignContent === 'flex-start') {\n lastIdx = 0;\n let anchorPos = 0;\n mainList.forEach((s, i) => {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': anchorPos,\n 'flex-end': anchorPos + s.crossLen,\n center: anchorPos + s.crossLen / 2\n };\n this.layoutCross(children, 'flex-start', cross, anchorPosMap, mianLenArray, mainList[i], lastIdx);\n lastIdx = s.idx + 1;\n anchorPos += s.crossLen;\n });\n } else if (alignContent === 'center') {\n lastIdx = 0;\n const padding = Math.max(0, (cross.len - crossLen) / 2);\n let anchorPos = padding;\n mainList.forEach((s, i) => {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': anchorPos,\n 'flex-end': anchorPos + s.crossLen,\n center: anchorPos + s.crossLen / 2\n };\n this.layoutCross(children, 'center', cross, anchorPosMap, mianLenArray, mainList[i], lastIdx);\n lastIdx = s.idx + 1;\n anchorPos += s.crossLen;\n });\n } else if (alignContent === 'space-around') {\n lastIdx = 0;\n const padding = Math.max(0, (cross.len - crossLen) / mainList.length / 2);\n let anchorPos = padding;\n mainList.forEach((s, i) => {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': anchorPos,\n 'flex-end': anchorPos + s.crossLen,\n center: anchorPos + s.crossLen / 2\n };\n this.layoutCross(children, 'flex-start', cross, anchorPosMap, mianLenArray, mainList[i], lastIdx);\n lastIdx = s.idx + 1;\n anchorPos += s.crossLen + padding * 2;\n });\n } else if (alignContent === 'space-between') {\n lastIdx = 0;\n const padding = Math.max(0, (cross.len - crossLen) / (mainList.length * 2 - 2));\n let anchorPos = 0;\n mainList.forEach((s, i) => {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': anchorPos,\n 'flex-end': anchorPos + s.crossLen,\n center: anchorPos + s.crossLen / 2\n };\n this.layoutCross(children, 'flex-start', cross, anchorPosMap, mianLenArray, mainList[i], lastIdx);\n lastIdx = s.idx + 1;\n anchorPos += s.crossLen + padding * 2;\n });\n }\n }\n\n // update children\n children.forEach((child, idx) => {\n child.addUpdateBoundTag();\n child.addUpdatePositionTag();\n child.clearUpdateLayoutTag();\n });\n\n p.addUpdateLayoutTag();\n // 更新父级元素的layout,直到存在clip\n const b = this.getAABBBounds(p);\n if (!clip && !this.tempBounds.equals(b)) {\n // 判断父元素包围盒是否发生变化\n this.tryLayout(p, false);\n }\n }\n\n // 避免获取bounds的时候递归进行布局\n getAABBBounds(graphic: IGraphic) {\n this.skipBoundsTrigger = true;\n const b = graphic.AABBBounds;\n this.skipBoundsTrigger = false;\n return b;\n }\n\n // 锚点并不一定总在左上角,根据位置和bounds的偏移进行定位\n private updateChildPos(posBaseLeftTop: number, lastP: number | undefined, lastBP: number): number {\n return posBaseLeftTop + (lastP ?? 0) - lastBP;\n }\n\n layoutMain(\n p: IGroup,\n children: IGraphic[],\n justifyContent: IGroupAttribute['justifyContent'],\n main: { len: number; field: string },\n mianLenArray: { mainLen: number; crossLen: number }[],\n lastIdx: number,\n currSeg: { idx: number; mainLen: number; crossLen: number }\n ) {\n if (justifyContent === 'flex-start') {\n let pos = 0;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen;\n }\n } else if (justifyContent === 'flex-end') {\n let pos = main.len;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n pos -= mianLenArray[i].mainLen;\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n }\n } else if (justifyContent === 'space-around') {\n if (currSeg.mainLen >= main.len) {\n let pos = 0;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen;\n }\n } else {\n const size = currSeg.idx - lastIdx + 1;\n const padding = (main.len - currSeg.mainLen) / size / 2;\n let pos = padding;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen + padding * 2;\n }\n }\n } else if (justifyContent === 'space-between') {\n if (currSeg.mainLen >= main.len) {\n let pos = 0;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen;\n }\n } else {\n const size = currSeg.idx - lastIdx + 1;\n const padding = (main.len - currSeg.mainLen) / (size * 2 - 2);\n let pos = 0;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen + padding * 2;\n }\n }\n } else if (justifyContent === 'center') {\n let pos = (main.len - currSeg.mainLen) / 2;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen;\n }\n }\n }\n\n layoutCross(\n children: IGraphic[],\n alignItem: IGroupAttribute['alignItems'],\n cross: { len: number; field: string },\n anchorPosMap: IAnchorPosMap,\n lenArray: { mainLen: number; crossLen: number }[],\n currSeg: { idx: number; mainLen: number; crossLen: number },\n lastIdx: number\n ) {\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const child = children[i];\n let { alignSelf } = child.attribute;\n if (!alignSelf || alignSelf === 'auto') {\n alignSelf = alignItem;\n }\n const b = this.getAABBBounds(child);\n const anchorPos = anchorPosMap[alignSelf] ?? anchorPosMap['flex-start'];\n if (alignSelf === 'flex-end') {\n !b.empty() &&\n (child.attribute[cross.field] = this.updateChildPos(\n anchorPos - lenArray[i].crossLen + getPadding(child, cross.field),\n child.attribute[cross.field],\n b[`${cross.field}1`]\n ));\n } else if (alignSelf === 'center') {\n !b.empty() &&\n (child.attribute[cross.field] = this.updateChildPos(\n anchorPos - lenArray[i].crossLen / 2 + getPadding(child, cross.field),\n child.attribute[cross.field],\n b[`${cross.field}1`]\n ));\n } else {\n !b.empty() &&\n (child.attribute[cross.field] = this.updateChildPos(\n anchorPos + getPadding(child, cross.field),\n child.attribute[cross.field],\n b[`${cross.field}1`]\n ));\n }\n }\n // if (alignItem === 'flex-end') {\n // for (let i = lastIdx; i <= currSeg.idx; i++) {\n // children[i].attribute[cross.field] = this.updateChildPos(\n // anchorPos - lenArray[i].crossLen + getPadding(children[i], cross.field),\n // children[i].attribute[cross.field],\n // children[i].AABBBounds[`${cross.field}1`]\n // );\n // }\n // } else if (alignItem === 'center') {\n // for (let i = lastIdx; i <= currSeg.idx; i++) {\n // children[i].attribute[cross.field] = this.updateChildPos(\n // anchorPos - lenArray[i].crossLen / 2 + getPadding(children[i], cross.field),\n // children[i].attribute[cross.field],\n // children[i].AABBBounds[`${cross.field}1`]\n // );\n // }\n // } else {\n // for (let i = lastIdx; i <= currSeg.idx; i++) {\n // children[i].attribute[cross.field] = this.updateChildPos(\n // anchorPos + getPadding(children[i], cross.field),\n // children[i].attribute[cross.field],\n // children[i].AABBBounds[`${cross.field}1`]\n // );\n // }\n // }\n }\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n // 属性更新\n application.graphicService.hooks.onAttributeUpdate.tap(this.key, graphic => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (!(graphic.stage && graphic.stage === this.pluginService.stage)) {\n return;\n }\n this.tryLayout(graphic, false);\n });\n // 包围盒更新(如果包围盒发生变化,就重新布局\n application.graphicService.hooks.beforeUpdateAABBBounds.tap(\n this.key,\n (graphic: IGraphic, stage: IStage, willUpdate: boolean, bounds: IAABBBounds) => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (!(stage && stage === this.pluginService.stage)) {\n return;\n }\n if (!graphic.isContainer || this.skipBoundsTrigger) {\n return;\n }\n _tempBounds.copy(bounds);\n }\n );\n application.graphicService.hooks.afterUpdateAABBBounds.tap(\n this.key,\n (\n graphic: IGraphic,\n stage: IStage,\n bounds: IAABBBounds,\n params: { globalAABBBounds: IAABBBounds },\n selfChange: boolean\n ) => {\n if (!(stage && stage === this.pluginService.stage)) {\n return;\n }\n if (!graphic.isContainer || this.skipBoundsTrigger) {\n return;\n }\n if (!_tempBounds.equals(bounds)) {\n this.tryLayout(graphic, false);\n }\n }\n );\n // 添加到场景树\n application.graphicService.hooks.onSetStage.tap(this.key, graphic => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n this.tryLayout(graphic, false);\n });\n }\n deactivate(context: IPluginService): void {\n application.graphicService.hooks.onAttributeUpdate.taps =\n application.graphicService.hooks.onAttributeUpdate.taps.filter(item => {\n return item.name !== this.key;\n });\n application.graphicService.hooks.beforeUpdateAABBBounds.taps =\n application.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n application.graphicService.hooks.afterUpdateAABBBounds.taps =\n application.graphicService.hooks.afterUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n application.graphicService.hooks.onSetStage.taps = application.graphicService.hooks.onSetStage.taps.filter(item => {\n return item.name !== this.key;\n });\n }\n}\n\nfunction getPadding(graphic: IGraphic, field: string): number {\n // if (!graphic.attribute.boundsPadding) {\n // return 0;\n // } else if (isNumber(graphic.attribute.boundsPadding)) {\n // return graphic.attribute.boundsPadding as number;\n // } else if (isArray(graphic.attribute.boundsPadding) && graphic.attribute.boundsPadding.length === 1) {\n // return graphic.attribute.boundsPadding[0];\n // }\n // const paddingArray = parsePadding(graphic.attribute.boundsPadding);\n // if (field === 'x') {\n // return paddingArray[3];\n // } else if (field === 'y') {\n // return paddingArray[0];\n // }\n return 0;\n}\n"]}
1
+ {"version":3,"sources":["../src/plugins/builtin-plugin/flex-layout-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAInD,OAA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;AAED,SAAS,UAAU,CAAC,OAAiB,EAAE,KAAa;IAclD,OAAO,CAAC,CAAC;AACX,CAAC","file":"flex-layout-plugin.js","sourcesContent":["import type { IGraphic, IGroup, IGroupAttribute, IStage } from '../../interface';\nimport { getTheme } from '../../graphic';\nimport type { IPlugin, IPluginService } from '../../interface';\nimport { Generator } from '../../common/generator';\nimport { isNumber } from '../../canvas/util';\nimport { parsePadding } from '../../common/utils';\nimport type { IAABBBounds } from '@visactor/vutils';\nimport { AABBBounds, isArray } from '@visactor/vutils';\nimport { application } from '../../application';\n\nconst _tempBounds = new AABBBounds();\n\ntype IAnchorPosMap = {\n 'flex-start': number;\n 'flex-end': number;\n center: number;\n};\n\nexport class FlexLayoutPlugin implements IPlugin {\n name: 'FlexLayoutPlugin' = 'FlexLayoutPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n id: number = Generator.GenAutoIncrementId();\n key: string = this.name + this.id;\n tempBounds: AABBBounds = new AABBBounds();\n pause: boolean;\n skipBoundsTrigger: boolean;\n\n pauseLayout(p: boolean) {\n this.pause = p;\n }\n\n tryLayoutChildren(graphic: IGraphic) {\n if (graphic.firstChild) {\n this.tryLayout(graphic.firstChild as IGraphic);\n }\n }\n\n tryLayout(graphic: IGraphic, force: boolean = true) {\n if (this.pause) {\n return;\n }\n const p = graphic.parent;\n if (!(force || (p && graphic.needUpdateLayout()))) {\n return;\n }\n const theme = getTheme(p).group;\n const { display = theme.display } = p.attribute;\n if (display !== 'flex') {\n return;\n }\n const {\n // width,\n // height,\n flexDirection = theme.flexDirection,\n flexWrap = theme.flexWrap,\n alignItems = theme.alignItems,\n clip = theme.clip\n } = p.attribute;\n const { alignContent = alignItems ?? theme.alignContent } = p.attribute;\n // if (!(width && height)) {\n // return;\n // }\n\n let { width, height, justifyContent = theme.justifyContent } = p.attribute;\n const children = p.getChildren() as IGraphic[];\n if (width == null || height == null) {\n // 计算子节点flex排列后的宽高\n let childrenWidth = 0;\n let childrenHeight = 0;\n let boundsLegal = 0;\n children.forEach((child: IGraphic) => {\n const bounds = this.getAABBBounds(child);\n if (bounds.empty()) {\n return;\n }\n if (flexDirection === 'column' || flexDirection === 'column-reverse') {\n childrenHeight += bounds.height();\n childrenWidth = Math.max(childrenWidth, bounds.width());\n } else {\n childrenWidth += bounds.width();\n childrenHeight = Math.max(childrenHeight, bounds.height());\n }\n boundsLegal += bounds.x1;\n boundsLegal += bounds.y1;\n boundsLegal += bounds.x2;\n boundsLegal += bounds.y2;\n });\n // judgement children bounds legal\n if (!isFinite(boundsLegal)) {\n return;\n }\n width = childrenWidth;\n height = childrenHeight;\n }\n\n if (p.attribute.width == null) {\n p.attribute.width = width;\n } else {\n width = p.attribute.width;\n }\n if (p.attribute.height == null) {\n p.attribute.height = height;\n } else {\n height = p.attribute.height;\n }\n\n // 这里使用p._AABBBounds可能会将非布局造成的bounds更新也会触发重新布局\n // TODO: 增加layout前预处理,在非递归布局前将子节点及其全部父节点_AABBBounds更新\n this.tempBounds.copy(p._AABBBounds);\n const result = {\n main: { len: width, field: 'x' },\n cross: { len: height, field: 'y' }\n };\n const main = result.main;\n const cross = result.cross;\n if (flexDirection === 'column' || flexDirection === 'column-reverse') {\n main.len = height;\n cross.len = width;\n main.field = 'y';\n cross.field = 'x';\n }\n if (flexDirection === 'row-reverse' || flexDirection === 'column-reverse') {\n if (justifyContent === 'flex-start') {\n justifyContent = 'flex-end';\n } else if (justifyContent === 'flex-end') {\n justifyContent = 'flex-start';\n } else {\n children.reverse();\n }\n }\n\n // 计算宽度\n let mainLen = 0;\n let crossLen = 0;\n const mianLenArray: { mainLen: number; crossLen: number }[] = [];\n children.forEach((c: IGraphic) => {\n const b = this.getAABBBounds(c);\n if (b.empty()) {\n return;\n }\n const ml = main.field === 'x' ? b.width() : b.height();\n const cl = cross.field === 'x' ? b.width() : b.height();\n mianLenArray.push({ mainLen: ml, crossLen: cl });\n mainLen += ml;\n crossLen = Math.max(crossLen, cl);\n });\n // 解析main\n const mainList: { idx: number; mainLen: number; crossLen: number }[] = [];\n if (mainLen > main.len && flexWrap === 'wrap') {\n let tempMainL = 0;\n let tempCrossL = 0;\n mianLenArray.forEach(({ mainLen, crossLen }, i) => {\n if (tempMainL + mainLen > main.len) {\n if (tempMainL === 0) {\n mainList.push({ idx: i, mainLen: tempMainL + mainLen, crossLen });\n tempMainL = 0;\n tempCrossL = 0;\n } else {\n mainList.push({ idx: i - 1, mainLen: tempMainL, crossLen: tempCrossL });\n tempMainL = mainLen;\n tempCrossL = crossLen;\n }\n } else {\n tempMainL += mainLen;\n tempCrossL = Math.max(tempCrossL, crossLen);\n }\n });\n mainList.push({ idx: mianLenArray.length - 1, mainLen: tempMainL, crossLen: tempCrossL });\n } else {\n mainList.push({ idx: mianLenArray.length - 1, mainLen: mainLen, crossLen });\n }\n\n // 布局main\n let lastIdx: number = 0;\n mainList.forEach(s => {\n this.layoutMain(p, children, justifyContent, main, mianLenArray, lastIdx, s);\n lastIdx = s.idx + 1;\n });\n\n crossLen = mainList.reduce((a, b) => a + b.crossLen, 0);\n\n // 布局cross\n\n if (mainList.length === 1) {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': 0,\n 'flex-end': cross.len,\n center: cross.len / 2\n };\n this.layoutCross(children, alignItems, cross, anchorPosMap, mianLenArray, mainList[0], 0);\n } else {\n if (alignContent === 'flex-start') {\n lastIdx = 0;\n let anchorPos = 0;\n mainList.forEach((s, i) => {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': anchorPos,\n 'flex-end': anchorPos + s.crossLen,\n center: anchorPos + s.crossLen / 2\n };\n this.layoutCross(children, 'flex-start', cross, anchorPosMap, mianLenArray, mainList[i], lastIdx);\n lastIdx = s.idx + 1;\n anchorPos += s.crossLen;\n });\n } else if (alignContent === 'center') {\n lastIdx = 0;\n const padding = Math.max(0, (cross.len - crossLen) / 2);\n let anchorPos = padding;\n mainList.forEach((s, i) => {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': anchorPos,\n 'flex-end': anchorPos + s.crossLen,\n center: anchorPos + s.crossLen / 2\n };\n this.layoutCross(children, 'center', cross, anchorPosMap, mianLenArray, mainList[i], lastIdx);\n lastIdx = s.idx + 1;\n anchorPos += s.crossLen;\n });\n } else if (alignContent === 'space-around') {\n lastIdx = 0;\n const padding = Math.max(0, (cross.len - crossLen) / mainList.length / 2);\n let anchorPos = padding;\n mainList.forEach((s, i) => {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': anchorPos,\n 'flex-end': anchorPos + s.crossLen,\n center: anchorPos + s.crossLen / 2\n };\n this.layoutCross(children, 'flex-start', cross, anchorPosMap, mianLenArray, mainList[i], lastIdx);\n lastIdx = s.idx + 1;\n anchorPos += s.crossLen + padding * 2;\n });\n } else if (alignContent === 'space-between') {\n lastIdx = 0;\n const padding = Math.max(0, (cross.len - crossLen) / (mainList.length * 2 - 2));\n let anchorPos = 0;\n mainList.forEach((s, i) => {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': anchorPos,\n 'flex-end': anchorPos + s.crossLen,\n center: anchorPos + s.crossLen / 2\n };\n this.layoutCross(children, 'flex-start', cross, anchorPosMap, mianLenArray, mainList[i], lastIdx);\n lastIdx = s.idx + 1;\n anchorPos += s.crossLen + padding * 2;\n });\n }\n }\n\n // update children\n children.forEach((child, idx) => {\n child.addUpdateBoundTag();\n child.addUpdatePositionTag();\n child.clearUpdateLayoutTag();\n });\n\n p.addUpdateLayoutTag();\n // 更新父级元素的layout,直到存在clip\n const b = this.getAABBBounds(p);\n if (!clip && !this.tempBounds.equals(b)) {\n // 判断父元素包围盒是否发生变化\n this.tryLayout(p, false);\n }\n }\n\n // 避免获取bounds的时候递归进行布局\n getAABBBounds(graphic: IGraphic) {\n this.skipBoundsTrigger = true;\n const b = graphic.AABBBounds;\n this.skipBoundsTrigger = false;\n return b;\n }\n\n // 锚点并不一定总在左上角,根据位置和bounds的偏移进行定位\n private updateChildPos(posBaseLeftTop: number, lastP: number | undefined, lastBP: number): number {\n return posBaseLeftTop + (lastP ?? 0) - lastBP;\n }\n\n layoutMain(\n p: IGroup,\n children: IGraphic[],\n justifyContent: IGroupAttribute['justifyContent'],\n main: { len: number; field: string },\n mianLenArray: { mainLen: number; crossLen: number }[],\n lastIdx: number,\n currSeg: { idx: number; mainLen: number; crossLen: number }\n ) {\n if (justifyContent === 'flex-start') {\n let pos = 0;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen;\n }\n } else if (justifyContent === 'flex-end') {\n let pos = main.len;\n for (let i = currSeg.idx; i >= lastIdx; i--) {\n pos -= mianLenArray[i].mainLen;\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n }\n } else if (justifyContent === 'space-around') {\n if (currSeg.mainLen >= main.len) {\n let pos = 0;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen;\n }\n } else {\n const size = currSeg.idx - lastIdx + 1;\n const padding = (main.len - currSeg.mainLen) / size / 2;\n let pos = padding;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen + padding * 2;\n }\n }\n } else if (justifyContent === 'space-between') {\n if (currSeg.mainLen >= main.len) {\n let pos = 0;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen;\n }\n } else {\n const size = currSeg.idx - lastIdx + 1;\n const padding = (main.len - currSeg.mainLen) / (size * 2 - 2);\n let pos = 0;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen + padding * 2;\n }\n }\n } else if (justifyContent === 'center') {\n let pos = (main.len - currSeg.mainLen) / 2;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen;\n }\n }\n }\n\n layoutCross(\n children: IGraphic[],\n alignItem: IGroupAttribute['alignItems'],\n cross: { len: number; field: string },\n anchorPosMap: IAnchorPosMap,\n lenArray: { mainLen: number; crossLen: number }[],\n currSeg: { idx: number; mainLen: number; crossLen: number },\n lastIdx: number\n ) {\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const child = children[i];\n let { alignSelf } = child.attribute;\n if (!alignSelf || alignSelf === 'auto') {\n alignSelf = alignItem;\n }\n const b = this.getAABBBounds(child);\n const anchorPos = anchorPosMap[alignSelf] ?? anchorPosMap['flex-start'];\n if (alignSelf === 'flex-end') {\n !b.empty() &&\n (child.attribute[cross.field] = this.updateChildPos(\n anchorPos - lenArray[i].crossLen + getPadding(child, cross.field),\n child.attribute[cross.field],\n b[`${cross.field}1`]\n ));\n } else if (alignSelf === 'center') {\n !b.empty() &&\n (child.attribute[cross.field] = this.updateChildPos(\n anchorPos - lenArray[i].crossLen / 2 + getPadding(child, cross.field),\n child.attribute[cross.field],\n b[`${cross.field}1`]\n ));\n } else {\n !b.empty() &&\n (child.attribute[cross.field] = this.updateChildPos(\n anchorPos + getPadding(child, cross.field),\n child.attribute[cross.field],\n b[`${cross.field}1`]\n ));\n }\n }\n // if (alignItem === 'flex-end') {\n // for (let i = lastIdx; i <= currSeg.idx; i++) {\n // children[i].attribute[cross.field] = this.updateChildPos(\n // anchorPos - lenArray[i].crossLen + getPadding(children[i], cross.field),\n // children[i].attribute[cross.field],\n // children[i].AABBBounds[`${cross.field}1`]\n // );\n // }\n // } else if (alignItem === 'center') {\n // for (let i = lastIdx; i <= currSeg.idx; i++) {\n // children[i].attribute[cross.field] = this.updateChildPos(\n // anchorPos - lenArray[i].crossLen / 2 + getPadding(children[i], cross.field),\n // children[i].attribute[cross.field],\n // children[i].AABBBounds[`${cross.field}1`]\n // );\n // }\n // } else {\n // for (let i = lastIdx; i <= currSeg.idx; i++) {\n // children[i].attribute[cross.field] = this.updateChildPos(\n // anchorPos + getPadding(children[i], cross.field),\n // children[i].attribute[cross.field],\n // children[i].AABBBounds[`${cross.field}1`]\n // );\n // }\n // }\n }\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n // 属性更新\n application.graphicService.hooks.onAttributeUpdate.tap(this.key, graphic => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (!(graphic.stage && graphic.stage === this.pluginService.stage)) {\n return;\n }\n this.tryLayout(graphic, false);\n });\n // 包围盒更新(如果包围盒发生变化,就重新布局\n application.graphicService.hooks.beforeUpdateAABBBounds.tap(\n this.key,\n (graphic: IGraphic, stage: IStage, willUpdate: boolean, bounds: IAABBBounds) => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (!(stage && stage === this.pluginService.stage)) {\n return;\n }\n if (!graphic.isContainer || this.skipBoundsTrigger) {\n return;\n }\n _tempBounds.copy(bounds);\n }\n );\n application.graphicService.hooks.afterUpdateAABBBounds.tap(\n this.key,\n (\n graphic: IGraphic,\n stage: IStage,\n bounds: IAABBBounds,\n params: { globalAABBBounds: IAABBBounds },\n selfChange: boolean\n ) => {\n if (!(stage && stage === this.pluginService.stage)) {\n return;\n }\n if (!graphic.isContainer || this.skipBoundsTrigger) {\n return;\n }\n if (!_tempBounds.equals(bounds)) {\n this.tryLayout(graphic, false);\n }\n }\n );\n // 添加到场景树\n application.graphicService.hooks.onSetStage.tap(this.key, graphic => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n this.tryLayout(graphic, false);\n });\n }\n deactivate(context: IPluginService): void {\n application.graphicService.hooks.onAttributeUpdate.taps =\n application.graphicService.hooks.onAttributeUpdate.taps.filter(item => {\n return item.name !== this.key;\n });\n application.graphicService.hooks.beforeUpdateAABBBounds.taps =\n application.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n application.graphicService.hooks.afterUpdateAABBBounds.taps =\n application.graphicService.hooks.afterUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n application.graphicService.hooks.onSetStage.taps = application.graphicService.hooks.onSetStage.taps.filter(item => {\n return item.name !== this.key;\n });\n }\n}\n\nfunction getPadding(graphic: IGraphic, field: string): number {\n // if (!graphic.attribute.boundsPadding) {\n // return 0;\n // } else if (isNumber(graphic.attribute.boundsPadding)) {\n // return graphic.attribute.boundsPadding as number;\n // } else if (isArray(graphic.attribute.boundsPadding) && graphic.attribute.boundsPadding.length === 1) {\n // return graphic.attribute.boundsPadding[0];\n // }\n // const paddingArray = parsePadding(graphic.attribute.boundsPadding);\n // if (field === 'x') {\n // return paddingArray[3];\n // } else if (field === 'y') {\n // return paddingArray[0];\n // }\n return 0;\n}\n"]}
@@ -1,17 +1,34 @@
1
- import type { IGraphic, IPlugin, IPluginService, IRenderService, IGroup } from '../../interface';
1
+ import type { IGraphic, IPlugin, IPluginService, IRenderService, IGroup, IStage, CreateDOMParamsType, CommonDomOptions, SimpleDomStyleOptions, IText } from '../../interface';
2
2
  export declare class HtmlAttributePlugin implements IPlugin {
3
3
  name: string;
4
4
  activeEvent: 'onRegister';
5
5
  pluginService: IPluginService;
6
6
  _uid: number;
7
7
  key: string;
8
- lastDomContainerSet: Set<any>;
9
- currentDomContainerSet: Set<any>;
8
+ htmlMap: Record<string, {
9
+ wrapContainer: HTMLElement;
10
+ nativeContainer: HTMLElement;
11
+ container: string | HTMLElement | null;
12
+ renderId: number;
13
+ }>;
14
+ renderId: number;
10
15
  activate(context: IPluginService): void;
11
16
  deactivate(context: IPluginService): void;
17
+ getWrapContainer(stage: IStage, userContainer?: string | HTMLElement | null, domParams?: CreateDOMParamsType): {
18
+ wrapContainer: HTMLElement;
19
+ nativeContainer: any;
20
+ };
21
+ parseDefaultStyleFromGraphic(graphic: IGraphic): any;
22
+ getTransformOfText(graphic: IText): {
23
+ textAlign: import("../../interface").TextAlignType;
24
+ transform: string;
25
+ transformOrigin: string;
26
+ };
27
+ updateStyleOfWrapContainer(graphic: IGraphic, stage: IStage, wrapContainer: HTMLElement, nativeContainer: HTMLElement, options: SimpleDomStyleOptions & CommonDomOptions): void;
28
+ protected clearCacheContainer(): void;
12
29
  protected drawHTML(renderService: IRenderService): void;
13
30
  renderGroupHTML(group: IGroup): void;
14
- removeDom(graphic: IGraphic): void;
31
+ removeElement(id: string): void;
15
32
  renderGraphicHTML(graphic: IGraphic): void;
16
33
  release(): void;
17
34
  removeAllDom(g: IGraphic): void;
@@ -2,20 +2,20 @@ import { Generator } from "../../common/generator";
2
2
 
3
3
  import { application } from "../../application";
4
4
 
5
- import { DefaultAttribute } from "../../graphic";
5
+ import { DefaultAttribute, getTheme } from "../../graphic";
6
+
7
+ import { textAttributesToStyle } from "../../common/text";
8
+
9
+ import { isFunction, isNil, isObject, isString, styleStringToObject, calculateAnchorOfBounds } from "@visactor/vutils";
6
10
 
7
11
  export class HtmlAttributePlugin {
8
12
  constructor() {
9
13
  this.name = "HtmlAttributePlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(),
10
- this.key = this.name + this._uid, this.lastDomContainerSet = new Set, this.currentDomContainerSet = new Set;
14
+ this.key = this.name + this._uid, this.htmlMap = {}, this.renderId = 0;
11
15
  }
12
16
  activate(context) {
13
17
  this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, (stage => {
14
18
  stage && stage === this.pluginService.stage && this.drawHTML(context.stage.renderService);
15
- })), application.graphicService.hooks.onRemove.tap(this.key, (graphic => {
16
- this.removeDom(graphic);
17
- })), application.graphicService.hooks.onRelease.tap(this.key, (graphic => {
18
- this.removeDom(graphic);
19
19
  }));
20
20
  }
21
21
  deactivate(context) {
@@ -23,76 +23,139 @@ export class HtmlAttributePlugin {
23
23
  application.graphicService.hooks.onRemove.unTap(this.key), application.graphicService.hooks.onRelease.unTap(this.key),
24
24
  this.release();
25
25
  }
26
+ getWrapContainer(stage, userContainer, domParams) {
27
+ let nativeContainer;
28
+ return nativeContainer = userContainer ? "string" == typeof userContainer ? application.global.getElementById(userContainer) : userContainer : stage.window.getContainer(),
29
+ {
30
+ wrapContainer: application.global.createDom(Object.assign({
31
+ tagName: "div",
32
+ parent: nativeContainer
33
+ }, domParams)),
34
+ nativeContainer: nativeContainer
35
+ };
36
+ }
37
+ parseDefaultStyleFromGraphic(graphic) {
38
+ const attrs = "text" === graphic.type && graphic.attribute ? graphic.attribute : getTheme(graphic).text;
39
+ return textAttributesToStyle(attrs);
40
+ }
41
+ getTransformOfText(graphic) {
42
+ const textTheme = getTheme(graphic).text, {textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline} = graphic.attribute, cssAttrs = graphic.globalTransMatrix.toTransformAttrs(), {rotateDeg: rotateDeg, scaleX: scaleX, scaleY: scaleY} = cssAttrs, translateMap = {
43
+ left: "0",
44
+ start: "0",
45
+ end: "-100%",
46
+ center: "-50%",
47
+ right: "-100%",
48
+ top: "0",
49
+ middle: "-50%",
50
+ bottom: "-100%",
51
+ alphabetic: "-79%"
52
+ }, originMap = {
53
+ left: "0",
54
+ start: "0",
55
+ end: "100%",
56
+ center: "50%",
57
+ right: "100%",
58
+ top: "0",
59
+ middle: "50%",
60
+ bottom: "100%",
61
+ alphabetic: "79%"
62
+ };
63
+ return {
64
+ textAlign: textAlign,
65
+ transform: `translate(${translateMap[textAlign]},${translateMap[textBaseline]}) rotate(${rotateDeg}deg) scaleX(${scaleX}) scaleY(${scaleY})`,
66
+ transformOrigin: `${originMap[textAlign]} ${originMap[textBaseline]}`
67
+ };
68
+ }
69
+ updateStyleOfWrapContainer(graphic, stage, wrapContainer, nativeContainer, options) {
70
+ const {pointerEvents: pointerEvents} = options;
71
+ let calculateStyle = this.parseDefaultStyleFromGraphic(graphic);
72
+ calculateStyle.display = !1 !== graphic.attribute.visible ? "block" : "none", calculateStyle.pointerEvents = !0 === pointerEvents ? "all" : pointerEvents || "none",
73
+ wrapContainer.style.position || (wrapContainer.style.position = "absolute", nativeContainer.style.position = "relative");
74
+ let left = 0, top = 0;
75
+ const b = graphic.globalAABBBounds;
76
+ let anchorType = options.anchorType;
77
+ if (isNil(anchorType) && (anchorType = "text" === graphic.type ? "position" : "boundsLeftTop"),
78
+ "boundsLeftTop" === anchorType && (anchorType = "top-left"), "position" === anchorType || b.empty()) {
79
+ const matrix = graphic.globalTransMatrix;
80
+ left = matrix.e, top = matrix.f;
81
+ } else {
82
+ const anchor = calculateAnchorOfBounds(b, anchorType);
83
+ left = anchor.x, top = anchor.y;
84
+ }
85
+ const containerTL = application.global.getElementTopLeft(nativeContainer, !1), windowTL = stage.window.getTopLeft(!1), offsetX = left + windowTL.left - containerTL.left, offsetTop = top + windowTL.top - containerTL.top;
86
+ if (calculateStyle.left = `${offsetX}px`, calculateStyle.top = `${offsetTop}px`,
87
+ "text" === graphic.type && "position" === anchorType && (calculateStyle = Object.assign(Object.assign({}, calculateStyle), this.getTransformOfText(graphic))),
88
+ isFunction(options.style)) {
89
+ const userStyle = options.style({
90
+ top: offsetTop,
91
+ left: offsetX,
92
+ width: b.width(),
93
+ height: b.height()
94
+ }, graphic, wrapContainer);
95
+ userStyle && (calculateStyle = Object.assign(Object.assign({}, calculateStyle), userStyle));
96
+ } else isObject(options.style) ? calculateStyle = Object.assign(Object.assign({}, calculateStyle), options.style) : isString(options.style) && options.style && (calculateStyle = Object.assign(Object.assign({}, calculateStyle), styleStringToObject(options.style)));
97
+ application.global.updateDom(wrapContainer, {
98
+ width: options.width,
99
+ height: options.width,
100
+ style: calculateStyle
101
+ });
102
+ }
103
+ clearCacheContainer() {
104
+ this.htmlMap && Object.keys(this.htmlMap).forEach((key => {
105
+ this.htmlMap[key] && this.htmlMap[key].renderId !== this.renderId && this.removeElement(key);
106
+ })), this.renderId += 1;
107
+ }
26
108
  drawHTML(renderService) {
27
109
  "browser" === application.global.env && (renderService.renderTreeRoots.sort(((a, b) => {
28
110
  var _a, _b;
29
111
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
30
112
  })).forEach((group => {
31
113
  this.renderGroupHTML(group);
32
- })), this.lastDomContainerSet.forEach((item => {
33
- this.currentDomContainerSet.has(item) || item.parentElement && item.parentElement.removeChild(item);
34
- })), this.lastDomContainerSet = new Set(this.currentDomContainerSet), this.currentDomContainerSet.clear());
114
+ })), this.clearCacheContainer());
35
115
  }
36
116
  renderGroupHTML(group) {
37
117
  this.renderGraphicHTML(group), group.forEachChildren((g => {
38
118
  g.isContainer ? this.renderGroupHTML(g) : this.renderGraphicHTML(g);
39
119
  }));
40
120
  }
41
- removeDom(graphic) {
42
- graphic.bindDom && graphic.bindDom.size && (graphic.bindDom.forEach((item => {
43
- item.dom && item.dom.parentElement.removeChild(item.dom);
44
- })), graphic.bindDom.clear());
121
+ removeElement(id) {
122
+ if (!this.htmlMap || !this.htmlMap[id]) return;
123
+ const {wrapContainer: wrapContainer} = this.htmlMap[id];
124
+ wrapContainer && application.global.removeDom(wrapContainer), this.htmlMap[id] = null;
45
125
  }
46
126
  renderGraphicHTML(graphic) {
127
+ var _a;
47
128
  const {html: html} = graphic.attribute;
48
- if (!html) return void (graphic.bindDom && graphic.bindDom.size && (graphic.bindDom.forEach((item => {
49
- item.dom && item.dom.parentElement.removeChild(item.dom);
50
- })), graphic.bindDom.clear()));
129
+ if (!html) return;
51
130
  const stage = graphic.stage;
52
131
  if (!stage) return;
53
- const {dom: dom, container: container, width: width, height: height, style: style, anchorType: anchorType = "boundsLeftTop", pointerEvents: pointerEvents} = html;
54
- graphic.bindDom || (graphic.bindDom = new Map);
55
- const lastDom = graphic.bindDom.get(dom);
56
- let wrapGroup, nativeContainer;
57
- if (!lastDom || container && container !== lastDom.container) {
58
- let nativeDom;
59
- graphic.bindDom.forEach((({wrapGroup: wrapGroup}) => {
60
- application.global.removeDom(wrapGroup);
61
- })), "string" == typeof dom ? (nativeDom = (new DOMParser).parseFromString(dom, "text/html").firstChild,
62
- nativeDom.lastChild && (nativeDom = nativeDom.lastChild.firstChild)) : nativeDom = dom;
63
- const _container = container || (!0 === stage.params.enableHtmlAttribute ? null : stage.params.enableHtmlAttribute);
64
- nativeContainer = _container ? "string" == typeof _container ? application.global.getElementById(_container) : _container : graphic.stage.window.getContainer(),
65
- wrapGroup = application.global.createDom({
66
- tagName: "div",
67
- width: width,
68
- height: height,
69
- style: style,
70
- parent: nativeContainer
71
- }), wrapGroup && (wrapGroup.appendChild(nativeDom), graphic.bindDom.set(dom, {
72
- dom: nativeDom,
132
+ const {dom: dom, container: container} = html;
133
+ if (!dom) return;
134
+ const id = isNil(html.id) ? `${null !== (_a = graphic.id) && void 0 !== _a ? _a : graphic._uid}_react` : html.id;
135
+ if (this.htmlMap && this.htmlMap[id] && container && container !== this.htmlMap[id].container && this.removeElement(id),
136
+ this.htmlMap && this.htmlMap[id]) "string" == typeof dom ? this.htmlMap[id].wrapContainer.innerHTML = dom : dom !== this.htmlMap[id].wrapContainer.firstChild && (this.htmlMap[id].wrapContainer.removeChild(this.htmlMap[id].wrapContainer.firstChild),
137
+ this.htmlMap[id].wrapContainer.appendChild(dom)); else {
138
+ const {wrapContainer: wrapContainer, nativeContainer: nativeContainer} = this.getWrapContainer(stage, container);
139
+ wrapContainer && ("string" == typeof dom ? wrapContainer.innerHTML = dom : wrapContainer.appendChild(dom),
140
+ this.htmlMap || (this.htmlMap = {}), this.htmlMap[id] = {
141
+ wrapContainer: wrapContainer,
142
+ nativeContainer: nativeContainer,
73
143
  container: container,
74
- wrapGroup: wrapGroup
75
- }));
76
- } else wrapGroup = lastDom.wrapGroup, nativeContainer = wrapGroup.parentNode;
77
- wrapGroup.style.pointerEvents = pointerEvents || "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute",
78
- nativeContainer.style.position = "relative");
79
- let left = 0, top = 0;
80
- const b = graphic.globalAABBBounds;
81
- if ("position" === anchorType || b.empty()) {
82
- const matrix = graphic.globalTransMatrix;
83
- left = matrix.e, top = matrix.f;
84
- } else left = b.x1, top = b.y1;
85
- const containerTL = application.global.getElementTopLeft(nativeContainer, !1), windowTL = stage.window.getTopLeft(!1), offsetX = left + windowTL.left - containerTL.left, offsetTop = top + windowTL.top - containerTL.top;
86
- wrapGroup.style.left = `${offsetX}px`, wrapGroup.style.top = `${offsetTop}px`, this.currentDomContainerSet.add(wrapGroup);
144
+ renderId: this.renderId
145
+ });
146
+ }
147
+ if (!this.htmlMap || !this.htmlMap[id]) return;
148
+ const {wrapContainer: wrapContainer, nativeContainer: nativeContainer} = this.htmlMap[id];
149
+ this.updateStyleOfWrapContainer(graphic, stage, wrapContainer, nativeContainer, html),
150
+ this.htmlMap[id].renderId = this.renderId;
87
151
  }
88
152
  release() {
89
- "browser" === application.global.env && (this.removeAllDom(this.pluginService.stage.defaultLayer),
90
- this.lastDomContainerSet.clear(), this.currentDomContainerSet.clear());
153
+ "browser" === application.global.env && this.removeAllDom(this.pluginService.stage.defaultLayer);
91
154
  }
92
155
  removeAllDom(g) {
93
- this.removeDom(g), g.forEachChildren((item => {
94
- item.isContainer && this.removeAllDom(g);
95
- }));
156
+ this.htmlMap && (Object.keys(this.htmlMap).forEach((key => {
157
+ this.removeElement(key);
158
+ })), this.htmlMap = null);
96
159
  }
97
160
  }
98
161
  //# sourceMappingURL=html-attribute-plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugins/builtin-plugin/html-attribute-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,OAAO,mBAAmB;IAAhC;QACE,SAAI,GAAW,qBAAqB,CAAC;QACrC,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SAAI,GAAW,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAC9C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACpC,wBAAmB,GAAa,IAAI,GAAG,EAAE,CAAC;QAC1C,2BAAsB,GAAa,IAAI,GAAG,EAAE,CAAC;IAkL/C,CAAC;IAhLC,QAAQ,CAAC,OAAuB;QAC9B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;QAC7B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE;YACpD,IAAI,CAAC,CAAC,KAAK,IAAI,KAAK,KAAK,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;gBAClD,O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AC;IAC7C,CAAC;IAED,OAAO;QACL,IAAI,WAAW,CAAC,MAAM,CAAC,GAAG,KAAK,SAAS,EAAE;YACxC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YACzD,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;YACjC,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,CAAC;SACrC;IACH,CAAC;IACD,YAAY,CAAC,CAAW;QACtB,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,eAAe,CAAC,CAAC,IAAc,EAAE,EAAE;YACnC,IAAI,IAAI,CAAC,WAAW,EAAE;gBACpB,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;aACtB;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF","file":"html-attribute-plugin.js","sourcesContent":["import { Generator } from '../../common/generator';\nimport type { IGraphic, IPlugin, IPluginService, IRenderService, IDrawContext, IGroup } from '../../interface';\nimport { application } from '../../application';\nimport { DefaultAttribute } from '../../graphic';\n\nexport class HtmlAttributePlugin implements IPlugin {\n name: string = 'HtmlAttributePlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n lastDomContainerSet: Set<any> = new Set();\n currentDomContainerSet: Set<any> = new Set();\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n context.stage.hooks.afterRender.tap(this.key, stage => {\n if (!(stage && stage === this.pluginService.stage)) {\n return;\n }\n\n this.drawHTML(context.stage.renderService);\n });\n application.graphicService.hooks.onRemove.tap(this.key, graphic => {\n this.removeDom(graphic);\n });\n application.graphicService.hooks.onRelease.tap(this.key, graphic => {\n this.removeDom(graphic);\n });\n }\n deactivate(context: IPluginService): void {\n context.stage.hooks.afterRender.taps = context.stage.hooks.afterRender.taps.filter(item => {\n return item.name !== this.key;\n });\n application.graphicService.hooks.onRemove.unTap(this.key);\n application.graphicService.hooks.onRelease.unTap(this.key);\n this.release();\n }\n\n protected drawHTML(renderService: IRenderService) {\n if (application.global.env === 'browser') {\n renderService.renderTreeRoots\n .sort((a, b) => {\n return (a.attribute.zIndex ?? DefaultAttribute.zIndex) - (b.attribute.zIndex ?? DefaultAttribute.zIndex);\n })\n .forEach(group => {\n this.renderGroupHTML(group as IGroup);\n });\n // 删掉这次不存在的节点\n this.lastDomContainerSet.forEach(item => {\n if (!this.currentDomContainerSet.has(item)) {\n item.parentElement && item.parentElement.removeChild(item);\n }\n });\n this.lastDomContainerSet = new Set(this.currentDomContainerSet);\n this.currentDomContainerSet.clear();\n }\n }\n\n renderGroupHTML(group: IGroup) {\n this.renderGraphicHTML(group);\n group.forEachChildren((g: IGraphic) => {\n if (g.isContainer) {\n this.renderGroupHTML(g as IGroup);\n } else {\n this.renderGraphicHTML(g);\n }\n });\n }\n\n removeDom(graphic: IGraphic) {\n if (graphic.bindDom && graphic.bindDom.size) {\n // 删除dom\n graphic.bindDom.forEach(item => {\n item.dom && item.dom.parentElement.removeChild(item.dom);\n });\n graphic.bindDom.clear();\n }\n }\n\n renderGraphicHTML(graphic: IGraphic) {\n const { html } = graphic.attribute;\n if (!html) {\n if (graphic.bindDom && graphic.bindDom.size) {\n // 删除dom\n graphic.bindDom.forEach(item => {\n item.dom && item.dom.parentElement.removeChild(item.dom);\n });\n graphic.bindDom.clear();\n }\n return;\n }\n const stage = graphic.stage;\n if (!stage) {\n return;\n }\n const { dom, container, width, height, style, anchorType = 'boundsLeftTop', pointerEvents } = html;\n if (!graphic.bindDom) {\n graphic.bindDom = new Map();\n }\n const lastDom = graphic.bindDom.get(dom);\n\n let wrapGroup;\n // 获取container的dom,默认为window的container\n let nativeContainer;\n // 如果存在了(dom存在,且container没有变化),就不做事情\n if (lastDom && !(container && container !== lastDom.container)) {\n wrapGroup = lastDom.wrapGroup;\n nativeContainer = wrapGroup.parentNode;\n } else {\n // 清除上一次的dom\n graphic.bindDom.forEach(({ wrapGroup }) => {\n application.global.removeDom(wrapGroup);\n });\n // 转化这个dom为nativeDOM\n let nativeDom: HTMLElement;\n if (typeof dom === 'string') {\n nativeDom = new DOMParser().parseFromString(dom, 'text/html').firstChild as any;\n if ((nativeDom as any).lastChild) {\n nativeDom = (nativeDom as any).lastChild.firstChild;\n }\n } else {\n nativeDom = dom;\n }\n\n const _container =\n container || (stage.params.enableHtmlAttribute === true ? null : stage.params.enableHtmlAttribute);\n if (_container) {\n if (typeof _container === 'string') {\n nativeContainer = application.global.getElementById(_container);\n } else {\n nativeContainer = _container;\n }\n } else {\n // nativeContainer = application.global.getRootElement();\n nativeContainer = graphic.stage.window.getContainer();\n }\n // 创建wrapGroup\n wrapGroup = application.global.createDom({ tagName: 'div', width, height, style, parent: nativeContainer });\n if (wrapGroup) {\n wrapGroup.appendChild(nativeDom);\n graphic.bindDom.set(dom, { dom: nativeDom, container, wrapGroup: wrapGroup as any });\n }\n }\n\n // 事件穿透\n wrapGroup.style.pointerEvents = pointerEvents || 'none';\n // 定位wrapGroup\n if (!wrapGroup.style.position) {\n wrapGroup.style.position = 'absolute';\n nativeContainer.style.position = 'relative';\n }\n let left: number = 0;\n let top: number = 0;\n const b = graphic.globalAABBBounds;\n if (anchorType === 'position' || b.empty()) {\n const matrix = graphic.globalTransMatrix;\n left = matrix.e;\n top = matrix.f;\n } else {\n left = b.x1;\n top = b.y1;\n }\n // 查看wrapGroup的位置\n // const wrapGroupTL = application.global.getElementTopLeft(wrapGroup, false);\n const containerTL = application.global.getElementTopLeft(nativeContainer, false);\n const windowTL = stage.window.getTopLeft(false);\n const offsetX = left + windowTL.left - containerTL.left;\n const offsetTop = top + windowTL.top - containerTL.top;\n // wrapGroup.style.transform = `translate(${offsetX}px, ${offsetTop}px)`;\n wrapGroup.style.left = `${offsetX}px`;\n wrapGroup.style.top = `${offsetTop}px`;\n this.currentDomContainerSet.add(wrapGroup);\n }\n\n release() {\n if (application.global.env === 'browser') {\n this.removeAllDom(this.pluginService.stage.defaultLayer);\n this.lastDomContainerSet.clear();\n this.currentDomContainerSet.clear();\n }\n }\n removeAllDom(g: IGraphic) {\n this.removeDom(g);\n g.forEachChildren((item: IGraphic) => {\n if (item.isContainer) {\n this.removeAllDom(g);\n }\n });\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/plugins/builtin-plugin/html-attribute-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAanD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEvH,MAAM,OAAO,mBAAmB;IAAhC;QACE,SAAI,GAAW,qBAAqB,CAAC;QACrC,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SAAI,GAAW,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAC9C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEpC,YAAO,GAQH,EAAE,CAAC;QACP,aAAQ,GAAW,CAAC,CAAC;IAgSvB,CAAC;IA9RC,QAAQ,CAAC,OAAuB;QAC9B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;QAC7B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE;YACpD,IAAI,CAAC,CAAC,KAAK,IAAI,KAAK,KAAK,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;gBAClD,OAAO;aACR;YAED,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC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OAAO,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;oBACtF,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;iBACjD;aACF;SACF;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;YACtC,OAAO;SACR;QAED,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAE5D,IAAI,CAAC,0BAA0B,CAAC,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC;QACtF,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC5C,CAAC;IAED,OAAO;QACL,IAAI,WAAW,CAAC,MAAM,CAAC,GAAG,KAAK,SAAS,EAAE;YACxC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;SAC1D;IACH,CAAC;IACD,YAAY,CAAC,CAAW;QACtB,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBACtC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;YAC1B,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;SACrB;IACH,CAAC;CACF","file":"html-attribute-plugin.js","sourcesContent":["import { Generator } from '../../common/generator';\nimport type {\n IGraphic,\n IPlugin,\n IPluginService,\n IRenderService,\n IGroup,\n IStage,\n CreateDOMParamsType,\n CommonDomOptions,\n SimpleDomStyleOptions,\n IText\n} from '../../interface';\nimport { application } from '../../application';\nimport { DefaultAttribute, getTheme } from '../../graphic';\nimport { textAttributesToStyle } from '../../common/text';\nimport { isFunction, isNil, isObject, isString, styleStringToObject, calculateAnchorOfBounds } from '@visactor/vutils';\n\nexport class HtmlAttributePlugin implements IPlugin {\n name: string = 'HtmlAttributePlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n\n htmlMap: Record<\n string,\n {\n wrapContainer: HTMLElement;\n nativeContainer: HTMLElement;\n container: string | HTMLElement | null;\n renderId: number;\n }\n > = {};\n renderId: number = 0;\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n context.stage.hooks.afterRender.tap(this.key, stage => {\n if (!(stage && stage === this.pluginService.stage)) {\n return;\n }\n\n this.drawHTML(context.stage.renderService);\n });\n }\n deactivate(context: IPluginService): void {\n context.stage.hooks.afterRender.taps = context.stage.hooks.afterRender.taps.filter(item => {\n return item.name !== this.key;\n });\n application.graphicService.hooks.onRemove.unTap(this.key);\n application.graphicService.hooks.onRelease.unTap(this.key);\n this.release();\n }\n\n getWrapContainer(stage: IStage, userContainer?: string | HTMLElement | null, domParams?: CreateDOMParamsType) {\n let nativeContainer;\n if (userContainer) {\n if (typeof userContainer === 'string') {\n nativeContainer = application.global.getElementById(userContainer);\n } else {\n nativeContainer = userContainer;\n }\n } else {\n nativeContainer = stage.window.getContainer();\n }\n // 创建wrapGroup\n return {\n wrapContainer: application.global.createDom({ tagName: 'div', parent: nativeContainer, ...domParams }),\n nativeContainer\n };\n }\n\n parseDefaultStyleFromGraphic(graphic: IGraphic) {\n const attrs: any = graphic.type === 'text' && graphic.attribute ? graphic.attribute : getTheme(graphic).text;\n\n return textAttributesToStyle(attrs);\n }\n\n getTransformOfText(graphic: IText) {\n const textTheme = getTheme(graphic).text;\n const { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = graphic.attribute;\n const matrix = graphic.globalTransMatrix;\n const cssAttrs = matrix.toTransformAttrs();\n const { rotateDeg, scaleX, scaleY } = cssAttrs;\n const translateMap: any = {\n left: '0',\n start: '0',\n end: '-100%',\n center: '-50%',\n right: '-100%',\n top: '0',\n middle: '-50%',\n bottom: '-100%',\n alphabetic: '-79%'\n };\n const originMap: any = {\n left: '0',\n start: '0',\n end: '100%',\n center: '50%',\n right: '100%',\n top: '0',\n middle: '50%',\n bottom: '100%',\n alphabetic: '79%'\n };\n\n return {\n textAlign,\n // textBaseline,\n transform: `translate(${translateMap[textAlign]},${translateMap[textBaseline]}) rotate(${rotateDeg}deg) scaleX(${scaleX}) scaleY(${scaleY})`,\n transformOrigin: `${originMap[textAlign]} ${originMap[textBaseline]}`\n };\n }\n\n updateStyleOfWrapContainer(\n graphic: IGraphic,\n stage: IStage,\n wrapContainer: HTMLElement,\n nativeContainer: HTMLElement,\n options: SimpleDomStyleOptions & CommonDomOptions\n ) {\n const { pointerEvents } = options;\n let calculateStyle = this.parseDefaultStyleFromGraphic(graphic);\n\n calculateStyle.display = graphic.attribute.visible !== false ? 'block' : 'none';\n // 事件穿透\n calculateStyle.pointerEvents = pointerEvents === true ? 'all' : pointerEvents ? pointerEvents : 'none';\n // 定位wrapGroup\n if (!wrapContainer.style.position) {\n wrapContainer.style.position = 'absolute';\n nativeContainer.style.position = 'relative';\n }\n let left: number = 0;\n let top: number = 0;\n const b = graphic.globalAABBBounds;\n\n let anchorType = options.anchorType;\n\n if (isNil(anchorType)) {\n anchorType = graphic.type === 'text' ? 'position' : 'boundsLeftTop';\n }\n\n if (anchorType === 'boundsLeftTop') {\n // 兼容老的配置,统一配置\n anchorType = 'top-left';\n }\n if (anchorType === 'position' || b.empty()) {\n const matrix = graphic.globalTransMatrix;\n left = matrix.e;\n top = matrix.f;\n } else {\n const anchor = calculateAnchorOfBounds(b, anchorType);\n\n left = anchor.x;\n top = anchor.y;\n }\n\n // 查看wrapGroup的位置\n // const wrapGroupTL = application.global.getElementTopLeft(wrapGroup, false);\n const containerTL = application.global.getElementTopLeft(nativeContainer, false);\n const windowTL = stage.window.getTopLeft(false);\n const offsetX = left + windowTL.left - containerTL.left;\n const offsetTop = top + windowTL.top - containerTL.top;\n // wrapGroup.style.transform = `translate(${offsetX}px, ${offsetTop}px)`;\n calculateStyle.left = `${offsetX}px`;\n calculateStyle.top = `${offsetTop}px`;\n\n if (graphic.type === 'text' && anchorType === 'position') {\n calculateStyle = {\n ...calculateStyle,\n ...this.getTransformOfText(graphic as IText)\n };\n }\n\n if (isFunction(options.style)) {\n const userStyle = options.style(\n { top: offsetTop, left: offsetX, width: b.width(), height: b.height() },\n graphic,\n wrapContainer\n );\n\n if (userStyle) {\n calculateStyle = { ...calculateStyle, ...userStyle };\n }\n } else if (isObject(options.style)) {\n calculateStyle = { ...calculateStyle, ...options.style };\n } else if (isString(options.style) && options.style) {\n calculateStyle = { ...calculateStyle, ...styleStringToObject(options.style as string) };\n }\n\n // 更新样式\n application.global.updateDom(wrapContainer, {\n width: options.width,\n height: options.width,\n style: calculateStyle\n });\n }\n\n protected clearCacheContainer() {\n if (this.htmlMap) {\n Object.keys(this.htmlMap).forEach(key => {\n if (this.htmlMap[key] && this.htmlMap[key].renderId !== this.renderId) {\n this.removeElement(key);\n }\n });\n }\n\n this.renderId += 1;\n }\n\n protected drawHTML(renderService: IRenderService) {\n if (application.global.env === 'browser') {\n renderService.renderTreeRoots\n .sort((a, b) => {\n return (a.attribute.zIndex ?? DefaultAttribute.zIndex) - (b.attribute.zIndex ?? DefaultAttribute.zIndex);\n })\n .forEach(group => {\n this.renderGroupHTML(group as IGroup);\n });\n\n this.clearCacheContainer();\n }\n }\n\n renderGroupHTML(group: IGroup) {\n this.renderGraphicHTML(group);\n group.forEachChildren((g: IGraphic) => {\n if (g.isContainer) {\n this.renderGroupHTML(g as IGroup);\n } else {\n this.renderGraphicHTML(g);\n }\n });\n }\n\n removeElement(id: string) {\n if (!this.htmlMap || !this.htmlMap[id]) {\n return;\n }\n\n const { wrapContainer } = this.htmlMap[id];\n\n wrapContainer && application.global.removeDom(wrapContainer);\n\n this.htmlMap[id] = null;\n }\n\n renderGraphicHTML(graphic: IGraphic) {\n const { html } = graphic.attribute;\n if (!html) {\n return;\n }\n const stage = graphic.stage;\n if (!stage) {\n return;\n }\n const { dom, container } = html;\n\n if (!dom) {\n return;\n }\n const id = isNil(html.id) ? `${graphic.id ?? graphic._uid}_react` : html.id;\n\n if (this.htmlMap && this.htmlMap[id] && container && container !== this.htmlMap[id].container) {\n this.removeElement(id);\n }\n\n if (!this.htmlMap || !this.htmlMap[id]) {\n // createa a wrapper contianer to be the root of react element\n const { wrapContainer, nativeContainer } = this.getWrapContainer(stage, container);\n\n if (wrapContainer) {\n // init append\n if (typeof dom === 'string') {\n wrapContainer.innerHTML = dom;\n } else {\n wrapContainer.appendChild(dom);\n }\n\n if (!this.htmlMap) {\n this.htmlMap = {};\n }\n\n this.htmlMap[id] = { wrapContainer, nativeContainer, container, renderId: this.renderId };\n }\n } else {\n if (typeof dom === 'string') {\n this.htmlMap[id].wrapContainer.innerHTML = dom;\n } else {\n if (dom !== this.htmlMap[id].wrapContainer.firstChild) {\n this.htmlMap[id].wrapContainer.removeChild(this.htmlMap[id].wrapContainer.firstChild);\n this.htmlMap[id].wrapContainer.appendChild(dom);\n }\n }\n }\n\n if (!this.htmlMap || !this.htmlMap[id]) {\n return;\n }\n\n const { wrapContainer, nativeContainer } = this.htmlMap[id];\n\n this.updateStyleOfWrapContainer(graphic, stage, wrapContainer, nativeContainer, html);\n this.htmlMap[id].renderId = this.renderId;\n }\n\n release() {\n if (application.global.env === 'browser') {\n this.removeAllDom(this.pluginService.stage.defaultLayer);\n }\n }\n removeAllDom(g: IGraphic) {\n if (this.htmlMap) {\n Object.keys(this.htmlMap).forEach(key => {\n this.removeElement(key);\n });\n\n this.htmlMap = null;\n }\n }\n}\n"]}
@@ -6,6 +6,13 @@ export declare class ReactAttributePlugin extends HtmlAttributePlugin implements
6
6
  pluginService: IPluginService;
7
7
  _uid: number;
8
8
  key: string;
9
- removeDom(graphic: IGraphic): void;
9
+ htmlMap: Record<string, {
10
+ root: any;
11
+ wrapContainer: HTMLElement;
12
+ nativeContainer: HTMLElement;
13
+ container: string | HTMLElement | null;
14
+ renderId: number;
15
+ }>;
16
+ removeElement(id: string): void;
10
17
  renderGraphicHTML(graphic: IGraphic): void;
11
18
  }