@visactor/vrender-core 0.18.13 → 0.18.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/event/event-manager.js +17 -7
- package/cjs/event/event-manager.js.map +1 -1
- package/cjs/graphic/config.js +1 -0
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/richtext/frame.js +6 -6
- package/cjs/graphic/richtext/frame.js.map +1 -1
- package/cjs/graphic/richtext/line.d.ts +1 -1
- package/cjs/graphic/richtext/line.js +3 -2
- package/cjs/graphic/richtext/line.js.map +1 -1
- package/cjs/graphic/richtext/paragraph.d.ts +1 -0
- package/cjs/graphic/richtext/paragraph.js.map +1 -1
- package/cjs/graphic/richtext.js +11 -2
- package/cjs/graphic/richtext.js.map +1 -1
- package/cjs/interface/graphic/richText.d.ts +2 -1
- package/cjs/interface/graphic/richText.js.map +1 -1
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +1 -1
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/cjs/render/contributions/render/draw-contribution.js +2 -2
- package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
- package/es/event/event-manager.js +17 -7
- package/es/event/event-manager.js.map +1 -1
- package/es/graphic/config.js +1 -0
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/richtext/frame.js +6 -6
- package/es/graphic/richtext/frame.js.map +1 -1
- package/es/graphic/richtext/line.d.ts +1 -1
- package/es/graphic/richtext/line.js +3 -2
- package/es/graphic/richtext/line.js.map +1 -1
- package/es/graphic/richtext/paragraph.d.ts +1 -0
- package/es/graphic/richtext/paragraph.js.map +1 -1
- package/es/graphic/richtext.js +11 -2
- package/es/graphic/richtext.js.map +1 -1
- package/es/interface/graphic/richText.d.ts +2 -1
- package/es/interface/graphic/richText.js.map +1 -1
- package/es/plugins/builtin-plugin/flex-layout-plugin.js +1 -1
- package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/es/render/contributions/render/draw-contribution.js +2 -2
- package/es/render/contributions/render/draw-contribution.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
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,OAAO,EAAE,UAAU,EAAW,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,GAAG,IAAI,UAAU,EAAE,CAAC;AAQrC,MAAM,OAAO,gBAAgB;IAA7B;QACE,SAAI,GAAuB,kBAAkB,CAAC;QAC9C,gBAAW,GAAiB,YAAY,CAAC;QAEzC,OAAE,GAAW,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAC5C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;QAClC,eAAU,GAAe,IAAI,UAAU,EAAE,CAAC;IA0f5C,CAAC;IAtfC,WAAW,CAAC,CAAU;QACpB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACjB,CAAC;IAED,iBAAiB,CAAC,OAAiB;QACjC,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAsB,CAAC,CAAC;SAChD;IACH,CAAC;IAED,SAAS,CAAC,OAAiB,EAAE,QAAiB,IAAI;QAChD,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,OAAO;SACR;QACD,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;QACzB,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE;YACjD,OAAO;SACR;QACD,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC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,CAAC;QACL,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YAChH,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC;CACF;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 });\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,OAAO,EAAE,UAAU,EAAW,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,GAAG,IAAI,UAAU,EAAE,CAAC;AAQrC,MAAM,OAAO,gBAAgB;IAA7B;QACE,SAAI,GAAuB,kBAAkB,CAAC;QAC9C,gBAAW,GAAiB,YAAY,CAAC;QAEzC,OAAE,GAAW,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAC5C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;QAClC,eAAU,GAAe,IAAI,UAAU,EAAE,CAAC;IA0f5C,CAAC;IAtfC,WAAW,CAAC,CAAU;QACpB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACjB,CAAC;IAED,iBAAiB,CAAC,OAAiB;QACjC,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAsB,CAAC,CAAC;SAChD;IACH,CAAC;IAED,SAAS,CAAC,OAAiB,EAAE,QAAiB,IAAI;QAChD,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,OAAO;SACR;QACD,MAAM,CA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AC,cAAc,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI;YACzD,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;gBACxE,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YAChH,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC;CACF;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 = 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"]}
|
|
@@ -78,8 +78,8 @@ let DefaultDrawContribution = class {
|
|
|
78
78
|
return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
|
|
79
79
|
})).forEach((group => {
|
|
80
80
|
group.isContainer ? this.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : this.renderItem(group, drawContext);
|
|
81
|
-
})), context.restore(), context.
|
|
82
|
-
context.
|
|
81
|
+
})), context.restore(), context.setClearMatrix(1, 0, 0, 1, 0, 0), context.inuse = !1,
|
|
82
|
+
context.draw();
|
|
83
83
|
}
|
|
84
84
|
doRegister() {
|
|
85
85
|
throw new Error("暂不支持");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/draw-contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAgBxF,OAAO,EAAE,eAAe,E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AAC,KAAK,CAAC,CAAC;gBAChD,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE;oBAC9C,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;iBAClD;aACF;iBAAM;gBACL,OAAO,CAAC,SAAS,GAAG,WAAW,CAC7B,OAAO,EACP,KAAK,EACL;oBACE,UAAU,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,EAAE;iBAC5D,EACD,CAAC,EACD,CAAC,CACF,CAAC;gBACF,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;aACvC;SACF;IACH,CAAC;IAED,SAAS,CAAC,aAA6B,EAAE,UAAwB;QAC/D,OAAO;IACT,CAAC;CACF,CAAA;AAzZY,uBAAuB;IADnC,UAAU,EAAE;IAmBR,WAAA,WAAW,CAAC,aAAa,CAAC,CAAA;IAG1B,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,mBAAmB,CAAC,CAAA;;GAtBlB,uBAAuB,CAyZnC;SAzZY,uBAAuB","file":"draw-contribution.js","sourcesContent":["import { injectable, inject, named, multiInject } from '../../../common/inversify-lite';\nimport type {\n IContext2d,\n MaybePromise,\n IGraphic,\n IGroup,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider,\n IDrawItemInterceptorContribution,\n IDrawContribution,\n IRenderSelector,\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';\nimport type { IAABBBounds, IBounds, IBoundsLike, IMatrix, IMatrixLike } from '@visactor/vutils';\nimport { Bounds, Logger, getRectIntersect, isRectIntersect, last } from '@visactor/vutils';\nimport { LayerService } from '../../../core/constants';\nimport { container } from '../../../container';\nimport { GraphicRender, IncrementalDrawContribution, RenderSelector } 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 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 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.draw();\n context.setClearMatrix(1, 0, 0, 1, 0, 0);\n // this.break = false;\n context.inuse = false;\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 (this.useDirtyBounds && !isRectIntersect(group.AABBBounds, this.dirtyBounds, false)) {\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 = false;\n let tempBounds: IAABBBounds;\n\n if (graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n retrans = !!(scrollX || scrollY);\n if (retrans) {\n tempBounds = this.dirtyBounds.clone();\n // 变换dirtyBounds\n const m = graphic.globalTransMatrix.getInverse();\n this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(m);\n this.dirtyBounds.translate(-scrollX, -scrollY);\n }\n }\n\n if (this.useDirtyBounds && !(graphic.isContainer || isRectIntersect(graphic.AABBBounds, this.dirtyBounds, false))) {\n retrans && this.dirtyBounds.copy(tempBounds);\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\n // 添加拦截器\n if (this.InterceptorContributions.length) {\n for (let i = 0; i < this.InterceptorContributions.length; i++) {\n const drawContribution = this.InterceptorContributions[i];\n if (drawContribution.afterDrawItem) {\n if (drawContribution.afterDrawItem(graphic, this.currentRenderService, drawContext, this)) {\n return;\n }\n }\n }\n }\n }\n // 根据type选择对应的render\n protected selectRenderByType(type?: string): IGraphicRender | null {\n Logger.getInstance().warn('未知错误,不应该走到这里');\n return null;\n }\n // 根据type选择对应的render\n protected selectRenderByNumberType(type: number, graphic: IGraphic): IGraphicRender | null {\n let data;\n if (graphic.attribute.renderStyle) {\n const currentRenderMap = this.styleRenderMap.get(graphic.attribute.renderStyle);\n data = currentRenderMap && currentRenderMap.get(type);\n }\n return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);\n }\n\n protected clearScreen(renderService: IRenderService, context: IContext2d, drawContext: IDrawContext) {\n const { clear, viewBox } = drawContext;\n // 已经translate过了\n const x = 0;\n const y = 0;\n const width = viewBox.width();\n const height = viewBox.height();\n if (clear) {\n context.clearRect(x, y, width, height);\n const stage = renderService.drawParams?.stage;\n stage && (context.globalAlpha = (stage as any).attribute.opacity ?? 1);\n if (stage && (stage as any).backgroundImg && (stage as any).resources) {\n const res = (stage as any).resources.get(clear);\n if (res && res.state === 'success' && res.data) {\n context.drawImage(res.data, x, y, width, height);\n }\n } else {\n context.fillStyle = createColor(\n context,\n clear,\n {\n AABBBounds: { x1: x, y1: y, x2: x + width, y2: y + height }\n },\n 0,\n 0\n );\n context.fillRect(x, y, width, height);\n }\n }\n }\n\n afterDraw(renderService: IRenderService, drawParams: IDrawContext) {\n return;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/draw-contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAgBxF,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,eAAe,EAAQ,MAAM,kBAAkB,CAAC;AAE3F,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAkB,MAAM,UAAU,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,E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AAC,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;AAzZY,uBAAuB;IADnC,UAAU,EAAE;IAmBR,WAAA,WAAW,CAAC,aAAa,CAAC,CAAA;IAG1B,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,mBAAmB,CAAC,CAAA;;GAtBlB,uBAAuB,CAyZnC;SAzZY,uBAAuB","file":"draw-contribution.js","sourcesContent":["import { injectable, inject, named, multiInject } from '../../../common/inversify-lite';\nimport type {\n IContext2d,\n MaybePromise,\n IGraphic,\n IGroup,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider,\n IDrawItemInterceptorContribution,\n IDrawContribution,\n IRenderSelector,\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';\nimport type { IAABBBounds, IBounds, IBoundsLike, IMatrix, IMatrixLike } from '@visactor/vutils';\nimport { Bounds, Logger, getRectIntersect, isRectIntersect, last } from '@visactor/vutils';\nimport { LayerService } from '../../../core/constants';\nimport { container } from '../../../container';\nimport { GraphicRender, IncrementalDrawContribution, RenderSelector } 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 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 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 (this.useDirtyBounds && !isRectIntersect(group.AABBBounds, this.dirtyBounds, false)) {\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 = false;\n let tempBounds: IAABBBounds;\n\n if (graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n retrans = !!(scrollX || scrollY);\n if (retrans) {\n tempBounds = this.dirtyBounds.clone();\n // 变换dirtyBounds\n const m = graphic.globalTransMatrix.getInverse();\n this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(m);\n this.dirtyBounds.translate(-scrollX, -scrollY);\n }\n }\n\n if (this.useDirtyBounds && !(graphic.isContainer || isRectIntersect(graphic.AABBBounds, this.dirtyBounds, false))) {\n retrans && this.dirtyBounds.copy(tempBounds);\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\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"]}
|