@visactor/vtable 1.10.5-alpha.0 → 1.10.6-alpha.0
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/ListTable.d.ts +4 -3
- package/cjs/ListTable.js +13 -8
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.d.ts +1 -1
- package/cjs/PivotChart.js +5 -3
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +2 -2
- package/cjs/PivotTable.js +7 -7
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +2 -2
- package/cjs/core/BaseTable.js +4 -3
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/TABLE_EVENT_TYPE.d.ts +2 -0
- package/cjs/core/TABLE_EVENT_TYPE.js +2 -0
- package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/cjs/core/animation.js +3 -2
- package/cjs/core/animation.js.map +1 -1
- package/cjs/event/event.js +2 -1
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +24 -11
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/table-group.js +12 -2
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/icons.js +18 -0
- package/cjs/icons.js.map +1 -1
- package/cjs/index.d.ts +4 -1
- package/cjs/index.js +3 -2
- package/cjs/index.js.map +1 -1
- package/cjs/layout/pivot-header-layout.d.ts +1 -0
- package/cjs/layout/pivot-header-layout.js +5 -2
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/simple-header-layout.d.ts +1 -0
- package/cjs/layout/simple-header-layout.js +5 -2
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/plugins/carousel-animation.d.ts +29 -0
- package/cjs/plugins/carousel-animation.js +60 -0
- package/cjs/plugins/carousel-animation.js.map +1 -0
- package/cjs/plugins/chartModules.js +1 -1
- package/cjs/plugins/custom-cell-style.js +22 -15
- package/cjs/plugins/custom-cell-style.js.map +1 -1
- package/cjs/plugins/header-highlight.d.ts +21 -0
- package/cjs/plugins/header-highlight.js +106 -0
- package/cjs/plugins/header-highlight.js.map +1 -0
- package/cjs/plugins/invert-highlight.d.ts +19 -0
- package/cjs/plugins/invert-highlight.js +72 -0
- package/cjs/plugins/invert-highlight.js.map +1 -0
- package/cjs/scenegraph/component/cell-mover.d.ts +6 -1
- package/cjs/scenegraph/component/cell-mover.js +7 -2
- package/cjs/scenegraph/component/cell-mover.js.map +1 -1
- package/cjs/scenegraph/component/custom.d.ts +2 -1
- package/cjs/scenegraph/component/custom.js +13 -7
- package/cjs/scenegraph/component/custom.js.map +1 -1
- package/cjs/scenegraph/component/table-component.d.ts +6 -1
- package/cjs/scenegraph/component/table-component.js +1 -1
- package/cjs/scenegraph/component/table-component.js.map +1 -1
- package/cjs/scenegraph/graphic/chart.js +6 -4
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/draw-interceptor.js +4 -2
- package/cjs/scenegraph/graphic/contributions/draw-interceptor.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/image-contribution-render.d.ts +18 -0
- package/cjs/scenegraph/graphic/contributions/image-contribution-render.js +30 -1
- package/cjs/scenegraph/graphic/contributions/image-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/index.js +4 -0
- package/cjs/scenegraph/graphic/contributions/index.js.map +1 -1
- package/cjs/scenegraph/graphic/group.js +2 -1
- package/cjs/scenegraph/graphic/group.js.map +1 -1
- package/cjs/scenegraph/graphic/icon.d.ts +18 -1
- package/cjs/scenegraph/graphic/icon.js +43 -2
- package/cjs/scenegraph/graphic/icon.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +5 -4
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +7 -7
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/layout/frozen.js +2 -4
- package/cjs/scenegraph/layout/frozen.js.map +1 -1
- package/cjs/scenegraph/layout/update-height.js +2 -2
- package/cjs/scenegraph/layout/update-height.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.js +6 -4
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +2 -1
- package/cjs/scenegraph/scenegraph.js +37 -7
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/utils/text-icon-layout.d.ts +1 -1
- package/cjs/scenegraph/utils/text-icon-layout.js +14 -12
- package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/cjs/state/cell-move/index.d.ts +2 -2
- package/cjs/state/cell-move/index.js +26 -6
- package/cjs/state/cell-move/index.js.map +1 -1
- package/cjs/state/select/is-cell-select-highlight.js +26 -4
- package/cjs/state/select/is-cell-select-highlight.js.map +1 -1
- package/cjs/state/select/update-position.d.ts +1 -1
- package/cjs/state/select/update-position.js +2 -2
- package/cjs/state/select/update-position.js.map +1 -1
- package/cjs/state/state.d.ts +3 -2
- package/cjs/state/state.js +13 -18
- package/cjs/state/state.js.map +1 -1
- package/cjs/tools/cell-range.d.ts +2 -0
- package/cjs/tools/cell-range.js +10 -0
- package/cjs/tools/cell-range.js.map +1 -0
- package/cjs/tools/helper.js +1 -1
- package/cjs/tools/helper.js.map +1 -1
- package/cjs/tools/icons.js +1 -1
- package/cjs/tools/icons.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +7 -2
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/events.d.ts +22 -0
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/icon.d.ts +3 -1
- package/cjs/ts-types/icon.js +2 -1
- package/cjs/ts-types/icon.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +2 -1
- package/cjs/ts-types/table-engine.js +2 -1
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +1852 -303
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +4 -3
- package/es/ListTable.js +12 -8
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +1 -1
- package/es/PivotChart.js +5 -3
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +2 -2
- package/es/PivotTable.js +7 -7
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.d.ts +2 -2
- package/es/core/BaseTable.js +4 -3
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/TABLE_EVENT_TYPE.d.ts +2 -0
- package/es/core/TABLE_EVENT_TYPE.js +2 -0
- package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/es/core/animation.js +3 -2
- package/es/core/animation.js.map +1 -1
- package/es/event/event.js +2 -1
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +24 -11
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/table-group.js +12 -2
- package/es/event/listener/table-group.js.map +1 -1
- package/es/icons.js +18 -0
- package/es/icons.js.map +1 -1
- package/es/index.d.ts +4 -1
- package/es/index.js +7 -1
- package/es/index.js.map +1 -1
- package/es/layout/pivot-header-layout.d.ts +1 -0
- package/es/layout/pivot-header-layout.js +5 -2
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/simple-header-layout.d.ts +1 -0
- package/es/layout/simple-header-layout.js +5 -2
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/plugins/carousel-animation.d.ts +29 -0
- package/es/plugins/carousel-animation.js +52 -0
- package/es/plugins/carousel-animation.js.map +1 -0
- package/es/plugins/chartModules.js +1 -1
- package/es/plugins/custom-cell-style.js +22 -15
- package/es/plugins/custom-cell-style.js.map +1 -1
- package/es/plugins/header-highlight.d.ts +21 -0
- package/es/plugins/header-highlight.js +98 -0
- package/es/plugins/header-highlight.js.map +1 -0
- package/es/plugins/invert-highlight.d.ts +19 -0
- package/es/plugins/invert-highlight.js +69 -0
- package/es/plugins/invert-highlight.js.map +1 -0
- package/es/scenegraph/component/cell-mover.d.ts +6 -1
- package/es/scenegraph/component/cell-mover.js +7 -2
- package/es/scenegraph/component/cell-mover.js.map +1 -1
- package/es/scenegraph/component/custom.d.ts +2 -1
- package/es/scenegraph/component/custom.js +13 -7
- package/es/scenegraph/component/custom.js.map +1 -1
- package/es/scenegraph/component/table-component.d.ts +6 -1
- package/es/scenegraph/component/table-component.js +1 -1
- package/es/scenegraph/component/table-component.js.map +1 -1
- package/es/scenegraph/graphic/chart.js +6 -4
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/graphic/contributions/draw-interceptor.js +4 -2
- package/es/scenegraph/graphic/contributions/draw-interceptor.js.map +1 -1
- package/es/scenegraph/graphic/contributions/image-contribution-render.d.ts +18 -0
- package/es/scenegraph/graphic/contributions/image-contribution-render.js +29 -0
- package/es/scenegraph/graphic/contributions/image-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/contributions/index.js +4 -2
- package/es/scenegraph/graphic/contributions/index.js.map +1 -1
- package/es/scenegraph/graphic/group.js +2 -1
- package/es/scenegraph/graphic/group.js.map +1 -1
- package/es/scenegraph/graphic/icon.d.ts +18 -1
- package/es/scenegraph/graphic/icon.js +45 -2
- package/es/scenegraph/graphic/icon.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +6 -3
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +7 -7
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/layout/frozen.js +2 -3
- package/es/scenegraph/layout/frozen.js.map +1 -1
- package/es/scenegraph/layout/update-height.js +2 -2
- package/es/scenegraph/layout/update-height.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.js +6 -4
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +2 -1
- package/es/scenegraph/scenegraph.js +18 -5
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/utils/text-icon-layout.d.ts +1 -1
- package/es/scenegraph/utils/text-icon-layout.js +14 -12
- package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/es/state/cell-move/index.d.ts +2 -2
- package/es/state/cell-move/index.js +27 -5
- package/es/state/cell-move/index.js.map +1 -1
- package/es/state/select/is-cell-select-highlight.js +24 -3
- package/es/state/select/is-cell-select-highlight.js.map +1 -1
- package/es/state/select/update-position.d.ts +1 -1
- package/es/state/select/update-position.js +2 -2
- package/es/state/select/update-position.js.map +1 -1
- package/es/state/state.d.ts +3 -2
- package/es/state/state.js +13 -18
- package/es/state/state.js.map +1 -1
- package/es/tools/cell-range.d.ts +2 -0
- package/es/tools/cell-range.js +4 -0
- package/es/tools/cell-range.js.map +1 -0
- package/es/tools/helper.js +1 -1
- package/es/tools/helper.js.map +1 -1
- package/es/tools/icons.js +1 -1
- package/es/tools/icons.js.map +1 -1
- package/es/ts-types/base-table.d.ts +7 -2
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/events.d.ts +22 -0
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/icon.d.ts +3 -1
- package/es/ts-types/icon.js +2 -1
- package/es/ts-types/icon.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +2 -1
- package/es/ts-types/table-engine.js +2 -1
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +9 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/graphic/contributions/draw-interceptor.ts"],"names":[],"mappings":";;;;;;AASA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,IAAI,YAAoB,CAAC;AAGlB,IAAM,qCAAqC,GAA3C,MAAM,qCAAqC;IAGhD;QAFA,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MAAM,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;QAE7B,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,uBAAuB,CAC/C,UAAU,CAAC,IAAI,CAAC,KAAK,EACrB,UAAU,CAAC,IAAI,CAAC,MAAM,EACtB,CAAC,CAAC,KAAK,EAAE,EACT,CAAC,CAAC,MAAM,EAAE,CACX,CAAC;QAEF,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAEpH,OAAO,CAAC,sBAAsB,EAAE,CAAC;QAEjC,OAAO,IAAI,CAAC;IACd,CAAC;CACF","file":"draw-interceptor.js","sourcesContent":["import type {\n IDrawItemInterceptorContribution,\n IGraphic,\n IRenderService,\n IDrawContext,\n IDrawContribution,\n IGraphicRenderDrawParams,\n IImage\n} from './../../../vrender';\nimport { injectable, createImage } from './../../../vrender';\nimport * as icons from '../../../icons';\nimport { calcKeepAspectRatioSize } from '../../utils/keep-aspect-ratio';\nlet loadingImage: IImage;\n\n@injectable()\nexport class VTableDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n interceptors: IDrawItemInterceptorContribution[];\n constructor() {\n this.interceptors = [new ImageDrawItemInterceptorContribution()];\n }\n afterDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n for (let i = 0; i < this.interceptors.length; i++) {\n if (\n this.interceptors[i].afterDrawItem &&\n this.interceptors[i].afterDrawItem(graphic, renderService, drawContext, drawContribution, params)\n ) {\n return true;\n }\n }\n return false;\n }\n\n beforeDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 【性能方案】判定写在外层,减少遍历判断耗时,10000条数据减少1ms\n if (\n (!graphic.in3dMode || drawContext.in3dInterceptor) &&\n !graphic.shadowRoot &&\n !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)\n ) {\n return false;\n }\n\n for (let i = 0; i < this.interceptors.length; i++) {\n if (\n this.interceptors[i].beforeDrawItem &&\n this.interceptors[i].beforeDrawItem(graphic, renderService, drawContext, drawContribution, params)\n ) {\n return true;\n }\n }\n return false;\n }\n}\n\nexport class ImageDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n\n afterDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n if (graphic.type === 'image') {\n this.drawItem(graphic, renderService, drawContext, drawContribution, params);\n }\n return false;\n }\n\n protected drawItem(\n graphic: IImage,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n const { image: url, gif } = graphic.attribute as any;\n\n if (gif && graphic.playing) {\n return false;\n }\n if (!url || !graphic.resources) {\n return false;\n }\n const res = graphic.resources.get(url);\n if (!res || res.state !== 'loading') {\n return false;\n }\n\n if (!loadingImage) {\n const regedIcons = icons.get();\n const svg = (regedIcons.loading_pic as any).svg;\n const width = (regedIcons.loading_pic as any).width;\n const height = (regedIcons.loading_pic as any).height;\n loadingImage = createImage({\n width,\n height,\n image: svg\n });\n }\n const { image: loadingUrl } = loadingImage.attribute;\n if (!url || !loadingImage.resources) {\n return false;\n }\n const loadingRes = loadingImage.resources.get(loadingUrl);\n if (loadingRes.state !== 'success') {\n return false;\n }\n\n const { context } = drawContext;\n context.highPerformanceSave();\n // 直接transform\n graphic.parent && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);\n graphic.glyphHost &&\n graphic.glyphHost.parent &&\n context.setTransformFromMatrix(graphic.glyphHost.parent.globalTransMatrix, true);\n\n const b = graphic.AABBBounds;\n\n const { width, height } = calcKeepAspectRatioSize(\n loadingRes.data.width,\n loadingRes.data.height,\n b.width(),\n b.height()\n );\n\n context.drawImage(loadingRes.data, b.x1 + (b.width() - width) / 2, b.y1 + (b.height() - height) / 2, width, height);\n\n context.highPerformanceRestore();\n\n return true;\n }\n}\n"]}
|
|
@@ -18,3 +18,21 @@ export declare class AfterImageRenderContribution implements IImageRenderContrib
|
|
|
18
18
|
doStroke: boolean;
|
|
19
19
|
}): void;
|
|
20
20
|
}
|
|
21
|
+
export declare class BeforeGifImageRenderContribution implements IImageRenderContribution {
|
|
22
|
+
time: BaseRenderContributionTime;
|
|
23
|
+
useStyle: boolean;
|
|
24
|
+
order: number;
|
|
25
|
+
drawShape(image: IImage, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, imageAttribute: Required<IImageGraphicAttribute>, drawContext: IDrawContext, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, doFillOrStroke?: {
|
|
26
|
+
doFill: boolean;
|
|
27
|
+
doStroke: boolean;
|
|
28
|
+
}): void;
|
|
29
|
+
}
|
|
30
|
+
export declare class AfterGifImageRenderContribution implements IImageRenderContribution {
|
|
31
|
+
time: BaseRenderContributionTime;
|
|
32
|
+
useStyle: boolean;
|
|
33
|
+
order: number;
|
|
34
|
+
drawShape(image: IImage, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, imageAttribute: Required<IImageGraphicAttribute>, drawContext: IDrawContext, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, doFillOrStroke?: {
|
|
35
|
+
doFill: boolean;
|
|
36
|
+
doStroke: boolean;
|
|
37
|
+
}): void;
|
|
38
|
+
}
|
|
@@ -37,4 +37,33 @@ let AfterImageRenderContribution = class {
|
|
|
37
37
|
AfterImageRenderContribution = __decorate([ injectable() ], AfterImageRenderContribution);
|
|
38
38
|
|
|
39
39
|
export { AfterImageRenderContribution };
|
|
40
|
+
|
|
41
|
+
let BeforeGifImageRenderContribution = class {
|
|
42
|
+
constructor() {
|
|
43
|
+
this.time = BaseRenderContributionTime.beforeFillStroke, this.useStyle = !0, this.order = 0;
|
|
44
|
+
}
|
|
45
|
+
drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, imageAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) {
|
|
46
|
+
const {isGif: isGif} = image.attribute;
|
|
47
|
+
isGif && image.playing && (image.attribute.opacity = 0);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
BeforeGifImageRenderContribution = __decorate([ injectable() ], BeforeGifImageRenderContribution);
|
|
52
|
+
|
|
53
|
+
export { BeforeGifImageRenderContribution };
|
|
54
|
+
|
|
55
|
+
let AfterGifImageRenderContribution = class {
|
|
56
|
+
constructor() {
|
|
57
|
+
this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
58
|
+
}
|
|
59
|
+
drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, imageAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) {
|
|
60
|
+
const {isGif: isGif} = image.attribute;
|
|
61
|
+
isGif && image.playing && (image.attribute.opacity = 1, context.globalAlpha = image.attribute.opacity,
|
|
62
|
+
image.renderFrame(context, x, y));
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
AfterGifImageRenderContribution = __decorate([ injectable() ], AfterGifImageRenderContribution);
|
|
67
|
+
|
|
68
|
+
export { AfterGifImageRenderContribution };
|
|
40
69
|
//# sourceMappingURL=image-contribution-render.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/graphic/contributions/image-contribution-render.ts"],"names":[],"mappings":";;;;;;AAUA,OAAO,EAAE,0BAA0B,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOrE,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IAAnC;QACL,SAAI,GAA+B,0BAA0B,CAAC,gBAAgB,CAAC;QAC/E,aAAQ,GAAG,IAAI,CAAC;QAChB,UAAK,GAAG,CAAC,CAAC;IAqCZ,CAAC;IApCC,SAAS,CACP,KAAa,EACb,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,cAAgD,EAChD,WAAyB,EACzB,MAIY,EACZ,QAIY,EACZ,cAAuD;QAEvD,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,SAAgB,CAAC;QAEzC,IAAI,KAAK,KAAK,QAAQ,EAAE;YACtB,MAAM,EAAE,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC;YAEzF,OAAO,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;YACxF,OAAO,CAAC,SAAS,EAAE,CAAC;YAEpB,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,EAAE,CAAC;SAChB;IACH,CAAC;CACF,CAAA;AAxCY,6BAA6B;IADzC,UAAU,EAAE;GACA,6BAA6B,CAwCzC;SAxCY,6BAA6B;AA2CnC,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAAlC;QACL,SAAI,GAA+B,0BAA0B,CAAC,eAAe,CAAC;QAC9E,aAAQ,GAAG,IAAI,CAAC;QAChB,UAAK,GAAG,CAAC,CAAC;IA8BZ,CAAC;IA7BC,SAAS,CACP,KAAa,EACb,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,cAAgD,EAChD,WAAyB,EACzB,MAIY,EACZ,QAIY,EACZ,cAAuD;QAEvD,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,SAAgB,CAAC;QAEzC,IAAI,KAAK,KAAK,QAAQ,EAAE;YACtB,OAAO,CAAC,OAAO,EAAE,CAAC;SACnB;IACH,CAAC;CACF,CAAA;AAjCY,4BAA4B;IADxC,UAAU,EAAE;GACA,4BAA4B,CAiCxC;SAjCY,4BAA4B","file":"image-contribution-render.js","sourcesContent":["import type {\n IImage,\n IContext2d,\n IImageGraphicAttribute,\n IMarkAttribute,\n IGraphicAttribute,\n IThemeAttribute,\n IImageRenderContribution,\n IDrawContext\n} from './../../../vrender';\nimport { BaseRenderContributionTime, injectable } from './../../../vrender';\n\n/**\n * @description: image支持绘制部分形状\n * @return {*}\n */\n@injectable()\nexport class BeforeImageRenderContribution implements IImageRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.beforeFillStroke;\n useStyle = true;\n order = 0;\n drawShape(\n image: IImage,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n imageAttribute: Required<IImageGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n doFillOrStroke?: { doFill: boolean; doStroke: boolean }\n ) {\n const { shape } = image.attribute as any;\n\n if (shape === 'circle') {\n const { width = imageAttribute.width, height = imageAttribute.height } = image.attribute;\n\n context.beginPath();\n context.arc(x + width / 2, y + height / 2, Math.min(width, height) / 2, 0, 2 * Math.PI);\n context.closePath();\n\n context.save();\n context.clip();\n }\n }\n}\n\n@injectable()\nexport class AfterImageRenderContribution implements IImageRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle = true;\n order = 0;\n drawShape(\n image: IImage,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n imageAttribute: Required<IImageGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n doFillOrStroke?: { doFill: boolean; doStroke: boolean }\n ) {\n const { shape } = image.attribute as any;\n\n if (shape === 'circle') {\n context.restore();\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/graphic/contributions/image-contribution-render.ts"],"names":[],"mappings":";;;;;;AAUA,OAAO,EAAE,0BAA0B,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOrE,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IAAnC;QACL,SAAI,GAA+B,0BAA0B,CAAC,gBAAgB,CAAC;QAC/E,aAAQ,GAAG,IAAI,CAAC;QAChB,UAAK,GAAG,CAAC,CAAC;IAqCZ,CAAC;IApCC,SAAS,CACP,KAAa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KAAK,CAAC,OAAO,EAAE;YAC1B,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,CAAC,CAAC;YAC5B,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC;YAC9C,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;SAClC;IACH,CAAC;CACF,CAAA;AAnCY,+BAA+B;IAD3C,UAAU,EAAE;GACA,+BAA+B,CAmC3C;SAnCY,+BAA+B","file":"image-contribution-render.js","sourcesContent":["import type {\n IImage,\n IContext2d,\n IImageGraphicAttribute,\n IMarkAttribute,\n IGraphicAttribute,\n IThemeAttribute,\n IImageRenderContribution,\n IDrawContext\n} from './../../../vrender';\nimport { BaseRenderContributionTime, injectable } from './../../../vrender';\n\n/**\n * @description: image支持绘制部分形状\n * @return {*}\n */\n@injectable()\nexport class BeforeImageRenderContribution implements IImageRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.beforeFillStroke;\n useStyle = true;\n order = 0;\n drawShape(\n image: IImage,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n imageAttribute: Required<IImageGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n doFillOrStroke?: { doFill: boolean; doStroke: boolean }\n ) {\n const { shape } = image.attribute as any;\n\n if (shape === 'circle') {\n const { width = imageAttribute.width, height = imageAttribute.height } = image.attribute;\n\n context.beginPath();\n context.arc(x + width / 2, y + height / 2, Math.min(width, height) / 2, 0, 2 * Math.PI);\n context.closePath();\n\n context.save();\n context.clip();\n }\n }\n}\n\n@injectable()\nexport class AfterImageRenderContribution implements IImageRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle = true;\n order = 0;\n drawShape(\n image: IImage,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n imageAttribute: Required<IImageGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n doFillOrStroke?: { doFill: boolean; doStroke: boolean }\n ) {\n const { shape } = image.attribute as any;\n\n if (shape === 'circle') {\n context.restore();\n }\n }\n}\n\n/**\n * @description: image支持gif动态图片\n * @return {*}\n */\n@injectable()\nexport class BeforeGifImageRenderContribution implements IImageRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.beforeFillStroke;\n useStyle = true;\n order = 0;\n drawShape(\n image: IImage,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n imageAttribute: Required<IImageGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n doFillOrStroke?: { doFill: boolean; doStroke: boolean }\n ) {\n const { isGif } = image.attribute as any;\n\n if (isGif && image.playing) {\n image.attribute.opacity = 0; // hack for static image\n }\n }\n}\n\n@injectable()\nexport class AfterGifImageRenderContribution implements IImageRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle = true;\n order = 0;\n drawShape(\n image: IImage,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n imageAttribute: Required<IImageGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n doFillOrStroke?: { doFill: boolean; doStroke: boolean }\n ) {\n const { isGif } = image.attribute as any;\n\n if (isGif && image.playing) {\n image.attribute.opacity = 1; // hack for static image\n context.globalAlpha = image.attribute.opacity;\n image.renderFrame(context, x, y);\n }\n }\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { GraphicRender, GroupRenderContribution, ImageRenderContribution, RectRe
|
|
|
2
2
|
|
|
3
3
|
import { ChartRender, DefaultCanvasChartRender } from "./chart-render";
|
|
4
4
|
|
|
5
|
-
import { AfterImageRenderContribution, BeforeImageRenderContribution } from "./image-contribution-render";
|
|
5
|
+
import { AfterImageRenderContribution, BeforeImageRenderContribution, BeforeGifImageRenderContribution, AfterGifImageRenderContribution } from "./image-contribution-render";
|
|
6
6
|
|
|
7
7
|
import { SplitRectBeforeRenderContribution as VTableSplitRectBeforeRenderContribution, SplitRectAfterRenderContribution as VTableSplitRectAfterRenderContribution } from "./rect-contribution-render";
|
|
8
8
|
|
|
@@ -20,7 +20,9 @@ export default new ContainerModule(((bind, unbind, isBound, rebind) => {
|
|
|
20
20
|
bind(DefaultCanvasChartRender).toSelf().inSingletonScope(), bind(ChartRender).to(DefaultCanvasChartRender),
|
|
21
21
|
bind(GraphicRender).to(DefaultCanvasChartRender), bind(BeforeImageRenderContribution).toSelf().inSingletonScope(),
|
|
22
22
|
bind(ImageRenderContribution).toService(BeforeImageRenderContribution), bind(AfterImageRenderContribution).toSelf().inSingletonScope(),
|
|
23
|
-
bind(ImageRenderContribution).toService(AfterImageRenderContribution), bind(
|
|
23
|
+
bind(ImageRenderContribution).toService(AfterImageRenderContribution), bind(BeforeGifImageRenderContribution).toSelf().inSingletonScope(),
|
|
24
|
+
bind(ImageRenderContribution).toService(BeforeGifImageRenderContribution), bind(AfterGifImageRenderContribution).toSelf().inSingletonScope(),
|
|
25
|
+
bind(ImageRenderContribution).toService(AfterGifImageRenderContribution), bind(AdjustColorGroupBeforeRenderContribution).toSelf().inSingletonScope(),
|
|
24
26
|
bind(GroupRenderContribution).toService(AdjustColorGroupBeforeRenderContribution),
|
|
25
27
|
bind(AdjustColorGroupAfterRenderContribution).toSelf().inSingletonScope(), bind(GroupRenderContribution).toService(AdjustColorGroupAfterRenderContribution),
|
|
26
28
|
bind(SplitGroupAfterRenderContribution).toSelf().inSingletonScope(), bind(GroupRenderContribution).toService(SplitGroupAfterRenderContribution),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/graphic/contributions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,iCAAiC,EACjC,gCAAgC,EAChC,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/graphic/contributions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,iCAAiC,EACjC,gCAAgC,EAChC,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EACL,4BAA4B,EAC5B,6BAA6B,EAC7B,gCAA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AI,CAAC,uBAAuB,CAAC,CAAC,SAAS,CAAC,kCAAkC,CAAC,CAAC;IAE5E,IAAI,CAAC,iCAAiC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACpE,IAAI,CAAC,uBAAuB,CAAC,CAAC,SAAS,CAAC,iCAAiC,CAAC,CAAC;IAC3E,IAAI,CAAC,gCAAgC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACnE,IAAI,CAAC,uBAAuB,CAAC,CAAC,SAAS,CAAC,gCAAgC,CAAC,CAAC;IAE1E,IAAI,CAAC,sCAAsC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACzE,IAAI,CAAC,uBAAuB,CAAC,CAAC,SAAS,CAAC,sCAAsC,CAAC,CAAC;IAChF,IAAI,CAAC,qCAAqC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACxE,IAAI,CAAC,uBAAuB,CAAC,CAAC,SAAS,CAAC,qCAAqC,CAAC,CAAC;IAE/E,IAAI,CAAC,qCAAqC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACxE,IAAI,CAAC,uBAAuB,CAAC,CAAC,SAAS,CAAC,qCAAqC,CAAC,CAAC;IAK/E,IAAI,CAAC,qCAAqC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACxE,IAAI,CAAC,mBAAmB,CAAC,CAAC,SAAS,CAAC,qCAAqC,CAAC,CAAC;IAG3E,IAAI,CAAC,kCAAkC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACrE,IAAI,CAAC,sBAAsB,CAAC,CAAC,SAAS,CAAC,kCAAkC,CAAC,CAAC;AAC7E,CAAC,CAAC,CAAC","file":"index.js","sourcesContent":["import {\n GraphicRender,\n GroupRenderContribution,\n ImageRenderContribution,\n RectRenderContribution,\n SplitRectBeforeRenderContribution,\n SplitRectAfterRenderContribution,\n ContainerModule,\n DrawItemInterceptor,\n TextRenderContribution\n} from './../../../vrender';\nimport { ChartRender, DefaultCanvasChartRender } from './chart-render';\nimport {\n AfterImageRenderContribution,\n BeforeImageRenderContribution,\n BeforeGifImageRenderContribution,\n AfterGifImageRenderContribution\n} from './image-contribution-render';\nimport {\n SplitRectBeforeRenderContribution as VTableSplitRectBeforeRenderContribution,\n SplitRectAfterRenderContribution as VTableSplitRectAfterRenderContribution\n} from './rect-contribution-render';\nimport {\n DashGroupAfterRenderContribution,\n DashGroupBeforeRenderContribution,\n SplitGroupBeforeRenderContribution,\n SplitGroupAfterRenderContribution,\n AdjustPosGroupBeforeRenderContribution,\n AdjustPosGroupAfterRenderContribution,\n AdjustColorGroupBeforeRenderContribution,\n AdjustColorGroupAfterRenderContribution,\n ClipBodyGroupBeforeRenderContribution\n // ClipBodyGroupAfterRenderContribution\n} from './group-contribution-render';\nimport { VTableDrawItemInterceptorContribution } from './draw-interceptor';\nimport { SuffixTextBeforeRenderContribution } from './text-contribution-render';\n\nexport default new ContainerModule((bind, unbind, isBound, rebind) => {\n // rect 渲染器注入contributions\n if (isBound(SplitRectBeforeRenderContribution)) {\n rebind(SplitRectBeforeRenderContribution).to(VTableSplitRectBeforeRenderContribution).inSingletonScope();\n } else {\n bind(VTableSplitRectBeforeRenderContribution).toSelf().inSingletonScope();\n bind(RectRenderContribution).toService(VTableSplitRectBeforeRenderContribution);\n }\n if (isBound(SplitRectAfterRenderContribution)) {\n rebind(SplitRectAfterRenderContribution).to(VTableSplitRectAfterRenderContribution).inSingletonScope();\n } else {\n bind(VTableSplitRectAfterRenderContribution).toSelf().inSingletonScope();\n bind(RectRenderContribution).toService(VTableSplitRectAfterRenderContribution);\n }\n\n // chart渲染器注入\n bind(DefaultCanvasChartRender).toSelf().inSingletonScope();\n bind(ChartRender).to(DefaultCanvasChartRender);\n bind(GraphicRender).to(DefaultCanvasChartRender);\n\n // image 渲染器注入contributions\n bind(BeforeImageRenderContribution).toSelf().inSingletonScope();\n bind(ImageRenderContribution).toService(BeforeImageRenderContribution);\n bind(AfterImageRenderContribution).toSelf().inSingletonScope();\n bind(ImageRenderContribution).toService(AfterImageRenderContribution);\n\n bind(BeforeGifImageRenderContribution).toSelf().inSingletonScope();\n bind(ImageRenderContribution).toService(BeforeGifImageRenderContribution);\n bind(AfterGifImageRenderContribution).toSelf().inSingletonScope();\n bind(ImageRenderContribution).toService(AfterGifImageRenderContribution);\n\n // group 渲染器注入contributions\n bind(AdjustColorGroupBeforeRenderContribution).toSelf().inSingletonScope();\n bind(GroupRenderContribution).toService(AdjustColorGroupBeforeRenderContribution);\n bind(AdjustColorGroupAfterRenderContribution).toSelf().inSingletonScope();\n bind(GroupRenderContribution).toService(AdjustColorGroupAfterRenderContribution);\n\n bind(SplitGroupAfterRenderContribution).toSelf().inSingletonScope();\n bind(GroupRenderContribution).toService(SplitGroupAfterRenderContribution);\n bind(SplitGroupBeforeRenderContribution).toSelf().inSingletonScope();\n bind(GroupRenderContribution).toService(SplitGroupBeforeRenderContribution);\n\n bind(DashGroupBeforeRenderContribution).toSelf().inSingletonScope();\n bind(GroupRenderContribution).toService(DashGroupBeforeRenderContribution);\n bind(DashGroupAfterRenderContribution).toSelf().inSingletonScope();\n bind(GroupRenderContribution).toService(DashGroupAfterRenderContribution);\n\n bind(AdjustPosGroupBeforeRenderContribution).toSelf().inSingletonScope();\n bind(GroupRenderContribution).toService(AdjustPosGroupBeforeRenderContribution);\n bind(AdjustPosGroupAfterRenderContribution).toSelf().inSingletonScope();\n bind(GroupRenderContribution).toService(AdjustPosGroupAfterRenderContribution);\n\n bind(ClipBodyGroupBeforeRenderContribution).toSelf().inSingletonScope();\n bind(GroupRenderContribution).toService(ClipBodyGroupBeforeRenderContribution);\n // bind(ClipBodyGroupAfterRenderContribution).toSelf().inSingletonScope();\n // bind(GroupRenderContribution).toService(ClipBodyGroupAfterRenderContribution);\n\n // interceptor\n bind(VTableDrawItemInterceptorContribution).toSelf().inSingletonScope();\n bind(DrawItemInterceptor).toService(VTableDrawItemInterceptorContribution);\n\n // text 渲染器注入contributions\n bind(SuffixTextBeforeRenderContribution).toSelf().inSingletonScope();\n bind(TextRenderContribution).toService(SuffixTextBeforeRenderContribution);\n});\n"]}
|
|
@@ -106,7 +106,8 @@ export class Group extends VRenderGroup {
|
|
|
106
106
|
if ("cell" === this.role) {
|
|
107
107
|
const attribute = this.attribute, {x: x, y: y, width: width, height: height} = attribute;
|
|
108
108
|
return this._AABBBounds.setValue(x, y, x + width, y + height), this.parent && this.parent.addChildUpdateBoundTag(),
|
|
109
|
-
this.clearUpdateBoundTag(), this.
|
|
109
|
+
this.clearUpdateBoundTag(), this.shadowRoot && this.shadowRoot.tryUpdateAABBBounds(),
|
|
110
|
+
this._AABBBounds;
|
|
110
111
|
}
|
|
111
112
|
return "body" === this.role || "row-header" === this.role || "col-header" === this.role || "right-frozen" === this.role || "bottom-frozen" === this.role || "corner-header" === this.role || "corner-right-top-header" === this.role || "corner-right-bottom-header" === this.role || "corner-left-bottom-header" === this.role ? (this._AABBBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0),
|
|
112
113
|
this.parent && this.parent.addChildUpdateBoundTag(), this.clearUpdateBoundTag(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/graphic/group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAKxD,MAAM,OAAO,KAAM,SAAQ,YAAY;IA+CrC,KAAK;QACH,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAED,cAAc,CAAC,IAAY,EAAE,IAAc;QAMzC,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,eAAe,CAAC,CAAC,KAAe,EAAE,EAAE;YACvC,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE;gBACvB,MAAM,GAAG,KAAK,CAAC;gBACf,OAAO,I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ACR;IACD,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AAC5C,CAAC","file":"group.js","sourcesContent":["import type { IGraphic, IColor, IRect, INode, IGroupGraphicAttribute, ISetAttributeContext } from './../../vrender';\nimport { Group as VRenderGroup } from './../../vrender';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { InteractionState } from '../../ts-types';\nimport { isNumber, type AABBBounds } from '@visactor/vutils';\n\nexport class Group extends VRenderGroup {\n role?: string;\n col?: number;\n row?: number;\n mergeStartCol?: number;\n mergeStartRow?: number;\n mergeEndCol?: number;\n mergeEndRow?: number;\n contentWidth?: number;\n contentHeight?: number;\n rowNumber?: number; // row number of the column group\n colHeight?: number; // current height of the column group\n border?: IRect; // table/header/body的border mark,挂载在这里方便更新\n needUpdate?: boolean;\n\n needUpdateWidth?: boolean;\n needUpdateHeight?: boolean;\n\n // changes for size align for fs\n // constructor(attribute?: IGroupGraphicAttribute) {\n // dealWidthSize(attribute, attribute);\n // super(attribute);\n // }\n\n // setAttribute(key: string, value: any, forceUpdateTag?: boolean, context?: ISetAttributeContext): void {\n // if (key === 'x' || key === 'y' || key === 'width' || key === 'height') {\n // this.attribute[`old${key}`];\n // }\n // const values = {\n // [key]: value\n // };\n // this.setAttributes(values, forceUpdateTag, context);\n // }\n\n // setAttributes(\n // params: Partial<IGroupGraphicAttribute>,\n // forceUpdateTag?: boolean,\n // context?: ISetAttributeContext\n // ): void {\n // dealWidthSize(params, this.attribute);\n // super.setAttributes(params, forceUpdateTag, context);\n // }\n\n /**\n * @description: 清空Group下全部子元素\n * @return {*}\n */\n clear() {\n this.removeAllChild();\n }\n\n getChildByName(name: string, deep?: boolean): any {\n // for (let i = 0, j = this.children.length; i < j; i++) {\n // if (this.children[i].name === name) {\n // return this.children[i] as unknown as T;\n // }\n // }\n let result = null;\n this.forEachChildren((child: IGraphic) => {\n if (child.name === name) {\n result = child;\n return true; // 提前退出循环\n }\n return false;\n });\n\n if (deep) {\n // for (let i = 0, j = this.children.length; i < j; i++) {\n // const child = this.children[i] as Group;\n\n // if (!child.getChildByName) {\n // continue;\n // }\n\n // const target = child.getChildByName(name, true);\n\n // if (target) {\n // return target;\n // }\n // }\n this.forEachChildren((child: IGraphic) => {\n if ((child as Group).getChildByName) {\n const target = (child as Group).getChildByName(name, true);\n if (target) {\n result = target;\n return true;\n }\n }\n return false;\n });\n }\n\n return result;\n }\n\n get width() {\n let width = this.AABBBounds.width();\n if (width === Infinity || width === -Infinity) {\n width = 0;\n }\n return Math.max(width, this.attribute.width ?? 0);\n }\n\n get height() {\n let height = this.AABBBounds.height();\n if (height === Infinity || height === -Infinity) {\n height = 0;\n }\n return Math.max(height, this.attribute.height ?? 0);\n }\n\n setDeltaWidth(deltaX: number) {\n if (deltaX === 0) {\n return;\n }\n this.setAttribute('width', (this.attribute.width ?? 0) + deltaX);\n if (this.border) {\n this.border.setAttribute('width', this.border.attribute.width + deltaX);\n\n if (this.border.type === 'group') {\n (this.border.firstChild as IRect).setAttribute(\n 'width',\n (this.border.firstChild as IRect).attribute.width + deltaX\n );\n }\n }\n }\n\n setDeltaHeight(deltaY: number) {\n if (deltaY === 0) {\n return;\n }\n this.setAttribute('height', (this.attribute.height ?? 0) + deltaY);\n if (this.border) {\n this.border.setAttribute('height', this.border.attribute.height + deltaY);\n if (this.border.type === 'group') {\n (this.border.firstChild as IRect).setAttribute(\n 'width',\n (this.border.firstChild as IRect).attribute.height + deltaY\n );\n }\n }\n }\n\n setDeltaX(deltaX: number) {\n if (deltaX === 0) {\n return;\n }\n this.setAttribute('x', this.attribute.x + deltaX);\n }\n\n setDeltaY(deltaY: number) {\n if (deltaY === 0) {\n return;\n }\n this.setAttribute('y', this.attribute.y + deltaY);\n }\n\n /**\n * @description: 遍历所有子节点,跳过部分节点,默认跳过group的border\n * @return {*}\n */\n forEachChildrenSkipChild<T extends INode = INode>(\n cb: (item: T, index: number) => void | boolean,\n skipChildName = 'border-rect',\n reverse = false\n ) {\n if (reverse) {\n let child = this._lastChild;\n let i = 0;\n while (child) {\n if (child.name !== skipChildName) {\n const breakTag = cb(child as T, i++);\n if (breakTag) {\n return;\n }\n }\n child = child._prev;\n }\n } else {\n let child = this._firstChild;\n let i = 0;\n while (child) {\n if (child.name !== skipChildName) {\n const breakTag = cb(child as T, i++);\n if (breakTag) {\n return;\n }\n }\n child = child._next;\n }\n }\n }\n\n getColGroup(col: number) {\n let c = this._firstChild as Group;\n if (!c) {\n return null;\n }\n for (let i = 0; i < this.childrenCount; i++) {\n if (c.col === col) {\n return c;\n }\n c = c._next as Group;\n }\n return null;\n }\n\n getRowGroup(row: number) {\n let c = this._firstChild as Group;\n if (!c) {\n return null;\n }\n for (let i = 0; i < this.childrenCount; i++) {\n if (c.row === row) {\n return c;\n }\n c = c._next as Group;\n }\n return null;\n }\n\n addCellGroup(cellGroup: Group) {\n if (this.childrenCount === 0 || (this.lastChild as Group).row === cellGroup.row - 1) {\n this.addChild(cellGroup);\n } else {\n // for promise cell row order in column\n let c = this._firstChild as Group;\n for (let i = 0; i < this.childrenCount; i++) {\n if (c.row === cellGroup.row - 1) {\n this.insertAfter(cellGroup, c);\n return;\n }\n c = c._next as Group;\n }\n this.addChild(cellGroup);\n }\n }\n\n getChildAt(index: number) {\n const child = super.getChildAt(index);\n if (child && child.name === 'border-rect') {\n return child._next;\n }\n return child;\n }\n\n protected tryUpdateAABBBounds(): AABBBounds {\n if (this.role === 'cell') {\n if (!this.shouldUpdateAABBBounds()) {\n return this._AABBBounds as AABBBounds;\n }\n // application.graphicService.beforeUpdateAABBBounds(this, this.stage, true, this._AABBBounds);\n const selfChange = this.shouldSelfChangeUpdateAABBBounds();\n // const selfChange = true;\n const bounds = this.doUpdateAABBBounds();\n this.addUpdateLayoutTag();\n // application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange);\n after(this, selfChange);\n\n return bounds;\n }\n return super.tryUpdateAABBBounds() as AABBBounds;\n }\n\n // 目前优化方案会导致合并单元格无法正常更新列宽(因为合并单元格更新bounds不会触发父节点bounds更新),暂时关闭优化方案\n // shouldUpdateAABBBoundsForRowMerge(): boolean {\n\n // }\n\n // shouldUpdateAABBBounds(): boolean {\n // return this.shouldSelfChangeUpdateAABBBounds();\n // // // 检索自己是否需要更新\n // // if (super.shouldUpdateAABBBounds()) {\n // // return true;\n // // }\n // // // 检索叶子节点是否有更新(如果children是叶子节点的话)\n // // if (this._childUpdateTag & UpdateTag.UPDATE_BOUNDS) {\n // // return true;\n // // }\n // // // 检索是否子group需要更新\n // // let needUpdate = false;\n // // this.forEachChildren((node: IGraphic) => {\n // // // 只查找group层级\n // // if (node.isContainer && (node as Group).shouldUpdateAABBBounds()) {\n // // needUpdate = true;\n // // return true;\n // // }\n // // return false;\n // // });\n // // return needUpdate;\n // }\n\n protected doUpdateAABBBounds(): any {\n // const groupTheme = getTheme(this).group;\n // debugger;\n if (this.role === 'cell') {\n const attribute = this.attribute;\n const { x, y, width, height } = attribute;\n this._AABBBounds.setValue(x, y, x + width, y + height);\n // 更新bounds之后需要设置父节点,否则tag丢失\n this.parent && this.parent.addChildUpdateBoundTag();\n this.clearUpdateBoundTag();\n return this._AABBBounds;\n } else if (\n this.role === 'body' ||\n this.role === 'row-header' ||\n this.role === 'col-header' ||\n this.role === 'right-frozen' ||\n this.role === 'bottom-frozen' ||\n this.role === 'corner-header' ||\n this.role === 'corner-right-top-header' ||\n this.role === 'corner-right-bottom-header' ||\n this.role === 'corner-left-bottom-header'\n ) {\n // Infinity bounds for manual clip group\n this._AABBBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n // 更新bounds之后需要设置父节点,否则tag丢失\n this.parent && this.parent.addChildUpdateBoundTag();\n this.clearUpdateBoundTag();\n\n if (this.shadowRoot) {\n // this.shadowRoot.clearUpdateBoundTag();\n this.shadowRoot.tryUpdateAABBBounds();\n }\n return this._AABBBounds;\n }\n return super.doUpdateAABBBounds();\n // _AABBBounds\n // const bounds = graphicService.updateGroupAABBBounds(\n // attribute,\n // getTheme(this).group,\n // this._AABBBounds,\n // this\n // ) as AABBBounds;\n\n // const { boundsPadding = groupTheme.boundsPadding } = attribute;\n // const paddingArray = parsePadding(boundsPadding);\n // if (paddingArray) {\n // bounds.expand(paddingArray);\n // }\n // // 更新bounds之后需要设置父节点,否则tag丢失\n // this.parent && this.parent.addChildUpdateBoundTag();\n // this.clearUpdateBoundTag();\n\n // this.emit('AAABBBoundsChange');\n }\n\n // update column group row number\n updateColumnRowNumber(row: number) {\n if (!this.rowNumber) {\n this.rowNumber = row;\n } else {\n this.rowNumber = Math.max(this.rowNumber, row);\n }\n }\n\n // update column height\n updateColumnHeight(cellHeight: number) {\n if (!this.colHeight) {\n this.colHeight = cellHeight;\n } else {\n this.colHeight += cellHeight;\n }\n }\n\n // doUpdateLocalMatrix() {\n // const oldX = this.attribute.x;\n // const oldY = this.attribute.y;\n // this.attribute.x = Math.floor(this.attribute.x);\n // this.attribute.y = Math.floor(this.attribute.y);\n // super.doUpdateLocalMatrix();\n // this.attribute.x = oldX;\n // this.attribute.y = oldY;\n // }\n}\n\nfunction after(group: Group, selfChange: boolean) {\n if (!group.stage || !group.stage.dirtyBounds || !group.stage.renderCount) {\n return;\n }\n // group的子元素导致的bounds更新不用做dirtyBounds\n if (group.isContainer && !selfChange) {\n return;\n }\n group.stage.dirty(group.globalAABBBounds);\n}\n\n// function dealWidthSize(values: any, attributes: any) {\n// const x = values.x ?? attributes.oldx ?? attributes.x ?? 0 + values.dx ?? attributes.dx ?? 0;\n// const y = values.y ?? attributes.oldy ?? attributes.y ?? 0 + values.dy ?? attributes.dy ?? 0;\n// const width = values.width ?? attributes.oldwidth ?? attributes.width ?? 0;\n// const height = values.height ?? attributes.oldheight ?? attributes.height ?? 0;\n// isNumber(values.width) && (values.oldwidth = values.width);\n// isNumber(values.height) && (values.oldheight = values.height);\n// isNumber(values.x) && (values.oldx = values.x);\n// isNumber(values.y) && (values.oldy = values.y);\n\n// if (Math.floor(x + width) > Math.floor(width) + Math.floor(x)) {\n// values.width = Math.ceil(width);\n// } else {\n// values.width = Math.floor(width);\n// }\n\n// if (Math.floor(y + height) > Math.floor(height) + Math.floor(y)) {\n// values.height = Math.ceil(height);\n// } else {\n// values.height = Math.floor(height);\n// }\n// isNumber(values.x) && (values.x = Math.floor(values.x));\n// isNumber(values.y) && (values.y = Math.floor(values.y));\n// }\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/graphic/group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAKxD,MAAM,OAAO,KAAM,SAAQ,YAAY;IA+CrC,KAAK;QACH,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAED,cAAc,CAAC,IAAY,EAAE,IAAc;QAMzC,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,eAAe,CAAC,CAAC,KAAe,EAAE,EAAE;YACvC,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE;gBACvB,MAAM,GAAG,KAAK,CAAC;gBACf,OAAO,IAAI,CAAC;aACb;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,IAAI,IAAI,EAAE;YAcR,IAAI,CAAC,eAAe,CAAC,CAAC,KAAe,EAAE,EAAE;gBACvC,IAAK,KAAe,CAAC,cAAc,EAAE;oBACnC,MAAM,MAAM,GAAI,KAAe,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;oBAC3D,IAAI,MAAM,EAAE;wBACV,MAAM,GAAG,MAAM,CAAC;wBAChB,OAAO,IAAI,CAAC;qBACb;iBACF;gBACD,OAAO,KAAK,CAAC;YACf,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,KAAK;;QACP,IAAI,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,KAAK,KAAK,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vC;YACD,OAAO,IAAI,CAAC,WAAW,CAAC;SACzB;QACD,OAAO,KAAK,CAAC,kBAAkB,EAAE,CAAC;IAmBpC,CAAC;IAGD,qBAAqB,CAAC,GAAW;QAC/B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC;SACtB;aAAM;YACL,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;SAChD;IACH,CAAC;IAGD,kBAAkB,CAAC,UAAkB;QACnC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC;SAC7B;aAAM;YACL,IAAI,CAAC,SAAS,IAAI,UAAU,CAAC;SAC9B;IACH,CAAC;CAWF;AAED,SAAS,KAAK,CAAC,KAAY,EAAE,UAAmB;IAC9C,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE;QACxE,OAAO;KACR;IAED,IAAI,KAAK,CAAC,WAAW,IAAI,CAAC,UAAU,EAAE;QACpC,OAAO;KACR;IACD,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AAC5C,CAAC","file":"group.js","sourcesContent":["import type { IGraphic, IColor, IRect, INode, IGroupGraphicAttribute, ISetAttributeContext } from './../../vrender';\nimport { Group as VRenderGroup } from './../../vrender';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { InteractionState } from '../../ts-types';\nimport { isNumber, type AABBBounds } from '@visactor/vutils';\n\nexport class Group extends VRenderGroup {\n role?: string;\n col?: number;\n row?: number;\n mergeStartCol?: number;\n mergeStartRow?: number;\n mergeEndCol?: number;\n mergeEndRow?: number;\n contentWidth?: number;\n contentHeight?: number;\n rowNumber?: number; // row number of the column group\n colHeight?: number; // current height of the column group\n border?: IRect; // table/header/body的border mark,挂载在这里方便更新\n needUpdate?: boolean;\n\n needUpdateWidth?: boolean;\n needUpdateHeight?: boolean;\n\n // changes for size align for fs\n // constructor(attribute?: IGroupGraphicAttribute) {\n // dealWidthSize(attribute, attribute);\n // super(attribute);\n // }\n\n // setAttribute(key: string, value: any, forceUpdateTag?: boolean, context?: ISetAttributeContext): void {\n // if (key === 'x' || key === 'y' || key === 'width' || key === 'height') {\n // this.attribute[`old${key}`];\n // }\n // const values = {\n // [key]: value\n // };\n // this.setAttributes(values, forceUpdateTag, context);\n // }\n\n // setAttributes(\n // params: Partial<IGroupGraphicAttribute>,\n // forceUpdateTag?: boolean,\n // context?: ISetAttributeContext\n // ): void {\n // dealWidthSize(params, this.attribute);\n // super.setAttributes(params, forceUpdateTag, context);\n // }\n\n /**\n * @description: 清空Group下全部子元素\n * @return {*}\n */\n clear() {\n this.removeAllChild();\n }\n\n getChildByName(name: string, deep?: boolean): any {\n // for (let i = 0, j = this.children.length; i < j; i++) {\n // if (this.children[i].name === name) {\n // return this.children[i] as unknown as T;\n // }\n // }\n let result = null;\n this.forEachChildren((child: IGraphic) => {\n if (child.name === name) {\n result = child;\n return true; // 提前退出循环\n }\n return false;\n });\n\n if (deep) {\n // for (let i = 0, j = this.children.length; i < j; i++) {\n // const child = this.children[i] as Group;\n\n // if (!child.getChildByName) {\n // continue;\n // }\n\n // const target = child.getChildByName(name, true);\n\n // if (target) {\n // return target;\n // }\n // }\n this.forEachChildren((child: IGraphic) => {\n if ((child as Group).getChildByName) {\n const target = (child as Group).getChildByName(name, true);\n if (target) {\n result = target;\n return true;\n }\n }\n return false;\n });\n }\n\n return result;\n }\n\n get width() {\n let width = this.AABBBounds.width();\n if (width === Infinity || width === -Infinity) {\n width = 0;\n }\n return Math.max(width, this.attribute.width ?? 0);\n }\n\n get height() {\n let height = this.AABBBounds.height();\n if (height === Infinity || height === -Infinity) {\n height = 0;\n }\n return Math.max(height, this.attribute.height ?? 0);\n }\n\n setDeltaWidth(deltaX: number) {\n if (deltaX === 0) {\n return;\n }\n this.setAttribute('width', (this.attribute.width ?? 0) + deltaX);\n if (this.border) {\n this.border.setAttribute('width', this.border.attribute.width + deltaX);\n\n if (this.border.type === 'group') {\n (this.border.firstChild as IRect).setAttribute(\n 'width',\n (this.border.firstChild as IRect).attribute.width + deltaX\n );\n }\n }\n }\n\n setDeltaHeight(deltaY: number) {\n if (deltaY === 0) {\n return;\n }\n this.setAttribute('height', (this.attribute.height ?? 0) + deltaY);\n if (this.border) {\n this.border.setAttribute('height', this.border.attribute.height + deltaY);\n if (this.border.type === 'group') {\n (this.border.firstChild as IRect).setAttribute(\n 'width',\n (this.border.firstChild as IRect).attribute.height + deltaY\n );\n }\n }\n }\n\n setDeltaX(deltaX: number) {\n if (deltaX === 0) {\n return;\n }\n this.setAttribute('x', this.attribute.x + deltaX);\n }\n\n setDeltaY(deltaY: number) {\n if (deltaY === 0) {\n return;\n }\n this.setAttribute('y', this.attribute.y + deltaY);\n }\n\n /**\n * @description: 遍历所有子节点,跳过部分节点,默认跳过group的border\n * @return {*}\n */\n forEachChildrenSkipChild<T extends INode = INode>(\n cb: (item: T, index: number) => void | boolean,\n skipChildName = 'border-rect',\n reverse = false\n ) {\n if (reverse) {\n let child = this._lastChild;\n let i = 0;\n while (child) {\n if (child.name !== skipChildName) {\n const breakTag = cb(child as T, i++);\n if (breakTag) {\n return;\n }\n }\n child = child._prev;\n }\n } else {\n let child = this._firstChild;\n let i = 0;\n while (child) {\n if (child.name !== skipChildName) {\n const breakTag = cb(child as T, i++);\n if (breakTag) {\n return;\n }\n }\n child = child._next;\n }\n }\n }\n\n getColGroup(col: number) {\n let c = this._firstChild as Group;\n if (!c) {\n return null;\n }\n for (let i = 0; i < this.childrenCount; i++) {\n if (c.col === col) {\n return c;\n }\n c = c._next as Group;\n }\n return null;\n }\n\n getRowGroup(row: number) {\n let c = this._firstChild as Group;\n if (!c) {\n return null;\n }\n for (let i = 0; i < this.childrenCount; i++) {\n if (c.row === row) {\n return c;\n }\n c = c._next as Group;\n }\n return null;\n }\n\n addCellGroup(cellGroup: Group) {\n if (this.childrenCount === 0 || (this.lastChild as Group).row === cellGroup.row - 1) {\n this.addChild(cellGroup);\n } else {\n // for promise cell row order in column\n let c = this._firstChild as Group;\n for (let i = 0; i < this.childrenCount; i++) {\n if (c.row === cellGroup.row - 1) {\n this.insertAfter(cellGroup, c);\n return;\n }\n c = c._next as Group;\n }\n this.addChild(cellGroup);\n }\n }\n\n getChildAt(index: number) {\n const child = super.getChildAt(index);\n if (child && child.name === 'border-rect') {\n return child._next;\n }\n return child;\n }\n\n protected tryUpdateAABBBounds(): AABBBounds {\n if (this.role === 'cell') {\n if (!this.shouldUpdateAABBBounds()) {\n return this._AABBBounds as AABBBounds;\n }\n // application.graphicService.beforeUpdateAABBBounds(this, this.stage, true, this._AABBBounds);\n const selfChange = this.shouldSelfChangeUpdateAABBBounds();\n // const selfChange = true;\n const bounds = this.doUpdateAABBBounds();\n this.addUpdateLayoutTag();\n // application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange);\n after(this, selfChange);\n\n return bounds;\n }\n return super.tryUpdateAABBBounds() as AABBBounds;\n }\n\n // 目前优化方案会导致合并单元格无法正常更新列宽(因为合并单元格更新bounds不会触发父节点bounds更新),暂时关闭优化方案\n // shouldUpdateAABBBoundsForRowMerge(): boolean {\n\n // }\n\n // shouldUpdateAABBBounds(): boolean {\n // return this.shouldSelfChangeUpdateAABBBounds();\n // // // 检索自己是否需要更新\n // // if (super.shouldUpdateAABBBounds()) {\n // // return true;\n // // }\n // // // 检索叶子节点是否有更新(如果children是叶子节点的话)\n // // if (this._childUpdateTag & UpdateTag.UPDATE_BOUNDS) {\n // // return true;\n // // }\n // // // 检索是否子group需要更新\n // // let needUpdate = false;\n // // this.forEachChildren((node: IGraphic) => {\n // // // 只查找group层级\n // // if (node.isContainer && (node as Group).shouldUpdateAABBBounds()) {\n // // needUpdate = true;\n // // return true;\n // // }\n // // return false;\n // // });\n // // return needUpdate;\n // }\n\n protected doUpdateAABBBounds(): any {\n // const groupTheme = getTheme(this).group;\n // debugger;\n if (this.role === 'cell') {\n const attribute = this.attribute;\n const { x, y, width, height } = attribute;\n this._AABBBounds.setValue(x, y, x + width, y + height);\n // 更新bounds之后需要设置父节点,否则tag丢失\n this.parent && this.parent.addChildUpdateBoundTag();\n this.clearUpdateBoundTag();\n if (this.shadowRoot) {\n // this.shadowRoot.clearUpdateBoundTag();\n this.shadowRoot.tryUpdateAABBBounds();\n }\n return this._AABBBounds;\n } else if (\n this.role === 'body' ||\n this.role === 'row-header' ||\n this.role === 'col-header' ||\n this.role === 'right-frozen' ||\n this.role === 'bottom-frozen' ||\n this.role === 'corner-header' ||\n this.role === 'corner-right-top-header' ||\n this.role === 'corner-right-bottom-header' ||\n this.role === 'corner-left-bottom-header'\n ) {\n // Infinity bounds for manual clip group\n this._AABBBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n // 更新bounds之后需要设置父节点,否则tag丢失\n this.parent && this.parent.addChildUpdateBoundTag();\n this.clearUpdateBoundTag();\n\n if (this.shadowRoot) {\n // this.shadowRoot.clearUpdateBoundTag();\n this.shadowRoot.tryUpdateAABBBounds();\n }\n return this._AABBBounds;\n }\n return super.doUpdateAABBBounds();\n // _AABBBounds\n // const bounds = graphicService.updateGroupAABBBounds(\n // attribute,\n // getTheme(this).group,\n // this._AABBBounds,\n // this\n // ) as AABBBounds;\n\n // const { boundsPadding = groupTheme.boundsPadding } = attribute;\n // const paddingArray = parsePadding(boundsPadding);\n // if (paddingArray) {\n // bounds.expand(paddingArray);\n // }\n // // 更新bounds之后需要设置父节点,否则tag丢失\n // this.parent && this.parent.addChildUpdateBoundTag();\n // this.clearUpdateBoundTag();\n\n // this.emit('AAABBBoundsChange');\n }\n\n // update column group row number\n updateColumnRowNumber(row: number) {\n if (!this.rowNumber) {\n this.rowNumber = row;\n } else {\n this.rowNumber = Math.max(this.rowNumber, row);\n }\n }\n\n // update column height\n updateColumnHeight(cellHeight: number) {\n if (!this.colHeight) {\n this.colHeight = cellHeight;\n } else {\n this.colHeight += cellHeight;\n }\n }\n\n // doUpdateLocalMatrix() {\n // const oldX = this.attribute.x;\n // const oldY = this.attribute.y;\n // this.attribute.x = Math.floor(this.attribute.x);\n // this.attribute.y = Math.floor(this.attribute.y);\n // super.doUpdateLocalMatrix();\n // this.attribute.x = oldX;\n // this.attribute.y = oldY;\n // }\n}\n\nfunction after(group: Group, selfChange: boolean) {\n if (!group.stage || !group.stage.dirtyBounds || !group.stage.renderCount) {\n return;\n }\n // group的子元素导致的bounds更新不用做dirtyBounds\n if (group.isContainer && !selfChange) {\n return;\n }\n group.stage.dirty(group.globalAABBBounds);\n}\n\n// function dealWidthSize(values: any, attributes: any) {\n// const x = values.x ?? attributes.oldx ?? attributes.x ?? 0 + values.dx ?? attributes.dx ?? 0;\n// const y = values.y ?? attributes.oldy ?? attributes.y ?? 0 + values.dy ?? attributes.dy ?? 0;\n// const width = values.width ?? attributes.oldwidth ?? attributes.width ?? 0;\n// const height = values.height ?? attributes.oldheight ?? attributes.height ?? 0;\n// isNumber(values.width) && (values.oldwidth = values.width);\n// isNumber(values.height) && (values.oldheight = values.height);\n// isNumber(values.x) && (values.oldx = values.x);\n// isNumber(values.y) && (values.oldy = values.y);\n\n// if (Math.floor(x + width) > Math.floor(width) + Math.floor(x)) {\n// values.width = Math.ceil(width);\n// } else {\n// values.width = Math.floor(width);\n// }\n\n// if (Math.floor(y + height) > Math.floor(height) + Math.floor(y)) {\n// values.height = Math.ceil(height);\n// } else {\n// values.height = Math.floor(height);\n// }\n// isNumber(values.x) && (values.x = Math.floor(values.x));\n// isNumber(values.y) && (values.y = Math.floor(values.y));\n// }\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { IImageGraphicAttribute } from './../../vrender';
|
|
1
|
+
import type { IImageGraphicAttribute, ISetAttributeContext } from './../../vrender';
|
|
2
2
|
import { Image } from './../../vrender';
|
|
3
3
|
import type { IIconBase } from '../../ts-types';
|
|
4
|
+
import type { ParsedFrame } from 'gifuct-js';
|
|
4
5
|
export interface IIconGraphicAttribute extends IImageGraphicAttribute {
|
|
5
6
|
backgroundWidth?: number;
|
|
6
7
|
backgroundHeight?: number;
|
|
@@ -18,7 +19,23 @@ export declare class Icon extends Image {
|
|
|
18
19
|
attribute: IIconGraphicAttribute;
|
|
19
20
|
role?: string;
|
|
20
21
|
tooltip?: IIconBase['tooltip'];
|
|
22
|
+
frameImageData?: ImageData;
|
|
23
|
+
tempCanvas?: HTMLCanvasElement;
|
|
24
|
+
tempCtx?: CanvasRenderingContext2D;
|
|
25
|
+
gifCanvas?: HTMLCanvasElement;
|
|
26
|
+
gifCtx?: CanvasRenderingContext2D;
|
|
27
|
+
loadedFrames?: ParsedFrame[];
|
|
28
|
+
frameIndex?: number;
|
|
29
|
+
playing?: boolean;
|
|
30
|
+
lastTime?: number;
|
|
21
31
|
constructor(params: IIconGraphicAttribute);
|
|
32
|
+
loadGif(): void;
|
|
22
33
|
get backgroundWidth(): number;
|
|
23
34
|
get backgroundHeight(): number;
|
|
35
|
+
renderGIF(frames: ParsedFrame[]): void;
|
|
36
|
+
renderFrame(context: CanvasRenderingContext2D, x: number, y: number): void;
|
|
37
|
+
drawPatch(frame: ParsedFrame): void;
|
|
38
|
+
manipulate(context: CanvasRenderingContext2D, x: number, y: number): void;
|
|
39
|
+
setAttribute(key: string, value: any, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
|
|
40
|
+
setAttributes(params: Partial<IIconGraphicAttribute>, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
|
|
24
41
|
}
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import { Image } from "./../../vrender";
|
|
1
|
+
import { Image, ResourceLoader } from "./../../vrender";
|
|
2
|
+
|
|
3
|
+
import { decompressFrames, parseGIF } from "gifuct-js";
|
|
2
4
|
|
|
3
5
|
export class Icon extends Image {
|
|
4
6
|
constructor(params) {
|
|
5
7
|
super(params), "mouseenter_cell" !== this.attribute.visibleTime && "click_cell" !== this.attribute.visibleTime || (this.attribute.opacity = 0),
|
|
6
|
-
this.attribute.hoverImage && (this.attribute.originImage = this.attribute.image)
|
|
8
|
+
this.attribute.hoverImage && (this.attribute.originImage = this.attribute.image),
|
|
9
|
+
this.attribute.isGif && this.attribute.gif && this.loadGif();
|
|
10
|
+
}
|
|
11
|
+
loadGif() {
|
|
12
|
+
this.playing = !1, ResourceLoader.GetFile(this.attribute.gif, "arrayBuffer").then((res => {
|
|
13
|
+
const gif = parseGIF(res), frames = decompressFrames(gif, !0);
|
|
14
|
+
this.renderGIF(frames), this.resources.set(this.attribute.image, {
|
|
15
|
+
state: "success",
|
|
16
|
+
data: this.gifCanvas
|
|
17
|
+
});
|
|
18
|
+
})).catch((e => {}));
|
|
7
19
|
}
|
|
8
20
|
get backgroundWidth() {
|
|
9
21
|
var _a, _b;
|
|
@@ -13,5 +25,36 @@ export class Icon extends Image {
|
|
|
13
25
|
var _a, _b;
|
|
14
26
|
return null !== (_b = null !== (_a = this.attribute.backgroundHeight) && void 0 !== _a ? _a : this.attribute.height) && void 0 !== _b ? _b : 0;
|
|
15
27
|
}
|
|
28
|
+
renderGIF(frames) {
|
|
29
|
+
this.loadedFrames = frames, this.frameIndex = 0, this.tempCanvas || (this.tempCanvas = document.createElement("canvas"),
|
|
30
|
+
this.tempCtx = this.tempCanvas.getContext("2d")), this.gifCanvas || (this.gifCanvas = document.createElement("canvas"),
|
|
31
|
+
this.gifCtx = this.gifCanvas.getContext("2d")), this.gifCanvas.width = frames[0].dims.width,
|
|
32
|
+
this.gifCanvas.height = frames[0].dims.height, this.playing = !0, this.lastTime = (new Date).getTime(),
|
|
33
|
+
this.animate().to({}, 1e3, "linear").loop(1 / 0);
|
|
34
|
+
}
|
|
35
|
+
renderFrame(context, x, y) {
|
|
36
|
+
const frame = this.loadedFrames[this.frameIndex || 0];
|
|
37
|
+
2 === frame.disposalType && this.gifCtx.clearRect(0, 0, this.gifCanvas.width, this.gifCanvas.height),
|
|
38
|
+
this.drawPatch(frame), this.manipulate(context, x, y);
|
|
39
|
+
const diff = (new Date).getTime() - this.lastTime;
|
|
40
|
+
frame.delay < diff && (this.frameIndex++, this.lastTime = (new Date).getTime()),
|
|
41
|
+
this.frameIndex >= this.loadedFrames.length && (this.frameIndex = 0);
|
|
42
|
+
}
|
|
43
|
+
drawPatch(frame) {
|
|
44
|
+
const dims = frame.dims;
|
|
45
|
+
this.frameImageData && dims.width === this.frameImageData.width && dims.height === this.frameImageData.height || (this.tempCanvas.width = dims.width,
|
|
46
|
+
this.tempCanvas.height = dims.height, this.frameImageData = this.tempCtx.createImageData(dims.width, dims.height)),
|
|
47
|
+
this.frameImageData.data.set(frame.patch), this.tempCtx.putImageData(this.frameImageData, 0, 0),
|
|
48
|
+
this.gifCtx.drawImage(this.tempCanvas, dims.left, dims.top);
|
|
49
|
+
}
|
|
50
|
+
manipulate(context, x, y) {
|
|
51
|
+
context.drawImage(this.gifCanvas, 0, 0, this.gifCanvas.width, this.gifCanvas.height, x, y, this.attribute.width, this.attribute.height);
|
|
52
|
+
}
|
|
53
|
+
setAttribute(key, value, forceUpdateTag, context) {
|
|
54
|
+
super.setAttribute(key, value, forceUpdateTag, context), "gif" === key && this.loadGif();
|
|
55
|
+
}
|
|
56
|
+
setAttributes(params, forceUpdateTag, context) {
|
|
57
|
+
super.setAttributes(params, forceUpdateTag, context), params.gif && this.loadGif();
|
|
58
|
+
}
|
|
16
59
|
}
|
|
17
60
|
//# sourceMappingURL=icon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/graphic/icon.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAkBxC,MAAM,OAAO,IAAK,SAAQ,KAAK;IAM7B,YAAY,MAA6B;QACvC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,IAAI,IAAI,CAAC,SAAS,CAAC,WAAW,KAAK,iBAAiB,IAAI,IAAI,CAAC,SAAS,CAAC,WAAW,KAAK,YAAY,EAAE;YACnG,IAAI,CAAC,SAAS,CAAC,OAAO,GAAG,CAAC,CAAC;SAC5B;QAED,IAAI,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE;YAC7B,IAAI,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;SACnD;IAMH,CAAC;IAED,IAAI,eAAe;;QACjB,OAAO,MAAA,MAAA,IAAI,CAAC,SAAS,CAAC,eAAe,mCAAI,IAAI,CAAC,SAAS,CAAC,KAAK,mCAAI,CAAC,CAAC;IACrE,CAAC;IAED,IAAI,gBAAgB;;QAClB,OAAO,MAAA,MAAA,IAAI,CAAC,SAAS,CAAC,gBAAgB,mCAAI,IAAI,CAAC,SAAS,CAAC,MAAM,mCAAI,CAAC,CAAC;IACvE,CAAC;CAaF","file":"icon.js","sourcesContent":["import type { IImageGraphicAttribute } from './../../vrender';\nimport { Image } from './../../vrender';\nimport type { IIconBase } from '../../ts-types';\n\nexport interface IIconGraphicAttribute extends IImageGraphicAttribute {\n backgroundWidth?: number;\n backgroundHeight?: number;\n backgroundColor?: string;\n visibleTime?: string;\n funcType?: string;\n hoverImage?: string | HTMLImageElement | HTMLCanvasElement;\n originImage?: string | HTMLImageElement | HTMLCanvasElement;\n // margin?: [number, number, number, number];\n marginLeft?: number;\n marginRight?: number;\n shape?: 'circle' | 'square';\n interactive?: boolean;\n}\n\nexport class Icon extends Image {\n declare attribute: IIconGraphicAttribute;\n role?: string;\n tooltip?: IIconBase['tooltip'];\n\n // eslint-disable-next-line no-useless-constructor\n constructor(params: IIconGraphicAttribute) {\n super(params);\n\n if (this.attribute.visibleTime === 'mouseenter_cell' || this.attribute.visibleTime === 'click_cell') {\n this.attribute.opacity = 0;\n }\n\n if (this.attribute.hoverImage) {\n this.attribute.originImage = this.attribute.image;\n }\n\n // if (this.attribute.margin) {\n // this.attribute.boundsPadding = this.attribute.margin;\n // this.attribute.dx = this.attribute.margin[3] ?? 0;\n // }\n }\n\n get backgroundWidth(): number {\n return this.attribute.backgroundWidth ?? this.attribute.width ?? 0;\n }\n\n get backgroundHeight(): number {\n return this.attribute.backgroundHeight ?? this.attribute.height ?? 0;\n }\n\n // protected tryUpdateAABBBounds() {\n // super.tryUpdateAABBBounds();\n // // 扩大范围\n // const { width, height } = this.attribute;\n // const { backgroundWidth = width, backgroundHeight = height } = this.attribute;\n // const expandX = (backgroundWidth - width) / 2;\n // const expandY = (backgroundHeight - height) / 2;\n // this._AABBBounds.expand([expandY, expandX, expandY, expandX]);\n\n // return this._AABBBounds;\n // }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/graphic/icon.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGxD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAiBvD,MAAM,OAAO,IAAK,SAAQ,KAAK;IAe7B,YAAY,MAA6B;QACvC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,IAAI,IAAI,CAAC,SAAS,CAAC,WAAW,KAAK,iBAAiB,IAAI,IAAI,CAAC,SAAS,CAAC,WAAW,KAAK,YAAY,EAAE;YACnG,IAAI,CAAC,SAAS,CAAC,OAAO,GAAG,CAAC,CAAC;SAC5B;QAED,IAAI,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE;YAC7B,IAAI,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;SACnD;QAED,IAAK,IAAI,CAAC,SAAiB,CAAC,KAAK,IAAK,IAAI,CAAC,SAAiB,CAAC,GAAG,EAAE;YAChE,IAAI,CAAC,OAAO,EAAE,CAAC;SAChB;IAMH,CAAC;IAED,OAAO;QACL,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;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I,CAAC,SAAS,CAAC,MAAM,EACrB,CAAC,EACD,CAAC,EACD,IAAI,CAAC,SAAS,CAAC,KAAK,EACpB,IAAI,CAAC,SAAS,CAAC,MAAM,CACtB,CAAC;IACJ,CAAC;IAED,YAAY,CAAC,GAAW,EAAE,KAAU,EAAE,cAAwB,EAAE,OAA8B;QAC5F,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;QACxD,IAAI,GAAG,KAAK,KAAK,EAAE;YACjB,IAAI,CAAC,OAAO,EAAE,CAAC;SAChB;IACH,CAAC;IAED,aAAa,CACX,MAAsC,EACtC,cAAwB,EACxB,OAA8B;QAE9B,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;QACrD,IAAK,MAAc,CAAC,GAAG,EAAE;YACvB,IAAI,CAAC,OAAO,EAAE,CAAC;SAChB;IACH,CAAC;CACF","file":"icon.js","sourcesContent":["import type { IImageGraphicAttribute, ISetAttributeContext } from './../../vrender';\nimport { Image, ResourceLoader } from './../../vrender';\nimport type { IIconBase } from '../../ts-types';\nimport type { ParsedFrame } from 'gifuct-js';\nimport { decompressFrames, parseGIF } from 'gifuct-js';\n\nexport interface IIconGraphicAttribute extends IImageGraphicAttribute {\n backgroundWidth?: number;\n backgroundHeight?: number;\n backgroundColor?: string;\n visibleTime?: string;\n funcType?: string;\n hoverImage?: string | HTMLImageElement | HTMLCanvasElement;\n originImage?: string | HTMLImageElement | HTMLCanvasElement;\n // margin?: [number, number, number, number];\n marginLeft?: number;\n marginRight?: number;\n shape?: 'circle' | 'square';\n interactive?: boolean;\n}\n\nexport class Icon extends Image {\n declare attribute: IIconGraphicAttribute;\n role?: string;\n tooltip?: IIconBase['tooltip'];\n frameImageData?: ImageData;\n tempCanvas?: HTMLCanvasElement;\n tempCtx?: CanvasRenderingContext2D;\n gifCanvas?: HTMLCanvasElement;\n gifCtx?: CanvasRenderingContext2D;\n loadedFrames?: ParsedFrame[];\n frameIndex?: number;\n playing?: boolean;\n lastTime?: number;\n\n // eslint-disable-next-line no-useless-constructor\n constructor(params: IIconGraphicAttribute) {\n super(params);\n\n if (this.attribute.visibleTime === 'mouseenter_cell' || this.attribute.visibleTime === 'click_cell') {\n this.attribute.opacity = 0;\n }\n\n if (this.attribute.hoverImage) {\n this.attribute.originImage = this.attribute.image;\n }\n\n if ((this.attribute as any).isGif && (this.attribute as any).gif) {\n this.loadGif();\n }\n\n // if (this.attribute.margin) {\n // this.attribute.boundsPadding = this.attribute.margin;\n // this.attribute.dx = this.attribute.margin[3] ?? 0;\n // }\n }\n\n loadGif() {\n this.playing = false;\n ResourceLoader.GetFile((this.attribute as any).gif, 'arrayBuffer')\n .then((res: ArrayBuffer) => {\n const gif = parseGIF(res);\n const frames = decompressFrames(gif, true);\n this.renderGIF(frames);\n\n // hack for image resource\n (this as any).resources.set((this.attribute as any).image, {\n state: 'success',\n data: this.gifCanvas\n });\n })\n .catch((e: any) => {\n console.error('Gif load error: ', e);\n });\n }\n\n get backgroundWidth(): number {\n return this.attribute.backgroundWidth ?? this.attribute.width ?? 0;\n }\n\n get backgroundHeight(): number {\n return this.attribute.backgroundHeight ?? this.attribute.height ?? 0;\n }\n\n // protected tryUpdateAABBBounds() {\n // super.tryUpdateAABBBounds();\n // // 扩大范围\n // const { width, height } = this.attribute;\n // const { backgroundWidth = width, backgroundHeight = height } = this.attribute;\n // const expandX = (backgroundWidth - width) / 2;\n // const expandY = (backgroundHeight - height) / 2;\n // this._AABBBounds.expand([expandY, expandX, expandY, expandX]);\n\n // return this._AABBBounds;\n // }\n\n renderGIF(frames: ParsedFrame[]) {\n this.loadedFrames = frames;\n this.frameIndex = 0;\n\n if (!this.tempCanvas) {\n this.tempCanvas = document.createElement('canvas');\n this.tempCtx = this.tempCanvas.getContext('2d');\n }\n\n if (!this.gifCanvas) {\n this.gifCanvas = document.createElement('canvas');\n this.gifCtx = this.gifCanvas.getContext('2d');\n }\n\n this.gifCanvas.width = frames[0].dims.width;\n this.gifCanvas.height = frames[0].dims.height;\n\n this.playing = true;\n this.lastTime = new Date().getTime();\n this.animate().to({}, 1000, 'linear').loop(Infinity);\n }\n\n renderFrame(context: CanvasRenderingContext2D, x: number, y: number) {\n // get the frame\n const frame = this.loadedFrames[this.frameIndex || 0];\n\n if (frame.disposalType === 2) {\n this.gifCtx.clearRect(0, 0, this.gifCanvas.width, this.gifCanvas.height);\n }\n\n // draw the patch\n this.drawPatch(frame);\n\n // perform manipulation\n this.manipulate(context, x, y);\n\n // update the frame index\n // this.frameIndex++;\n const diff = new Date().getTime() - this.lastTime;\n if (frame.delay < diff) {\n // return;\n this.frameIndex++;\n this.lastTime = new Date().getTime();\n }\n if (this.frameIndex >= this.loadedFrames.length) {\n this.frameIndex = 0;\n }\n }\n\n drawPatch(frame: ParsedFrame) {\n const dims = frame.dims;\n\n if (\n !this.frameImageData ||\n dims.width !== this.frameImageData.width ||\n dims.height !== this.frameImageData.height\n ) {\n this.tempCanvas.width = dims.width;\n this.tempCanvas.height = dims.height;\n this.frameImageData = this.tempCtx.createImageData(dims.width, dims.height);\n }\n\n // set the patch data as an override\n this.frameImageData.data.set(frame.patch);\n\n // draw the patch back over the canvas\n this.tempCtx.putImageData(this.frameImageData, 0, 0);\n\n // gifCtx.drawImage(tempCanvas, dims.left, dims.top)\n // this.attribute.image = this.tempCanvas;\n\n this.gifCtx.drawImage(this.tempCanvas, dims.left, dims.top);\n }\n\n manipulate(context: CanvasRenderingContext2D, x: number, y: number) {\n context.drawImage(\n this.gifCanvas,\n 0,\n 0,\n this.gifCanvas.width,\n this.gifCanvas.height,\n x,\n y,\n this.attribute.width,\n this.attribute.height\n );\n }\n\n setAttribute(key: string, value: any, forceUpdateTag?: boolean, context?: ISetAttributeContext): void {\n super.setAttribute(key, value, forceUpdateTag, context);\n if (key === 'gif') {\n this.loadGif();\n }\n }\n\n setAttributes(\n params: Partial<IIconGraphicAttribute>,\n forceUpdateTag?: boolean,\n context?: ISetAttributeContext\n ): void {\n super.setAttributes(params, forceUpdateTag, context);\n if ((params as any).gif) {\n this.loadGif();\n }\n }\n}\n"]}
|
|
@@ -22,6 +22,8 @@ import { isArray } from "@visactor/vutils";
|
|
|
22
22
|
|
|
23
23
|
import { breakString } from "../utils/break-string";
|
|
24
24
|
|
|
25
|
+
import { onBeforeAttributeUpdateForInvertHighlight } from "../../plugins/invert-highlight";
|
|
26
|
+
|
|
25
27
|
export function createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult) {
|
|
26
28
|
var _a, _b;
|
|
27
29
|
let cellGroup, isAsync = !1;
|
|
@@ -80,7 +82,8 @@ export function createCell(type, value, define, table, col, row, colWidth, cellW
|
|
|
80
82
|
} else if ("radio" === type) {
|
|
81
83
|
cellGroup = Factory.getFunction("createRadioCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, table, cellTheme, define);
|
|
82
84
|
}
|
|
83
|
-
return cellGroup
|
|
85
|
+
return cellGroup.onBeforeAttributeUpdate = onBeforeAttributeUpdateForInvertHighlight,
|
|
86
|
+
cellGroup;
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
export function updateCell(col, row, table, addNew, isShadow) {
|
|
@@ -221,7 +224,7 @@ export function dealWithMergeCellSize(range, cellWidth, cellHeight, padding, tex
|
|
|
221
224
|
for (let col = range.start.col; col <= range.end.col; col++) for (let row = range.start.row; row <= range.end.row; row++) {
|
|
222
225
|
const cellGroup = table.scenegraph.highPerformanceGetCell(col, row, !0);
|
|
223
226
|
if ("cell" !== cellGroup.role) continue;
|
|
224
|
-
range.start.row !== range.end.row && cellGroup.contentHeight !== cellHeight && updateCellContentHeight(cellGroup, cellHeight, cellHeight, table.isAutoRowHeight(row), padding, textAlign, textBaseline),
|
|
227
|
+
range.start.row !== range.end.row && cellGroup.contentHeight !== cellHeight && updateCellContentHeight(cellGroup, cellHeight, cellHeight, table.isAutoRowHeight(row), padding, textAlign, textBaseline, table),
|
|
225
228
|
range.start.col !== range.end.col && cellGroup.contentWidth !== cellWidth && updateCellContentWidth(cellGroup, cellWidth, cellHeight, 0, table.isAutoRowHeight(row), padding, textAlign, textBaseline, table.scenegraph),
|
|
226
229
|
cellGroup.contentWidth = cellWidth, cellGroup.contentHeight = cellHeight;
|
|
227
230
|
const rangeHeight = table.getRowHeight(row);
|
|
@@ -231,7 +234,7 @@ export function dealWithMergeCellSize(range, cellWidth, cellHeight, padding, tex
|
|
|
231
234
|
|
|
232
235
|
export function dealWithMergeCellSizeForShadow(range, cellWidth, cellHeight, padding, textAlign, textBaseline, table, cellGroup) {
|
|
233
236
|
const {col: col, row: row} = cellGroup;
|
|
234
|
-
range.start.row !== range.end.row && cellGroup.contentHeight !== cellHeight && updateCellContentHeight(cellGroup, cellHeight, cellHeight, table.isAutoRowHeight(row), padding, textAlign, textBaseline),
|
|
237
|
+
range.start.row !== range.end.row && cellGroup.contentHeight !== cellHeight && updateCellContentHeight(cellGroup, cellHeight, cellHeight, table.isAutoRowHeight(row), padding, textAlign, textBaseline, table),
|
|
235
238
|
range.start.col !== range.end.col && cellGroup.contentWidth !== cellWidth && updateCellContentWidth(cellGroup, cellWidth, cellHeight, 0, table.isAutoRowHeight(row), padding, textAlign, textBaseline, table.scenegraph),
|
|
236
239
|
cellGroup.contentWidth = cellWidth, cellGroup.contentHeight = cellHeight;
|
|
237
240
|
const rangeHeight = table.getRowHeight(row);
|