@visactor/vrender-kits 0.21.14 → 0.22.0-vstory.10
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/canvas/contributions/browser/context.js +5 -4
- package/cjs/canvas/contributions/browser/context.js.map +1 -1
- package/cjs/canvas/contributions/harmony/context.js +3 -3
- package/cjs/canvas/contributions/harmony/context.js.map +1 -1
- package/cjs/canvas/contributions/lynx/context.js +4 -10
- package/cjs/canvas/contributions/lynx/context.js.map +1 -1
- package/cjs/canvas/contributions/taro/context.js +3 -2
- package/cjs/canvas/contributions/taro/context.js.map +1 -1
- package/cjs/env/contributions/browser-contribution.d.ts +3 -0
- package/cjs/env/contributions/browser-contribution.js +12 -2
- package/cjs/env/contributions/browser-contribution.js.map +1 -1
- package/cjs/env/contributions/canvas-wrap.js +2 -1
- package/cjs/env/contributions/feishu-contribution.js +1 -3
- package/cjs/env/contributions/feishu-contribution.js.map +1 -1
- package/cjs/env/contributions/tt-contribution.js +2 -2
- package/cjs/env/contributions/tt-contribution.js.map +1 -1
- package/cjs/env/contributions/wx-contribution.js +3 -3
- package/cjs/env/contributions/wx-contribution.js.map +1 -1
- package/cjs/graphic/Lottie.d.ts +49 -0
- package/cjs/graphic/Lottie.js +62 -0
- package/cjs/graphic/Lottie.js.map +1 -0
- package/cjs/graphic/constants.d.ts +1 -1
- package/cjs/graphic/constants.js +2 -3
- package/cjs/graphic/constants.js.map +1 -1
- package/cjs/graphic/interface/lottie.d.ts +10 -0
- package/cjs/{interface/gif-image.js → graphic/interface/lottie.js} +1 -1
- package/cjs/graphic/interface/lottie.js.map +1 -0
- package/cjs/index.d.ts +3 -3
- package/cjs/index.js +11 -11
- package/cjs/index.js.map +1 -1
- package/cjs/jsx/jsx-classic.js +3 -9
- package/cjs/jsx/jsx-classic.js.map +1 -1
- package/cjs/picker/canvas-picker-service.d.ts +3 -2
- package/cjs/picker/canvas-picker-service.js +7 -4
- package/cjs/picker/canvas-picker-service.js.map +1 -1
- package/cjs/picker/contributions/canvas-picker/lottie-module.d.ts +2 -0
- package/cjs/picker/contributions/canvas-picker/lottie-module.js +15 -0
- package/cjs/picker/contributions/canvas-picker/lottie-module.js.map +1 -0
- package/cjs/picker/contributions/canvas-picker/lottie-picker.d.ts +6 -0
- package/cjs/picker/contributions/canvas-picker/lottie-picker.js +30 -0
- package/cjs/picker/contributions/canvas-picker/lottie-picker.js.map +1 -0
- package/cjs/picker/contributions/common/base.d.ts +1 -1
- package/cjs/picker/contributions/common/base.js +0 -1
- package/cjs/picker/contributions/common/base.js.map +1 -1
- package/cjs/picker/contributions/constants.d.ts +1 -1
- package/cjs/picker/contributions/constants.js +3 -3
- package/cjs/picker/contributions/constants.js.map +1 -1
- package/cjs/picker/math-picker-service.d.ts +3 -2
- package/cjs/picker/math-picker-service.js +5 -3
- package/cjs/picker/math-picker-service.js.map +1 -1
- package/cjs/register/register-group.js +2 -1
- package/cjs/register/register-image.js +1 -2
- package/cjs/render/contributions/canvas/{gif-image-module.d.ts → lottie-module.d.ts} +1 -1
- package/cjs/render/contributions/canvas/lottie-module.js +15 -0
- package/cjs/render/contributions/canvas/lottie-module.js.map +1 -0
- package/cjs/render/contributions/canvas/lottie-render.d.ts +9 -0
- package/cjs/render/contributions/canvas/lottie-render.js +40 -0
- package/cjs/render/contributions/canvas/lottie-render.js.map +1 -0
- package/dist/index.es.js +844 -843
- package/es/canvas/contributions/browser/context.js +5 -3
- package/es/canvas/contributions/browser/context.js.map +1 -1
- package/es/canvas/contributions/harmony/context.js +3 -3
- package/es/canvas/contributions/harmony/context.js.map +1 -1
- package/es/canvas/contributions/lynx/context.js +4 -10
- package/es/canvas/contributions/lynx/context.js.map +1 -1
- package/es/canvas/contributions/taro/context.js +3 -2
- package/es/canvas/contributions/taro/context.js.map +1 -1
- package/es/env/contributions/browser-contribution.d.ts +3 -0
- package/es/env/contributions/browser-contribution.js +13 -2
- package/es/env/contributions/browser-contribution.js.map +1 -1
- package/es/env/contributions/canvas-wrap.js +2 -1
- package/es/env/contributions/feishu-contribution.js +1 -3
- package/es/env/contributions/feishu-contribution.js.map +1 -1
- package/es/env/contributions/tt-contribution.js +2 -2
- package/es/env/contributions/tt-contribution.js.map +1 -1
- package/es/env/contributions/wx-contribution.js +3 -3
- package/es/env/contributions/wx-contribution.js.map +1 -1
- package/es/graphic/Lottie.d.ts +49 -0
- package/es/graphic/Lottie.js +53 -0
- package/es/graphic/Lottie.js.map +1 -0
- package/es/graphic/constants.d.ts +1 -1
- package/es/graphic/constants.js +1 -2
- package/es/graphic/constants.js.map +1 -1
- package/es/graphic/interface/lottie.d.ts +10 -0
- package/es/graphic/interface/lottie.js +2 -0
- package/es/graphic/interface/lottie.js.map +1 -0
- package/es/index.d.ts +3 -3
- package/es/index.js +3 -3
- package/es/index.js.map +1 -1
- package/es/jsx/jsx-classic.js +3 -9
- package/es/jsx/jsx-classic.js.map +1 -1
- package/es/picker/canvas-picker-service.d.ts +3 -2
- package/es/picker/canvas-picker-service.js +7 -5
- package/es/picker/canvas-picker-service.js.map +1 -1
- package/es/picker/contributions/canvas-picker/lottie-module.d.ts +2 -0
- package/es/picker/contributions/canvas-picker/lottie-module.js +13 -0
- package/es/picker/contributions/canvas-picker/lottie-module.js.map +1 -0
- package/es/picker/contributions/canvas-picker/lottie-picker.d.ts +6 -0
- package/es/picker/contributions/canvas-picker/lottie-picker.js +26 -0
- package/es/picker/contributions/canvas-picker/lottie-picker.js.map +1 -0
- package/es/picker/contributions/common/base.d.ts +1 -1
- package/es/picker/contributions/common/base.js +0 -1
- package/es/picker/contributions/common/base.js.map +1 -1
- package/es/picker/contributions/constants.d.ts +1 -1
- package/es/picker/contributions/constants.js +2 -2
- package/es/picker/contributions/constants.js.map +1 -1
- package/es/picker/math-picker-service.d.ts +3 -2
- package/es/picker/math-picker-service.js +5 -4
- package/es/picker/math-picker-service.js.map +1 -1
- package/es/register/register-group.js +2 -1
- package/es/register/register-image.js +1 -2
- package/es/render/contributions/canvas/{gif-image-module.d.ts → lottie-module.d.ts} +1 -1
- package/es/render/contributions/canvas/lottie-module.js +11 -0
- package/es/render/contributions/canvas/lottie-module.js.map +1 -0
- package/es/render/contributions/canvas/lottie-render.d.ts +9 -0
- package/es/render/contributions/canvas/lottie-render.js +36 -0
- package/es/render/contributions/canvas/lottie-render.js.map +1 -0
- package/package.json +4 -4
- package/cjs/graphic/gif-image.d.ts +0 -26
- package/cjs/graphic/gif-image.js +0 -63
- package/cjs/graphic/gif-image.js.map +0 -1
- package/cjs/interface/gif-image.d.ts +0 -17
- package/cjs/interface/gif-image.js.map +0 -1
- package/cjs/picker/contributions/canvas-picker/gif-image-module.d.ts +0 -2
- package/cjs/picker/contributions/canvas-picker/gif-image-module.js +0 -15
- package/cjs/picker/contributions/canvas-picker/gif-image-module.js.map +0 -1
- package/cjs/picker/contributions/canvas-picker/gif-image-picker.d.ts +0 -8
- package/cjs/picker/contributions/canvas-picker/gif-image-picker.js +0 -27
- package/cjs/picker/contributions/canvas-picker/gif-image-picker.js.map +0 -1
- package/cjs/render/contributions/canvas/gif-image-module.js +0 -15
- package/cjs/render/contributions/canvas/gif-image-module.js.map +0 -1
- package/cjs/render/contributions/canvas/gif-image-render.d.ts +0 -18
- package/cjs/render/contributions/canvas/gif-image-render.js +0 -63
- package/cjs/render/contributions/canvas/gif-image-render.js.map +0 -1
- package/es/graphic/gif-image.d.ts +0 -26
- package/es/graphic/gif-image.js +0 -61
- package/es/graphic/gif-image.js.map +0 -1
- package/es/interface/gif-image.d.ts +0 -17
- package/es/interface/gif-image.js +0 -2
- package/es/interface/gif-image.js.map +0 -1
- package/es/picker/contributions/canvas-picker/gif-image-module.d.ts +0 -2
- package/es/picker/contributions/canvas-picker/gif-image-module.js +0 -13
- package/es/picker/contributions/canvas-picker/gif-image-module.js.map +0 -1
- package/es/picker/contributions/canvas-picker/gif-image-picker.d.ts +0 -8
- package/es/picker/contributions/canvas-picker/gif-image-picker.js +0 -24
- package/es/picker/contributions/canvas-picker/gif-image-picker.js.map +0 -1
- package/es/render/contributions/canvas/gif-image-module.js +0 -11
- package/es/render/contributions/canvas/gif-image-module.js.map +0 -1
- package/es/render/contributions/canvas/gif-image-render.d.ts +0 -18
- package/es/render/contributions/canvas/gif-image-render.js +0 -59
- package/es/render/contributions/canvas/gif-image-render.js.map +0 -1
package/es/jsx/jsx-classic.js
CHANGED
|
@@ -20,20 +20,14 @@ function flatten(list, out) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export function jsx(type, config, ...children) {
|
|
23
|
-
const _a = config || {}, {key: key, name: name, id: id, attribute: attribute, stateProxy: stateProxy
|
|
23
|
+
const _a = config || {}, {key: key, name: name, id: id, attribute: attribute, stateProxy: stateProxy} = _a, props = __rest(_a, [ "key", "name", "id", "attribute", "stateProxy" ]);
|
|
24
24
|
let c = type;
|
|
25
25
|
isString(type) && (c = graphicCreator[type]);
|
|
26
26
|
const childrenList = [];
|
|
27
27
|
children.length && flatten(1 === children.length ? children[0] : children, childrenList);
|
|
28
28
|
const g = "Group" === c.name ? new c(attribute) : c(config);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const animate = g.animate();
|
|
32
|
-
timeline && animate.setTimeline(timeline), animation.forEach((item => {
|
|
33
|
-
animate[item[0]](...item.slice(1));
|
|
34
|
-
}));
|
|
35
|
-
}
|
|
36
|
-
return g;
|
|
29
|
+
return parseToGraphic(g, childrenList, props), stateProxy && (g.stateProxy = stateProxy),
|
|
30
|
+
g;
|
|
37
31
|
}
|
|
38
32
|
|
|
39
33
|
function parseToGraphic(g, childrenList, props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/jsx/jsx-classic.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,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,CAAC,CAAC,CAAC,CAAC;YACtC,IAAI,EAAE,EAAE;gBACN,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aACpB;QACH,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,IAAI,CAAC,CAAC,IAAI,KAAK,UAAU,EAAE;YACzB,CAAC,CAAC,SAAS,CAAC,UAAU,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;SACxF;KACF;AACH,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC","file":"jsx-classic.js","sourcesContent":["import { isArray, isString } from '@visactor/vutils';\nimport { Group, graphicCreator } from '@visactor/vrender-core';\nimport { REACT_TO_CANOPUS_EVENTS } from './graphicType';\n\nfunction flatten(list: any, out: any[]): void {\n if (isArray(list)) {\n return list.forEach(i => flatten(i, out));\n }\n out.push(list);\n}\n\nexport function jsx(type: string | any, config: Record<string, any>, ...children: any) {\n const { key, name, id, attribute, stateProxy, ...props } = config || {};\n\n let c = type;\n if (isString(type)) {\n c = graphicCreator[type];\n }\n\n const childrenList: any[] = [];\n if (children.length) {\n flatten(children.length === 1 ? children[0] : children, childrenList);\n }\n\n const g = c.name === 'Group' ? new c(attribute) : c(config);\n parseToGraphic(g, childrenList, props);\n\n if (stateProxy) {\n g.stateProxy = stateProxy;\n }\n\n return g;\n}\n\nfunction parseToGraphic(g: any, childrenList: any[], props: any) {\n let isGraphic: boolean = false;\n let out: any;\n switch (g.type) {\n case 'richtext':\n break;\n case 'rich/text':\n out = g.attribute || {};\n childrenList[0] && (out.text = childrenList[0]);\n break;\n case 'rich/image':\n break;\n default:\n isGraphic = true;\n }\n\n if (isGraphic) {\n childrenList.forEach((c: any) => {\n c && g.add(c);\n });\n\n Object.keys(props).forEach(k => {\n const en = REACT_TO_CANOPUS_EVENTS[k];\n if (en) {\n g.on(en, props[k]);\n }\n });\n } else {\n if (g.type === 'richtext') {\n g.attribute.textConfig = childrenList.map(item => item.attribute).filter(item => item);\n }\n }\n}\n\nexport const Fragment = Group;\n"]}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { IMatrix, IPointLike } from '@visactor/vutils';
|
|
2
2
|
import { DefaultPickService } from '@visactor/vrender-core';
|
|
3
|
-
import type { ICanvas, IContext2d, IGraphic, EnvType, IGlobal, IGraphicPicker, IPickerService, IDrawContribution, IContributionProvider, IPickItemInterceptorContribution, IPickParams, PickResult } from '@visactor/vrender-core';
|
|
3
|
+
import type { ICanvas, IContext2d, IGraphic, EnvType, IGlobal, IGraphicPicker, IPickerService, IDrawContribution, IContributionProvider, IPickItemInterceptorContribution, IPickParams, PickResult, IPickServiceInterceptorContribution } from '@visactor/vrender-core';
|
|
4
4
|
export declare class DefaultCanvasPickerService extends DefaultPickService implements IPickerService {
|
|
5
5
|
protected readonly contributions: IContributionProvider<IGraphicPicker>;
|
|
6
6
|
readonly drawContribution: IDrawContribution;
|
|
7
7
|
protected readonly pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>;
|
|
8
|
+
protected readonly pickServiceInterceptorContributions: IContributionProvider<IPickServiceInterceptorContribution>;
|
|
8
9
|
type: 'default';
|
|
9
10
|
pickCanvas: ICanvas;
|
|
10
11
|
pickContext: IContext2d;
|
|
11
12
|
pickerMap: Map<number, IGraphicPicker>;
|
|
12
|
-
constructor(contributions: IContributionProvider<IGraphicPicker>, drawContribution: IDrawContribution, pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>);
|
|
13
|
+
constructor(contributions: IContributionProvider<IGraphicPicker>, drawContribution: IDrawContribution, pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>, pickServiceInterceptorContributions: IContributionProvider<IPickServiceInterceptorContribution>);
|
|
13
14
|
init(): void;
|
|
14
15
|
configure(global: IGlobal, env: EnvType): void;
|
|
15
16
|
pickItem(graphic: IGraphic, point: IPointLike, parentMatrix: IMatrix | null, params: IPickParams): PickResult | null;
|
|
@@ -10,14 +10,16 @@ var __decorate = this && this.__decorate || function(decorators, target, key, de
|
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
import { ContributionProvider, inject, injectable, named, DefaultPickService, DrawContribution, PickItemInterceptor, canvasAllocate } from "@visactor/vrender-core";
|
|
13
|
+
import { ContributionProvider, inject, injectable, named, DefaultPickService, DrawContribution, PickItemInterceptor, canvasAllocate, PickServiceInterceptor } from "@visactor/vrender-core";
|
|
14
14
|
|
|
15
15
|
import { CanvasPickerContribution } from "./contributions/constants";
|
|
16
16
|
|
|
17
17
|
let DefaultCanvasPickerService = class extends DefaultPickService {
|
|
18
|
-
constructor(contributions, drawContribution, pickItemInterceptorContributions) {
|
|
19
|
-
super(pickItemInterceptorContributions), this.contributions = contributions,
|
|
20
|
-
this.
|
|
18
|
+
constructor(contributions, drawContribution, pickItemInterceptorContributions, pickServiceInterceptorContributions) {
|
|
19
|
+
super(pickItemInterceptorContributions, pickServiceInterceptorContributions), this.contributions = contributions,
|
|
20
|
+
this.drawContribution = drawContribution, this.pickItemInterceptorContributions = pickItemInterceptorContributions,
|
|
21
|
+
this.pickServiceInterceptorContributions = pickServiceInterceptorContributions,
|
|
22
|
+
this.global.hooks.onSetEnv.tap("canvas-picker-service", ((_, env, global) => {
|
|
21
23
|
this.configure(global, env);
|
|
22
24
|
})), this.configure(this.global, this.global.env), this.pickerMap = new Map, this.init();
|
|
23
25
|
}
|
|
@@ -60,7 +62,7 @@ let DefaultCanvasPickerService = class extends DefaultPickService {
|
|
|
60
62
|
}
|
|
61
63
|
};
|
|
62
64
|
|
|
63
|
-
DefaultCanvasPickerService = __decorate([ injectable(), __param(0, inject(ContributionProvider)), __param(0, named(CanvasPickerContribution)), __param(1, inject(DrawContribution)), __param(2, inject(ContributionProvider)), __param(2, named(PickItemInterceptor)), __metadata("design:paramtypes", [ Object, Object, Object ]) ], DefaultCanvasPickerService);
|
|
65
|
+
DefaultCanvasPickerService = __decorate([ injectable(), __param(0, inject(ContributionProvider)), __param(0, named(CanvasPickerContribution)), __param(1, inject(DrawContribution)), __param(2, inject(ContributionProvider)), __param(2, named(PickItemInterceptor)), __param(3, inject(ContributionProvider)), __param(3, named(PickServiceInterceptor)), __metadata("design:paramtypes", [ Object, Object, Object, Object ]) ], DefaultCanvasPickerService);
|
|
64
66
|
|
|
65
67
|
export { DefaultCanvasPickerService };
|
|
66
68
|
//# sourceMappingURL=canvas-picker-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/picker/canvas-picker-service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EACL,oBAAoB,EACpB,MAAM,EACN,UAAU,EACV,KAAK,EACL,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,
|
|
1
|
+
{"version":3,"sources":["../src/picker/canvas-picker-service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EACL,oBAAoB,EACpB,MAAM,EACN,UAAU,EACV,KAAK,EACL,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EAEd,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAgBhC,OAAO,EAOL,wBAAwB,EAMzB,MAAM,2BAA2B,CAAC;AAK5B,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,kBAAkB;IAOhE,YAGqB,aAAoD,EAGvD,gBAAmC,EAIhC,gCAAyF,EAIzF,mCAA+F;QAElH,KAAK,CAAC,gCAAgC,EAAE,mCAAmC,CAAC,CAAC;QAb1D,kBAAa,GAAb,aAAa,CAAuC;QAGvD,qBAAgB,GAAhB,gBAAgB,CAAmB;QAIhC,qCAAgC,GAAhC,gCAAgC,CAAyD;QAIzF,wCAAmC,GAAnC,mCAAmC,CAA4D;QAGlH,IAAI,CAAC,MAAM,CAAC,KAAK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IASR,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,wBAAwB,CAAC,CAAA;IAG/B,WAAA,MAAM,CAAC,gBAAgB,CAAC,CAAA;IAGxB,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAG1B,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,sBAAsB,CAAC,CAAA;;GApBrB,0BAA0B,CA+FtC;SA/FY,0BAA0B","file":"canvas-picker-service.js","sourcesContent":["import type { IMatrix, IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line\nimport {\n ContributionProvider,\n inject,\n injectable,\n named,\n DefaultPickService,\n DrawContribution,\n PickItemInterceptor,\n canvasAllocate,\n application,\n PickServiceInterceptor\n} from '@visactor/vrender-core';\nimport type {\n ICanvas,\n IContext2d,\n IGraphic,\n EnvType,\n IGlobal,\n IGraphicPicker,\n IPickerService,\n IDrawContribution,\n IContributionProvider,\n IPickItemInterceptorContribution,\n IPickParams,\n PickResult,\n IPickServiceInterceptorContribution\n} from '@visactor/vrender-core';\nimport {\n CanvasArcPicker,\n CanvasAreaPicker,\n CanvasCirclePicker,\n CanvasImagePicker,\n CanvasLinePicker,\n CanvasPathPicker,\n CanvasPickerContribution,\n CanvasPolygonPicker,\n CanvasRectPicker,\n CanvasSymbolPicker,\n CanvasTextPicker,\n CanvasRichTextPicker\n} from './contributions/constants';\n\n// 默认的pick-service,提供基本的最优选中策略,尽量不需要用户自己实现contribution\n// 用户可以写plugin\n@injectable()\nexport class DefaultCanvasPickerService extends DefaultPickService implements IPickerService {\n declare type: 'default';\n // pcik canvas\n declare pickCanvas: ICanvas;\n declare pickContext: IContext2d;\n declare pickerMap: Map<number, IGraphicPicker>;\n\n constructor(\n @inject(ContributionProvider)\n @named(CanvasPickerContribution)\n protected readonly contributions: IContributionProvider<IGraphicPicker>,\n\n @inject(DrawContribution)\n public readonly drawContribution: IDrawContribution,\n // 拦截器\n @inject(ContributionProvider)\n @named(PickItemInterceptor)\n protected readonly pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>,\n\n @inject(ContributionProvider)\n @named(PickServiceInterceptor)\n protected readonly pickServiceInterceptorContributions: IContributionProvider<IPickServiceInterceptorContribution>\n ) {\n super(pickItemInterceptorContributions, pickServiceInterceptorContributions);\n this.global.hooks.onSetEnv.tap('canvas-picker-service', (_, env, global) => {\n this.configure(global, env);\n });\n this.configure(this.global, this.global.env);\n this.pickerMap = new Map();\n this.init();\n }\n\n init() {\n this.contributions.getContributions().forEach(item => {\n this.pickerMap.set(item.numberType, item);\n });\n super._init();\n }\n\n configure(global: IGlobal, env: EnvType) {\n // if (!this.global.env) return;\n // this.contributions.getContributions().forEach(handlerContribution => {\n // handlerContribution.configure(this, this.global);\n // });\n\n // 创建pick canvas\n this.pickCanvas = canvasAllocate.shareCanvas();\n this.pickContext = this.pickCanvas.getContext('2d');\n }\n\n // todo: switch统一改为数字map\n pickItem(graphic: IGraphic, point: IPointLike, parentMatrix: IMatrix | null, params: IPickParams): PickResult | null {\n if (graphic.attribute.pickable === false) {\n return null;\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.beforePickItem) {\n const ret = drawContribution.beforePickItem(graphic, this, point, params, { parentMatrix });\n if (ret) {\n return ret;\n }\n }\n }\n }\n const picker = this.pickerMap.get(graphic.numberType);\n if (!picker) {\n return null;\n }\n const pd = picker.contains(graphic, point, params);\n const g = pd ? graphic : null;\n\n const data = {\n graphic: g,\n params: pd\n };\n if (g) {\n return data;\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.afterPickItem) {\n const ret = drawContribution.afterPickItem(graphic, this, point, params, { parentMatrix });\n if (ret) {\n return ret;\n }\n }\n }\n }\n return data;\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ContainerModule } from "@visactor/vrender-core";
|
|
2
|
+
|
|
3
|
+
import { CanvasLottiePicker, CanvasPickerContribution } from "../constants";
|
|
4
|
+
|
|
5
|
+
import { DefaultCanvasLottiePicker } from "./lottie-picker";
|
|
6
|
+
|
|
7
|
+
let loadLottiePick = !1;
|
|
8
|
+
|
|
9
|
+
export const lottieCanvasPickModule = new ContainerModule(((bind, unbind, isBound, rebind) => {
|
|
10
|
+
loadLottiePick || (loadLottiePick = !0, bind(CanvasLottiePicker).to(DefaultCanvasLottiePicker).inSingletonScope(),
|
|
11
|
+
bind(CanvasPickerContribution).toService(CanvasLottiePicker));
|
|
12
|
+
}));
|
|
13
|
+
//# sourceMappingURL=lottie-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/picker/contributions/canvas-picker/lottie-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,IAAI,cAAc,GAAG,KAAK,CAAC;AAC3B,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,eAAe,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IAC1F,IAAI,cAAc,EAAE;QAClB,OAAO;KACR;IACD,cAAc,GAAG,IAAI,CAAC;IACtB,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,yBAAyB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC1E,IAAI,CAAC,wBAAwB,CAAC,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;AAC/D,CAAC,CAAC,CAAC","file":"lottie-module.js","sourcesContent":["import { ContainerModule } from '@visactor/vrender-core';\nimport { CanvasLottiePicker, CanvasPickerContribution } from '../constants';\nimport { DefaultCanvasLottiePicker } from './lottie-picker';\n\nlet loadLottiePick = false;\nexport const lottieCanvasPickModule = new ContainerModule((bind, unbind, isBound, rebind) => {\n if (loadLottiePick) {\n return;\n }\n loadLottiePick = true;\n bind(CanvasLottiePicker).to(DefaultCanvasLottiePicker).inSingletonScope();\n bind(CanvasPickerContribution).toService(CanvasLottiePicker);\n});\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IGraphicPicker, IGraphicRender } from '@visactor/vrender-core';
|
|
2
|
+
import { RectPickerBase } from '../common/rect-picker-base';
|
|
3
|
+
export declare class DefaultCanvasLottiePicker extends RectPickerBase implements IGraphicPicker {
|
|
4
|
+
readonly canvasRenderer: IGraphicRender;
|
|
5
|
+
constructor(canvasRenderer: IGraphicRender);
|
|
6
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __decorate = this && this.__decorate || function(decorators, target, key, desc) {
|
|
2
|
+
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
3
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
4
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5
|
+
}, __metadata = this && this.__metadata || function(k, v) {
|
|
6
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
7
|
+
}, __param = this && this.__param || function(paramIndex, decorator) {
|
|
8
|
+
return function(target, key) {
|
|
9
|
+
decorator(target, key, paramIndex);
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
import { inject, injectable, RectRender } from "@visactor/vrender-core";
|
|
14
|
+
|
|
15
|
+
import { RectPickerBase } from "../common/rect-picker-base";
|
|
16
|
+
|
|
17
|
+
let DefaultCanvasLottiePicker = class extends RectPickerBase {
|
|
18
|
+
constructor(canvasRenderer) {
|
|
19
|
+
super(), this.canvasRenderer = canvasRenderer;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
DefaultCanvasLottiePicker = __decorate([ injectable(), __param(0, inject(RectRender)), __metadata("design:paramtypes", [ Object ]) ], DefaultCanvasLottiePicker);
|
|
24
|
+
|
|
25
|
+
export { DefaultCanvasLottiePicker };
|
|
26
|
+
//# sourceMappingURL=lottie-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/picker/contributions/canvas-picker/lottie-picker.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGrD,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,cAAc;IAC3D,YAAgD,cAA8B;QAC5E,KAAK,EAAE,CAAC;QADsC,mBAAc,GAAd,cAAc,CAAgB;IAE9E,CAAC;CACF,CAAA;AAJY,yBAAyB;IADrC,UAAU,EAAE;IAEE,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;;GADpB,yBAAyB,CAIrC;SAJY,yBAAyB","file":"lottie-picker.js","sourcesContent":["import { inject, injectable, RectRender } from '@visactor/vrender-core';\nimport type { IGraphicPicker, IGraphicRender } from '@visactor/vrender-core';\nimport { RectPickerBase } from '../common/rect-picker-base';\n\n@injectable()\nexport class DefaultCanvasLottiePicker extends RectPickerBase implements IGraphicPicker {\n constructor(@inject(RectRender) public readonly canvasRenderer: IGraphicRender) {\n super();\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IPoint } from '@visactor/vutils';
|
|
2
2
|
import type { IPickParams, IGraphicRender, IGraphic } from '@visactor/vrender-core';
|
|
3
3
|
export declare abstract class PickerBase {
|
|
4
|
-
canvasRenderer
|
|
4
|
+
canvasRenderer: IGraphicRender;
|
|
5
5
|
contains(graphic: IGraphic, point: IPoint, params?: IPickParams): boolean;
|
|
6
6
|
}
|
|
@@ -4,7 +4,6 @@ export class PickerBase {
|
|
|
4
4
|
contains(graphic, point, params) {
|
|
5
5
|
if (!graphic.AABBBounds.containsPoint(point)) return !1;
|
|
6
6
|
if ("imprecise" === graphic.attribute.pickMode) return !0;
|
|
7
|
-
if (!this.canvasRenderer) return !0;
|
|
8
7
|
const {pickContext: pickContext} = null != params ? params : {};
|
|
9
8
|
if (!pickContext) return !1;
|
|
10
9
|
const attribute = graphic.getGraphicTheme();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/picker/contributions/common/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAazD,MAAM,OAAgB,UAAU;IAG9B,QAAQ,CAAC,OAAiB,EAAE,KAAa,EAAE,MAAoB;QAC7D,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;YAC5C,OAAO,KAAK,CAAC;SACd;QACD,IAAI,OAAO,CAAC,SAAS,CAAC,QAAQ,KAAK,WAAW,EAAE;YAC9C,OAAO,IAAI,CAAC;SACb;
|
|
1
|
+
{"version":3,"sources":["../src/picker/contributions/common/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAazD,MAAM,OAAgB,UAAU;IAG9B,QAAQ,CAAC,OAAiB,EAAE,KAAa,EAAE,MAAoB;QAC7D,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;YAC5C,OAAO,KAAK,CAAC;SACd;QACD,IAAI,OAAO,CAAC,SA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,EACzD,cAA+B,EAC/B,EAAE;YAEF,IAAI,MAAM,EAAE;gBACV,OAAO,IAAI,CAAC;aACb;YACD,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,IAAI,cAAc,CAAC,SAAS,CAAC;YACrE,MAAM,gBAAgB,GAAG,YAAY,CAAC,gBAAgB,IAAI,cAAc,CAAC,gBAAgB,CAAC;YAC1F,MAAM,eAAe,GAAG,YAAY,CAAC,eAAe,IAAI,cAAc,CAAC,eAAe,CAAC;YACvF,WAAW,CAAC,SAAS,GAAG,eAAe;gBACrC,CAAC,CAAC,SAAS,GAAG,gBAAgB;gBAC9B,CAAC,CAAC,eAAe,CAAC,WAAW,EAAE,SAAS,GAAG,gBAAgB,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;YAChF,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;YACnD,OAAO,MAAM,CAAC;QAChB,CAAC,CACF,CAAC;QAEF,WAAW,CAAC,sBAAsB,EAAE,CAAC;QACrC,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","file":"base.js","sourcesContent":["import { getScaledStroke } from '@visactor/vrender-core';\nimport type { IPoint } from '@visactor/vutils';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IThemeAttribute,\n IPickParams,\n IGraphicRender,\n IGraphic,\n ITransform\n} from '@visactor/vrender-core';\n\nexport abstract class PickerBase {\n canvasRenderer!: IGraphicRender;\n\n contains(graphic: IGraphic, point: IPoint, params?: IPickParams): boolean {\n if (!graphic.AABBBounds.containsPoint(point)) {\n return false;\n }\n if (graphic.attribute.pickMode === 'imprecise') {\n return true;\n }\n\n const { pickContext } = params ?? {};\n if (!pickContext) {\n return false;\n }\n\n const attribute = graphic.getGraphicTheme();\n pickContext.highPerformanceSave();\n let { x = attribute.x, y = attribute.y } = graphic.attribute;\n if (!graphic.transMatrix.onlyTranslate()) {\n // 性能较差\n x = 0;\n y = 0;\n pickContext.transformFromMatrix(graphic.transMatrix, true);\n } else {\n const point = graphic.getOffsetXY(attribute as ITransform);\n x += point.x;\n y += point.y;\n // 当前context有rotate/scale,重置matrix\n pickContext.setTransformForCurrent();\n }\n\n // 详细形状判断\n let picked = false;\n this.canvasRenderer.drawShape(\n graphic,\n pickContext,\n x,\n y,\n {} as any,\n null,\n (\n context: IContext2d,\n arcAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => {\n // 选中后面就不需要再走逻辑了\n if (picked) {\n return true;\n }\n picked = context.isPointInPath(point.x, point.y);\n return picked;\n },\n (\n context: IContext2d,\n arcAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => {\n // 选中后面就不需要再走逻辑了\n if (picked) {\n return true;\n }\n const lineWidth = arcAttribute.lineWidth || themeAttribute.lineWidth;\n const pickStrokeBuffer = arcAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;\n const keepStrokeScale = arcAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;\n pickContext.lineWidth = keepStrokeScale\n ? lineWidth + pickStrokeBuffer\n : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr);\n picked = context.isPointInStroke(point.x, point.y);\n return picked;\n }\n );\n\n pickContext.highPerformanceRestore();\n return picked;\n }\n}\n"]}
|
|
@@ -15,8 +15,8 @@ export declare const CanvasArc3dPicker: unique symbol;
|
|
|
15
15
|
export declare const CanvasAreaPicker: unique symbol;
|
|
16
16
|
export declare const CanvasCirclePicker: unique symbol;
|
|
17
17
|
export declare const CanvasImagePicker: unique symbol;
|
|
18
|
-
export declare const CanvasGifImagePicker: unique symbol;
|
|
19
18
|
export declare const CanvasLinePicker: unique symbol;
|
|
19
|
+
export declare const CanvasLottiePicker: unique symbol;
|
|
20
20
|
export declare const CanvasPathPicker: unique symbol;
|
|
21
21
|
export declare const CanvasRectPicker: unique symbol;
|
|
22
22
|
export declare const CanvasRect3dPicker: unique symbol;
|
|
@@ -32,10 +32,10 @@ export const CanvasCirclePicker = Symbol.for("CanvasCirclePicker");
|
|
|
32
32
|
|
|
33
33
|
export const CanvasImagePicker = Symbol.for("CanvasImagePicker");
|
|
34
34
|
|
|
35
|
-
export const CanvasGifImagePicker = Symbol.for("CanvasGifImagePicker");
|
|
36
|
-
|
|
37
35
|
export const CanvasLinePicker = Symbol.for("CanvasLinePicker");
|
|
38
36
|
|
|
37
|
+
export const CanvasLottiePicker = Symbol.for("CanvasLottiePicker");
|
|
38
|
+
|
|
39
39
|
export const CanvasPathPicker = Symbol.for("CanvasPathPicker");
|
|
40
40
|
|
|
41
41
|
export const CanvasRectPicker = Symbol.for("CanvasRectPicker");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/picker/contributions/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;AAG3E,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AACzD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAC/D,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,gBAAgB,GAAG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MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAC/D,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAC/D,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC","file":"constants.js","sourcesContent":["export const MathPickerContribution = Symbol.for('MathPickerContribution');\n\n// math\nexport const MathArcPicker = Symbol.for('MathArcPicker');\nexport const MathAreaPicker = Symbol.for('MathAreaPicker');\nexport const MathCirclePicker = Symbol.for('MathCirclePicker');\nexport const MathImagePicker = Symbol.for('MathImagePicker');\nexport const MathLinePicker = Symbol.for('MathLinePicker');\nexport const MathPathPicker = Symbol.for('MathPathPicker');\nexport const MathRectPicker = Symbol.for('MathRectPicker');\nexport const MathSymbolPicker = Symbol.for('MathSymbolPicker');\nexport const MathTextPicker = Symbol.for('MathTextPicker');\nexport const MathPolygonPicker = Symbol.for('MathPolygonPicker');\nexport const MathGlyphPicker = Symbol.for('MathGlyphPicker');\n\n// canvas\nexport const CanvasArcPicker = Symbol.for('CanvasArcPicker');\nexport const CanvasArc3dPicker = Symbol.for('CanvasArc3dPicker');\nexport const CanvasAreaPicker = Symbol.for('CanvasAreaPicker');\nexport const CanvasCirclePicker = Symbol.for('CanvasCirclePicker');\nexport const CanvasImagePicker = Symbol.for('CanvasImagePicker');\nexport const CanvasLinePicker = Symbol.for('CanvasLinePicker');\nexport const CanvasLottiePicker = Symbol.for('CanvasLottiePicker');\nexport const CanvasPathPicker = Symbol.for('CanvasPathPicker');\nexport const CanvasRectPicker = Symbol.for('CanvasRectPicker');\nexport const CanvasRect3dPicker = Symbol.for('CanvasRect3dPicker');\nexport const CanvasSymbolPicker = Symbol.for('CanvasSymbolPicker');\nexport const CanvasTextPicker = Symbol.for('CanvasTextPicker');\nexport const CanvasPolygonPicker = Symbol.for('CanvasPolygonPicker');\nexport const CanvasPyramid3dPicker = Symbol.for('CanvasPyramid3dPicker');\nexport const CanvasRichTextPicker = Symbol.for('CanvasRichTextPicker');\nexport const CanvasGlyphPicker = Symbol.for('CanvasGlyphPicker');\nexport const CanvasGroupPicker = Symbol.for('CanvasGroupPicker');\nexport const CanvasPickerContribution = Symbol.for('CanvasPickerContribution');\n"]}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { IMatrix, IPointLike } from '@visactor/vutils';
|
|
2
2
|
import { DefaultPickService } from '@visactor/vrender-core';
|
|
3
|
-
import type { ICanvas, IContext2d, IGraphic, EnvType, IGlobal, IGraphicPicker, IPickerService, IContributionProvider, IPickItemInterceptorContribution, IPickParams, PickResult } from '@visactor/vrender-core';
|
|
3
|
+
import type { ICanvas, IContext2d, IGraphic, EnvType, IGlobal, IGraphicPicker, IPickerService, IContributionProvider, IPickItemInterceptorContribution, IPickParams, PickResult, IPickServiceInterceptorContribution } from '@visactor/vrender-core';
|
|
4
4
|
export declare class DefaultMathPickerService extends DefaultPickService implements IPickerService {
|
|
5
5
|
protected readonly contributions: IContributionProvider<IGraphicPicker>;
|
|
6
6
|
protected readonly pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>;
|
|
7
|
+
protected readonly pickServiceInterceptorContributions: IContributionProvider<IPickServiceInterceptorContribution>;
|
|
7
8
|
type: 'default';
|
|
8
9
|
pickCanvas: ICanvas;
|
|
9
10
|
pickContext: IContext2d;
|
|
10
11
|
pickerMap: Map<number, IGraphicPicker>;
|
|
11
|
-
constructor(contributions: IContributionProvider<IGraphicPicker>, pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>);
|
|
12
|
+
constructor(contributions: IContributionProvider<IGraphicPicker>, pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>, pickServiceInterceptorContributions: IContributionProvider<IPickServiceInterceptorContribution>);
|
|
12
13
|
init(): void;
|
|
13
14
|
configure(global: IGlobal, env: EnvType): void;
|
|
14
15
|
pickItem(graphic: IGraphic, point: IPointLike, parentMatrix: IMatrix | null, params?: IPickParams): PickResult | null;
|
|
@@ -10,13 +10,14 @@ var __decorate = this && this.__decorate || function(decorators, target, key, de
|
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
import { ContributionProvider, inject, injectable, named, DefaultPickService, EmptyContext2d, PickItemInterceptor } from "@visactor/vrender-core";
|
|
13
|
+
import { ContributionProvider, inject, injectable, named, DefaultPickService, EmptyContext2d, PickItemInterceptor, PickServiceInterceptor } from "@visactor/vrender-core";
|
|
14
14
|
|
|
15
15
|
import { MathPickerContribution } from "./contributions/constants";
|
|
16
16
|
|
|
17
17
|
let DefaultMathPickerService = class extends DefaultPickService {
|
|
18
|
-
constructor(contributions, pickItemInterceptorContributions) {
|
|
19
|
-
super(pickItemInterceptorContributions), this.contributions = contributions,
|
|
18
|
+
constructor(contributions, pickItemInterceptorContributions, pickServiceInterceptorContributions) {
|
|
19
|
+
super(pickItemInterceptorContributions, pickServiceInterceptorContributions), this.contributions = contributions,
|
|
20
|
+
this.pickItemInterceptorContributions = pickItemInterceptorContributions, this.pickServiceInterceptorContributions = pickServiceInterceptorContributions,
|
|
20
21
|
this.global.hooks.onSetEnv.tap("math-picker-service", ((lastEnv, env, global) => {
|
|
21
22
|
this.configure(global, env);
|
|
22
23
|
})), this.configure(this.global, this.global.env), this.pickerMap = new Map, this.init();
|
|
@@ -41,7 +42,7 @@ let DefaultMathPickerService = class extends DefaultPickService {
|
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
44
|
|
|
44
|
-
DefaultMathPickerService = __decorate([ injectable(), __param(0, inject(ContributionProvider)), __param(0, named(MathPickerContribution)), __param(1, inject(ContributionProvider)), __param(1, named(PickItemInterceptor)), __metadata("design:paramtypes", [ Object, Object ]) ], DefaultMathPickerService);
|
|
45
|
+
DefaultMathPickerService = __decorate([ injectable(), __param(0, inject(ContributionProvider)), __param(0, named(MathPickerContribution)), __param(1, inject(ContributionProvider)), __param(1, named(PickItemInterceptor)), __param(2, inject(ContributionProvider)), __param(2, named(PickServiceInterceptor)), __metadata("design:paramtypes", [ Object, Object, Object ]) ], DefaultMathPickerService);
|
|
45
46
|
|
|
46
47
|
export { DefaultMathPickerService };
|
|
47
48
|
//# sourceMappingURL=math-picker-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/picker/math-picker-service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EACL,oBAAoB,EACpB,MAAM,EACN,UAAU,EACV,KAAK,EACL,kBAAkB,EAClB,cAAc,EACd,mBAAmB,
|
|
1
|
+
{"version":3,"sources":["../src/picker/math-picker-service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EACL,oBAAoB,EACpB,MAAM,EACN,UAAU,EACV,KAAK,EACL,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAehC,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAK5D,IAAM,w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AI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,IAAI,CAAC;SACb;QACD,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QACnD,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;QAC9B,IAAI,CAAC,EAAE;YACL,OAAO;gBACL,OAAO,EAAE,CAAC;gBACV,MAAM,EAAE,EAAE;aACX,CAAC;SACH;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AA/DY,wBAAwB;IADpC,UAAU,EAAE;IASR,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,sBAAsB,CAAC,CAAA;IAG7B,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAE1B,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,sBAAsB,CAAC,CAAA;;GAhBrB,wBAAwB,CA+DpC;SA/DY,wBAAwB","file":"math-picker-service.js","sourcesContent":["import type { IMatrix, IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line\nimport {\n ContributionProvider,\n inject,\n injectable,\n named,\n DefaultPickService,\n EmptyContext2d,\n PickItemInterceptor,\n PickServiceInterceptor\n} from '@visactor/vrender-core';\nimport type {\n ICanvas,\n IContext2d,\n IGraphic,\n EnvType,\n IGlobal,\n IGraphicPicker,\n IPickerService,\n IContributionProvider,\n IPickItemInterceptorContribution,\n IPickParams,\n PickResult,\n IPickServiceInterceptorContribution\n} from '@visactor/vrender-core';\nimport { MathPickerContribution } from './contributions/constants';\n\n// 默认的pick-service,提供基本的最优选中策略,尽量不需要用户自己实现contribution\n// 用户可以写plugin\n@injectable()\nexport class DefaultMathPickerService extends DefaultPickService implements IPickerService {\n declare type: 'default';\n // pcik canvas\n declare pickCanvas: ICanvas;\n declare pickContext: IContext2d;\n declare pickerMap: Map<number, IGraphicPicker>;\n\n constructor(\n @inject(ContributionProvider)\n @named(MathPickerContribution)\n protected readonly contributions: IContributionProvider<IGraphicPicker>,\n // 拦截器\n @inject(ContributionProvider)\n @named(PickItemInterceptor)\n protected readonly pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>,\n @inject(ContributionProvider)\n @named(PickServiceInterceptor)\n protected readonly pickServiceInterceptorContributions: IContributionProvider<IPickServiceInterceptorContribution>\n ) {\n super(pickItemInterceptorContributions, pickServiceInterceptorContributions);\n this.global.hooks.onSetEnv.tap('math-picker-service', (lastEnv, env, global) => {\n this.configure(global, env);\n });\n this.configure(this.global, this.global.env);\n this.pickerMap = new Map();\n this.init();\n }\n\n init() {\n this.contributions.getContributions().forEach(item => {\n this.pickerMap.set(item.numberType, item);\n });\n super._init();\n }\n\n configure(global: IGlobal, env: EnvType) {\n this.pickContext = new EmptyContext2d(null, 1);\n }\n\n // todo: switch统一改为数字map\n pickItem(\n graphic: IGraphic,\n point: IPointLike,\n parentMatrix: IMatrix | null,\n params?: IPickParams\n ): PickResult | null {\n if (graphic.attribute.pickable === false) {\n return null;\n }\n const picker = this.pickerMap.get(graphic.numberType);\n if (!picker) {\n return null;\n }\n const pd = picker.contains(graphic, point, params);\n const g = pd ? graphic : null;\n if (g) {\n return {\n graphic: g,\n params: pd\n };\n }\n return null;\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ContainerModule } from '@visactor/vrender-core';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const lottieModule: ContainerModule;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ContainerModule, GraphicRender } from "@visactor/vrender-core";
|
|
2
|
+
|
|
3
|
+
import { DefaultCanvasLottieRender } from "./lottie-render";
|
|
4
|
+
|
|
5
|
+
let loadLottieModule = !1;
|
|
6
|
+
|
|
7
|
+
export const lottieModule = new ContainerModule((bind => {
|
|
8
|
+
loadLottieModule || (loadLottieModule = !0, bind(DefaultCanvasLottieRender).toSelf().inSingletonScope(),
|
|
9
|
+
bind(GraphicRender).toService(DefaultCanvasLottieRender));
|
|
10
|
+
}));
|
|
11
|
+
//# sourceMappingURL=lottie-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/canvas/lottie-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,IAAI,gBAAgB,GAAG,KAAK,CAAC;AAC7B,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE;IACrD,IAAI,gBAAgB,EAAE;QACpB,OAAO;KACR;IACD,gBAAgB,GAAG,IAAI,CAAC;IAExB,IAAI,CAAC,yBAAyB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC5D,IAAI,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC;AAC3D,CAAC,CAAC,CAAC","file":"lottie-module.js","sourcesContent":["import { ContainerModule, GraphicRender } from '@visactor/vrender-core';\nimport { DefaultCanvasLottieRender } from './lottie-render';\n\nlet loadLottieModule = false;\nexport const lottieModule = new ContainerModule(bind => {\n if (loadLottieModule) {\n return;\n }\n loadLottieModule = true;\n // lottie渲染器\n bind(DefaultCanvasLottieRender).toSelf().inSingletonScope();\n bind(GraphicRender).toService(DefaultCanvasLottieRender);\n});\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IContext2d, IDrawContext, IGraphicAttribute, IGraphicRender, IGraphicRenderDrawParams, IMarkAttribute, IThemeAttribute } from '@visactor/vrender-core';
|
|
2
|
+
import { DefaultCanvasRectRender } from '@visactor/vrender-core';
|
|
3
|
+
import type { ILottie } from '../../../graphic/interface/lottie';
|
|
4
|
+
export declare class DefaultCanvasLottieRender extends DefaultCanvasRectRender implements IGraphicRender {
|
|
5
|
+
type: 'glyph';
|
|
6
|
+
numberType: number;
|
|
7
|
+
drawShape(lottie: ILottie, context: IContext2d, x: number, y: number, drawContext: IDrawContext, params?: IGraphicRenderDrawParams, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
|
|
8
|
+
_drawShape(lottie: ILottie, context: IContext2d, x: number, y: number, drawContext: IDrawContext, params?: IGraphicRenderDrawParams): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __decorate = this && this.__decorate || function(decorators, target, key, desc) {
|
|
2
|
+
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
3
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
4
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
import { DefaultCanvasRectRender, getTheme, injectable } from "@visactor/vrender-core";
|
|
8
|
+
|
|
9
|
+
import { LOTTIE_NUMBER_TYPE } from "../../../graphic/constants";
|
|
10
|
+
|
|
11
|
+
let DefaultCanvasLottieRender = class extends DefaultCanvasRectRender {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments), this.numberType = LOTTIE_NUMBER_TYPE;
|
|
14
|
+
}
|
|
15
|
+
drawShape(lottie, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
16
|
+
const _fillCb = fillCb || (() => this._drawShape.call(this, lottie, context, x, y, drawContext, params));
|
|
17
|
+
super.drawShape(lottie, context, x, y, drawContext, params, _fillCb, strokeCb);
|
|
18
|
+
}
|
|
19
|
+
_drawShape(lottie, context, x, y, drawContext, params) {
|
|
20
|
+
var _a;
|
|
21
|
+
const lottieAttribute = null !== (_a = this.tempTheme) && void 0 !== _a ? _a : getTheme(lottie, null == params ? void 0 : params.theme).rect, {x: originX = lottieAttribute.x, y: originY = lottieAttribute.y} = lottie.attribute;
|
|
22
|
+
context.setCommonStyle(lottie, lottie.attribute, originX - x, originY - y, lottieAttribute);
|
|
23
|
+
const canvas = lottie.canvas;
|
|
24
|
+
if (canvas) {
|
|
25
|
+
const pattern = context.createPattern(canvas, "no-repeat"), dpr = context.dpr;
|
|
26
|
+
pattern.setTransform && pattern.setTransform(new DOMMatrix([ 1 / dpr, 0, 0, 1 / dpr, x, y ])),
|
|
27
|
+
context.fillStyle = pattern;
|
|
28
|
+
}
|
|
29
|
+
context.fill();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
DefaultCanvasLottieRender = __decorate([ injectable() ], DefaultCanvasLottieRender);
|
|
34
|
+
|
|
35
|
+
export { DefaultCanvasLottieRender };
|
|
36
|
+
//# sourceMappingURL=lottie-render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/canvas/lottie-render.ts"],"names":[],"mappings":";;;;;;AASA,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIzD,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,uBAAuB;IAA/D;;QAEL,eAAU,GAAW,kBAAkB,CAAC;IA8C1C,CAAC;IA5CC,SAAS,CACP,MAAe,EACf,OAAmB,EACnB,CAAS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C,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5F,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC;SAC7B;QACD,OAAO,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC;CACF,CAAA;AAhDY,yBAAyB;IADrC,UAAU,EAAE;GACA,yBAAyB,CAgDrC;SAhDY,yBAAyB","file":"lottie-render.js","sourcesContent":["import type {\n IContext2d,\n IDrawContext,\n IGraphicAttribute,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IMarkAttribute,\n IThemeAttribute\n} from '@visactor/vrender-core';\nimport { DefaultCanvasRectRender, getTheme, injectable } from '@visactor/vrender-core';\nimport { LOTTIE_NUMBER_TYPE } from '../../../graphic/constants';\nimport type { ILottie } from '../../../graphic/interface/lottie';\n\n@injectable()\nexport class DefaultCanvasLottieRender extends DefaultCanvasRectRender implements IGraphicRender {\n type: 'glyph';\n numberType: number = LOTTIE_NUMBER_TYPE;\n\n drawShape(\n lottie: ILottie,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ): void {\n const _fillCb = fillCb || (() => this._drawShape.call(this, lottie, context, x, y, drawContext, params));\n super.drawShape(lottie, context, x, y, drawContext, params, _fillCb, strokeCb);\n }\n\n _drawShape(\n lottie: ILottie,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams\n ): void {\n const lottieAttribute = this.tempTheme ?? getTheme(lottie, params?.theme).rect;\n const { x: originX = lottieAttribute.x, y: originY = lottieAttribute.y } = lottie.attribute;\n context.setCommonStyle(lottie, lottie.attribute, originX - x, originY - y, lottieAttribute);\n // 设置pattern,绘制lottie\n const canvas = lottie.canvas;\n if (canvas) {\n // const _ctx = canvas.getContext('2d');\n const pattern = context.createPattern(canvas, 'no-repeat');\n const dpr = context.dpr;\n pattern.setTransform && pattern.setTransform(new DOMMatrix([1 / dpr, 0, 0, 1 / dpr, x, y]));\n context.fillStyle = pattern;\n }\n context.fill();\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vrender-kits",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0-vstory.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "cjs/index.js",
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@visactor/vutils": "~0.19.
|
|
16
|
-
"@visactor/vrender-core": "0.
|
|
15
|
+
"@visactor/vutils": "~0.19.3",
|
|
16
|
+
"@visactor/vrender-core": "0.22.0-vstory.10",
|
|
17
17
|
"@resvg/resvg-js": "2.4.1",
|
|
18
18
|
"roughjs": "4.5.2",
|
|
19
|
-
"
|
|
19
|
+
"lottie-web": "^5.12.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@rushstack/eslint-patch": "~1.1.4",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ISetAttributeContext } from '@visactor/vrender-core';
|
|
2
|
-
import { Image } from '@visactor/vrender-core';
|
|
3
|
-
import type { ParsedFrame } from 'gifuct-js';
|
|
4
|
-
import type { IGifImage, IGifImageGraphicAttribute } from '../interface/gif-image';
|
|
5
|
-
export declare class GifImage extends Image implements IGifImage {
|
|
6
|
-
type: any;
|
|
7
|
-
attribute: IGifImageGraphicAttribute;
|
|
8
|
-
frameImageData?: ImageData;
|
|
9
|
-
tempCanvas?: HTMLCanvasElement;
|
|
10
|
-
tempCtx?: CanvasRenderingContext2D;
|
|
11
|
-
gifCanvas?: HTMLCanvasElement;
|
|
12
|
-
gifCtx?: CanvasRenderingContext2D;
|
|
13
|
-
loadedFrames?: ParsedFrame[];
|
|
14
|
-
frameIndex?: number;
|
|
15
|
-
playing?: boolean;
|
|
16
|
-
lastTime?: number;
|
|
17
|
-
constructor(params: IGifImageGraphicAttribute);
|
|
18
|
-
loadGif(): void;
|
|
19
|
-
renderGIF(frames: ParsedFrame[]): void;
|
|
20
|
-
renderFrame(context: CanvasRenderingContext2D, x: number, y: number): void;
|
|
21
|
-
drawPatch(frame: ParsedFrame): void;
|
|
22
|
-
manipulate(context: CanvasRenderingContext2D, x: number, y: number): void;
|
|
23
|
-
setAttribute(key: string, value: any, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
|
|
24
|
-
setAttributes(params: Partial<IGifImageGraphicAttribute>, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
|
|
25
|
-
}
|
|
26
|
-
export declare function createGifImage(attributes: IGifImageGraphicAttribute): IGifImage;
|
package/cjs/graphic/gif-image.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: !0
|
|
5
|
-
}), exports.createGifImage = exports.GifImage = void 0;
|
|
6
|
-
|
|
7
|
-
const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils"), gifuct_js_1 = require("gifuct-js"), constants_1 = require("./constants");
|
|
8
|
-
|
|
9
|
-
class GifImage extends vrender_core_1.Image {
|
|
10
|
-
constructor(params) {
|
|
11
|
-
super(params), this.type = "gif-image", this.numberType = constants_1.GIFIMAGE_NUMBER_TYPE,
|
|
12
|
-
this.loadGif();
|
|
13
|
-
}
|
|
14
|
-
loadGif() {
|
|
15
|
-
if ((0, vutils_1.isString)(this.attribute.gifImage)) vrender_core_1.ResourceLoader.GetFile(this.attribute.gifImage, "arrayBuffer").then((res => {
|
|
16
|
-
const gif = (0, gifuct_js_1.parseGIF)(res), frames = (0, gifuct_js_1.decompressFrames)(gif, !0);
|
|
17
|
-
this.renderGIF(frames);
|
|
18
|
-
})).catch((e => {
|
|
19
|
-
console.error("Gif load error: ", e);
|
|
20
|
-
})); else if (this.attribute.gifImage instanceof ArrayBuffer) {
|
|
21
|
-
const gif = (0, gifuct_js_1.parseGIF)(this.attribute.gifImage), frames = (0, gifuct_js_1.decompressFrames)(gif, !0);
|
|
22
|
-
this.renderGIF(frames);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
renderGIF(frames) {
|
|
26
|
-
this.loadedFrames = frames, this.frameIndex = 0, this.tempCanvas || (this.tempCanvas = vrender_core_1.application.global.createCanvas({}),
|
|
27
|
-
this.tempCtx = this.tempCanvas.getContext("2d")), this.gifCanvas || (this.gifCanvas = vrender_core_1.application.global.createCanvas({}),
|
|
28
|
-
this.gifCtx = this.gifCanvas.getContext("2d")), this.gifCanvas.width = frames[0].dims.width,
|
|
29
|
-
this.gifCanvas.height = frames[0].dims.height, this.playing = !0, this.lastTime = (new Date).getTime();
|
|
30
|
-
const animation = this.animate();
|
|
31
|
-
this.attribute.timeline && animation.setTimeline(this.attribute.timeline), animation.to({}, 1e3, "linear").loop(1 / 0);
|
|
32
|
-
}
|
|
33
|
-
renderFrame(context, x, y) {
|
|
34
|
-
const frame = this.loadedFrames[this.frameIndex || 0];
|
|
35
|
-
2 === frame.disposalType && this.gifCtx.clearRect(0, 0, this.gifCanvas.width, this.gifCanvas.height),
|
|
36
|
-
this.drawPatch(frame), this.manipulate(context, x, y);
|
|
37
|
-
const diff = (new Date).getTime() - this.lastTime;
|
|
38
|
-
frame.delay < diff && (this.frameIndex++, this.lastTime = (new Date).getTime()),
|
|
39
|
-
this.frameIndex >= this.loadedFrames.length && (this.frameIndex = 0);
|
|
40
|
-
}
|
|
41
|
-
drawPatch(frame) {
|
|
42
|
-
const dims = frame.dims;
|
|
43
|
-
this.frameImageData && dims.width === this.frameImageData.width && dims.height === this.frameImageData.height || (this.tempCanvas.width = dims.width,
|
|
44
|
-
this.tempCanvas.height = dims.height, this.frameImageData = this.tempCtx.createImageData(dims.width, dims.height)),
|
|
45
|
-
this.frameImageData.data.set(frame.patch), this.tempCtx.putImageData(this.frameImageData, 0, 0),
|
|
46
|
-
this.gifCtx.drawImage(this.tempCanvas, dims.left, dims.top);
|
|
47
|
-
}
|
|
48
|
-
manipulate(context, x, y) {
|
|
49
|
-
context.drawImage(this.gifCanvas, 0, 0, this.gifCanvas.width, this.gifCanvas.height, x, y, this.attribute.width, this.attribute.height);
|
|
50
|
-
}
|
|
51
|
-
setAttribute(key, value, forceUpdateTag, context) {
|
|
52
|
-
super.setAttribute(key, value, forceUpdateTag, context), "gifImage" === key && this.loadGif();
|
|
53
|
-
}
|
|
54
|
-
setAttributes(params, forceUpdateTag, context) {
|
|
55
|
-
super.setAttributes(params, forceUpdateTag, context), params.gifImage && this.loadGif();
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function createGifImage(attributes) {
|
|
60
|
-
return new GifImage(attributes);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
exports.GifImage = GifImage, exports.createGifImage = createGifImage;
|