@visactor/vgrammar-core 0.13.11 → 0.13.12
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/graph/animation/animation/fade.js +4 -4
- package/cjs/graph/animation/animation/fade.js.map +1 -1
- package/cjs/graph/animation/animation/grow-cartesian.js +22 -28
- package/cjs/graph/animation/animation/grow-cartesian.js.map +1 -1
- package/cjs/graph/animation/animation/grow-interval.js +9 -9
- package/cjs/graph/animation/animation/grow-interval.js.map +1 -1
- package/cjs/graph/animation/animation/grow-points.js +9 -9
- package/cjs/graph/animation/animation/grow-points.js.map +1 -1
- package/cjs/graph/animation/animation/grow-polar.js +24 -24
- package/cjs/graph/animation/animation/grow-polar.js.map +1 -1
- package/cjs/graph/animation/animation/move.js +2 -2
- package/cjs/graph/animation/animation/move.js.map +1 -1
- package/cjs/graph/animation/animation/rotate.js +5 -5
- package/cjs/graph/animation/animation/rotate.js.map +1 -1
- package/cjs/graph/animation/animation/scale.js +5 -5
- package/cjs/graph/animation/animation/scale.js.map +1 -1
- package/cjs/graph/animation/animator.js +1 -1
- package/cjs/graph/animation/animator.js.map +1 -1
- package/cjs/graph/element.d.ts +2 -0
- package/cjs/graph/element.js +8 -0
- package/cjs/graph/element.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/types/element.d.ts +4 -0
- package/cjs/types/element.js.map +1 -1
- package/cjs/view/mark.js +1 -1
- package/cjs/view/mark.js.map +1 -1
- package/es/graph/animation/animation/fade.js +4 -4
- package/es/graph/animation/animation/fade.js.map +1 -1
- package/es/graph/animation/animation/grow-cartesian.js +22 -28
- package/es/graph/animation/animation/grow-cartesian.js.map +1 -1
- package/es/graph/animation/animation/grow-interval.js +9 -9
- package/es/graph/animation/animation/grow-interval.js.map +1 -1
- package/es/graph/animation/animation/grow-points.js +9 -9
- package/es/graph/animation/animation/grow-points.js.map +1 -1
- package/es/graph/animation/animation/grow-polar.js +24 -24
- package/es/graph/animation/animation/grow-polar.js.map +1 -1
- package/es/graph/animation/animation/move.js +2 -2
- package/es/graph/animation/animation/move.js.map +1 -1
- package/es/graph/animation/animation/rotate.js +4 -4
- package/es/graph/animation/animation/rotate.js.map +1 -1
- package/es/graph/animation/animation/scale.js +5 -5
- package/es/graph/animation/animation/scale.js.map +1 -1
- package/es/graph/animation/animator.js +1 -1
- package/es/graph/animation/animator.js.map +1 -1
- package/es/graph/element.d.ts +2 -0
- package/es/graph/element.js +8 -0
- package/es/graph/element.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/interactions/brush-filter.js +1 -2
- package/es/interactions/element-highlight-by-group.js +2 -1
- package/es/interactions/index.js +1 -2
- package/es/interactions/legend-filter.js +1 -1
- package/es/interactions/player-filter.js +1 -1
- package/es/interactions/roll-up.js +1 -1
- package/es/interactions/scrollbar-filter.js +1 -1
- package/es/interactions/slider-filter.js +1 -1
- package/es/interactions/toggle-state-mixin.js +1 -1
- package/es/interactions/tooltip.js +1 -1
- package/es/parse/coordinate.js +1 -1
- package/es/parse/event.js +1 -1
- package/es/parse/mark.js +1 -1
- package/es/parse/option.js +1 -1
- package/es/parse/scale.js +2 -1
- package/es/parse/transform.js +1 -1
- package/es/parse/util.js +1 -1
- package/es/parse/view.js +1 -1
- package/es/types/element.d.ts +4 -0
- package/es/types/element.js.map +1 -1
- package/es/view/mark.js +1 -1
- package/es/view/mark.js.map +1 -1
- package/package.json +7 -7
|
@@ -5,24 +5,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
}), exports.growRadiusOut = exports.growRadiusIn = exports.growAngleOut = exports.growAngleIn = void 0;
|
|
6
6
|
|
|
7
7
|
const vutils_1 = require("@visactor/vutils"), growAngleInIndividual = (element, options, animationParameters) => {
|
|
8
|
-
const
|
|
8
|
+
const attrs = element.getFinalAnimationAttributes();
|
|
9
9
|
return options && "anticlockwise" === options.orient ? {
|
|
10
10
|
from: {
|
|
11
|
-
startAngle: null ==
|
|
11
|
+
startAngle: null == attrs ? void 0 : attrs.endAngle
|
|
12
12
|
},
|
|
13
13
|
to: {
|
|
14
|
-
startAngle: null ==
|
|
14
|
+
startAngle: null == attrs ? void 0 : attrs.startAngle
|
|
15
15
|
}
|
|
16
16
|
} : {
|
|
17
17
|
from: {
|
|
18
|
-
endAngle: null ==
|
|
18
|
+
endAngle: null == attrs ? void 0 : attrs.startAngle
|
|
19
19
|
},
|
|
20
20
|
to: {
|
|
21
|
-
endAngle: null ==
|
|
21
|
+
endAngle: null == attrs ? void 0 : attrs.endAngle
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
}, growAngleInOverall = (element, options, animationParameters) => {
|
|
25
|
-
const
|
|
25
|
+
const attrs = element.getFinalAnimationAttributes();
|
|
26
26
|
if (options && "anticlockwise" === options.orient) {
|
|
27
27
|
const overallValue = (0, vutils_1.isNumber)(options.overall) ? options.overall : 2 * Math.PI;
|
|
28
28
|
return {
|
|
@@ -31,8 +31,8 @@ const vutils_1 = require("@visactor/vutils"), growAngleInIndividual = (element,
|
|
|
31
31
|
endAngle: overallValue
|
|
32
32
|
},
|
|
33
33
|
to: {
|
|
34
|
-
startAngle: null ==
|
|
35
|
-
endAngle: null ==
|
|
34
|
+
startAngle: null == attrs ? void 0 : attrs.startAngle,
|
|
35
|
+
endAngle: null == attrs ? void 0 : attrs.endAngle
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
}
|
|
@@ -43,8 +43,8 @@ const vutils_1 = require("@visactor/vutils"), growAngleInIndividual = (element,
|
|
|
43
43
|
endAngle: overallValue
|
|
44
44
|
},
|
|
45
45
|
to: {
|
|
46
|
-
startAngle: null ==
|
|
47
|
-
endAngle: null ==
|
|
46
|
+
startAngle: null == attrs ? void 0 : attrs.startAngle,
|
|
47
|
+
endAngle: null == attrs ? void 0 : attrs.endAngle
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
}, growAngleIn = (element, options, animationParameters) => {
|
|
@@ -55,20 +55,20 @@ const vutils_1 = require("@visactor/vutils"), growAngleInIndividual = (element,
|
|
|
55
55
|
exports.growAngleIn = growAngleIn;
|
|
56
56
|
|
|
57
57
|
const growAngleOutIndividual = (element, options, animationParameters) => {
|
|
58
|
-
const
|
|
58
|
+
const attrs = element.getFinalAnimationAttributes();
|
|
59
59
|
return options && "anticlockwise" === options.orient ? {
|
|
60
60
|
from: {
|
|
61
61
|
startAngle: element.getGraphicAttribute("startAngle", !0)
|
|
62
62
|
},
|
|
63
63
|
to: {
|
|
64
|
-
startAngle: null ==
|
|
64
|
+
startAngle: null == attrs ? void 0 : attrs.endAngle
|
|
65
65
|
}
|
|
66
66
|
} : {
|
|
67
67
|
from: {
|
|
68
68
|
endAngle: element.getGraphicAttribute("endAngle", !0)
|
|
69
69
|
},
|
|
70
70
|
to: {
|
|
71
|
-
endAngle: null ==
|
|
71
|
+
endAngle: null == attrs ? void 0 : attrs.startAngle
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
}, growAngleOutOverall = (element, options, animationParameters) => {
|
|
@@ -104,32 +104,32 @@ const growAngleOutIndividual = (element, options, animationParameters) => {
|
|
|
104
104
|
exports.growAngleOut = growAngleOut;
|
|
105
105
|
|
|
106
106
|
const growRadiusInIndividual = (element, options, animationParameters) => {
|
|
107
|
-
const
|
|
107
|
+
const attrs = element.getFinalAnimationAttributes();
|
|
108
108
|
return options && "inside" === options.orient ? {
|
|
109
109
|
from: {
|
|
110
|
-
innerRadius: null ==
|
|
110
|
+
innerRadius: null == attrs ? void 0 : attrs.outerRadius
|
|
111
111
|
},
|
|
112
112
|
to: {
|
|
113
|
-
innerRadius: null ==
|
|
113
|
+
innerRadius: null == attrs ? void 0 : attrs.innerRadius
|
|
114
114
|
}
|
|
115
115
|
} : {
|
|
116
116
|
from: {
|
|
117
|
-
outerRadius: null ==
|
|
117
|
+
outerRadius: null == attrs ? void 0 : attrs.innerRadius
|
|
118
118
|
},
|
|
119
119
|
to: {
|
|
120
|
-
outerRadius: null ==
|
|
120
|
+
outerRadius: null == attrs ? void 0 : attrs.outerRadius
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
123
|
}, growRadiusInOverall = (element, options, animationParameters) => {
|
|
124
|
-
const
|
|
124
|
+
const attrs = element.getFinalAnimationAttributes(), overallValue = (0, vutils_1.isNumber)(null == options ? void 0 : options.overall) ? options.overall : 0;
|
|
125
125
|
return {
|
|
126
126
|
from: {
|
|
127
127
|
innerRadius: overallValue,
|
|
128
128
|
outerRadius: overallValue
|
|
129
129
|
},
|
|
130
130
|
to: {
|
|
131
|
-
innerRadius: null ==
|
|
132
|
-
outerRadius: null ==
|
|
131
|
+
innerRadius: null == attrs ? void 0 : attrs.innerRadius,
|
|
132
|
+
outerRadius: null == attrs ? void 0 : attrs.outerRadius
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
135
|
}, growRadiusIn = (element, options, animationParameters) => {
|
|
@@ -140,20 +140,20 @@ const growRadiusInIndividual = (element, options, animationParameters) => {
|
|
|
140
140
|
exports.growRadiusIn = growRadiusIn;
|
|
141
141
|
|
|
142
142
|
const growRadiusOutIndividual = (element, options, animationParameters) => {
|
|
143
|
-
const
|
|
143
|
+
const attrs = element.getFinalAnimationAttributes();
|
|
144
144
|
return options && "inside" === options.orient ? {
|
|
145
145
|
from: {
|
|
146
146
|
innerRadius: element.getGraphicAttribute("innerRadius", !0)
|
|
147
147
|
},
|
|
148
148
|
to: {
|
|
149
|
-
innerRadius: null ==
|
|
149
|
+
innerRadius: null == attrs ? void 0 : attrs.outerRadius
|
|
150
150
|
}
|
|
151
151
|
} : {
|
|
152
152
|
from: {
|
|
153
153
|
outerRadius: element.getGraphicAttribute("outerRadius", !0)
|
|
154
154
|
},
|
|
155
155
|
to: {
|
|
156
|
-
outerRadius: null ==
|
|
156
|
+
outerRadius: null == attrs ? void 0 : attrs.innerRadius
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
159
|
}, growRadiusOutOverall = (element, options, animationParameters) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/animation/animation/grow-polar.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAW5C,MAAM,qBAAqB,GAAG,CAC5B,OAAiB,EACjB,OAAmC,EACnC,mBAAyC,EACzC,EAAE;IACF,MAAM,UAAU,GAAG,OAAO,CAAC,yBAAyB,EAAE,CAAC;IACvD,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,eAAe,EAAE;QACjD,OAAO;YACL,IAAI,EAAE,EAAE,UAAU,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,EAAE;YAC1C,EAAE,EAAE,EAAE,UAAU,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,EAAE;SAC3C,CAAC;KACH;IACD,OAAO;QACL,IAAI,EAAE,EAAE,QAAQ,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,EAAE;QAC1C,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,EAAE;KACvC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CACzB,OAAiB,EACjB,OAAmC,EACnC,mBAAyC,EACzC,EAAE;IACF,MAAM,UAAU,GAAG,OAAO,CAAC,yBAAyB,EAAE,CAAC;IAEvD,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,eAAe,EAAE;QACjD,MAAM,YAAY,GAAG,IAAA,iBAAQ,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QAC/E,OAAO;YACL,IAAI,EAAE;gBACJ,UAAU,EAAE,YAAY;gBACxB,QAAQ,EAAE,YAAY;aACvB;YACD,EAAE,EAAE;gBACF,UAAU,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,CAAC,aAAa,EAAE,IAAI,CAAC,EAAE;QACvE,EAAE,EAAE,EAAE,WAAW,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,WAAW,EAAE;KAC7C,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAC3B,OAAiB,EACjB,OAAoC,EACpC,mBAAyC,EACzC,EAAE;IACF,MAAM,YAAY,GAAG,IAAA,iBAAQ,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACtE,OAAO;QACL,IAAI,EAAE;YACJ,WAAW,EAAE,OAAO,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC;YAC7D,WAAW,EAAE,OAAO,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC;SAC9D;QACD,EAAE,EAAE;YACF,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,YAAY;SAC1B;KACF,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,aAAa,GAA4B,CACpD,OAAiB,EACjB,OAAoC,EACpC,mBAAyC,EACzC,EAAE;;IACF,OAAO,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,mCAAI,KAAK,CAAC,KAAK,KAAK;QAC1C,CAAC,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,mBAAmB,CAAC;QAC7D,CAAC,CAAC,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC;AACrE,CAAC,CAAC;AARW,QAAA,aAAa,iBAQxB","file":"grow-polar.js","sourcesContent":["import { isNumber } from '@visactor/vutils';\nimport type {\n IElement,\n IGrowAngleAnimationOptions,\n IAnimationParameters,\n IGrowRadiusAnimationOptions,\n TypeAnimation\n} from '../../../types';\n\n// grow angle\n\nconst growAngleInIndividual = (\n element: IElement,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const finalAttrs = element.getFinalGraphicAttributes();\n if (options && options.orient === 'anticlockwise') {\n return {\n from: { startAngle: finalAttrs?.endAngle },\n to: { startAngle: finalAttrs?.startAngle }\n };\n }\n return {\n from: { endAngle: finalAttrs?.startAngle },\n to: { endAngle: finalAttrs?.endAngle }\n };\n};\n\nconst growAngleInOverall = (\n element: IElement,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const finalAttrs = element.getFinalGraphicAttributes();\n\n if (options && options.orient === 'anticlockwise') {\n const overallValue = isNumber(options.overall) ? options.overall : Math.PI * 2;\n return {\n from: {\n startAngle: overallValue,\n endAngle: overallValue\n },\n to: {\n startAngle: finalAttrs?.startAngle,\n endAngle: finalAttrs?.endAngle\n }\n };\n }\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n startAngle: overallValue,\n endAngle: overallValue\n },\n to: {\n startAngle: finalAttrs?.startAngle,\n endAngle: finalAttrs?.endAngle\n }\n };\n};\n\nexport const growAngleIn: TypeAnimation<IElement> = (\n element: IElement,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growAngleInOverall(element, options, animationParameters)\n : growAngleInIndividual(element, options, animationParameters);\n};\n\nconst growAngleOutIndividual = (\n element: IElement,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const finalAttrs = element.getFinalGraphicAttributes();\n\n if (options && options.orient === 'anticlockwise') {\n return {\n from: { startAngle: element.getGraphicAttribute('startAngle', true) },\n to: { startAngle: finalAttrs?.endAngle }\n };\n }\n return {\n from: { endAngle: element.getGraphicAttribute('endAngle', true) },\n to: { endAngle: finalAttrs?.startAngle }\n };\n};\n\nconst growAngleOutOverall = (\n element: IElement,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n if (options && options.orient === 'anticlockwise') {\n const overallValue = isNumber(options.overall) ? options.overall : Math.PI * 2;\n return {\n from: {\n startAngle: element.getGraphicAttribute('startAngle', true),\n endAngle: element.getGraphicAttribute('endAngle', true)\n },\n to: {\n startAngle: overallValue,\n endAngle: overallValue\n }\n };\n }\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n startAngle: element.getGraphicAttribute('startAngle', true),\n endAngle: element.getGraphicAttribute('endAngle', true)\n },\n to: {\n startAngle: overallValue,\n endAngle: overallValue\n }\n };\n};\n\nexport const growAngleOut: TypeAnimation<IElement> = (\n element: IElement,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growAngleOutOverall(element, options, animationParameters)\n : growAngleOutIndividual(element, options, animationParameters);\n};\n\n// grow radius\n\nconst growRadiusInIndividual = (\n element: IElement,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const finalAttrs = element.getFinalGraphicAttributes();\n\n if (options && options.orient === 'inside') {\n return {\n from: { innerRadius: finalAttrs?.outerRadius },\n to: { innerRadius: finalAttrs?.innerRadius }\n };\n }\n return {\n from: { outerRadius: finalAttrs?.innerRadius },\n to: { outerRadius: finalAttrs?.outerRadius }\n };\n};\n\nconst growRadiusInOverall = (\n element: IElement,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const finalAttrs = element.getFinalGraphicAttributes();\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n innerRadius: overallValue,\n outerRadius: overallValue\n },\n to: {\n innerRadius: finalAttrs?.innerRadius,\n outerRadius: finalAttrs?.outerRadius\n }\n };\n};\n\nexport const growRadiusIn: TypeAnimation<IElement> = (\n element: IElement,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growRadiusInOverall(element, options, animationParameters)\n : growRadiusInIndividual(element, options, animationParameters);\n};\n\nconst growRadiusOutIndividual = (\n element: IElement,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const finalAttrs = element.getFinalGraphicAttributes();\n if (options && options.orient === 'inside') {\n return {\n from: { innerRadius: element.getGraphicAttribute('innerRadius', true) },\n to: { innerRadius: finalAttrs?.outerRadius }\n };\n }\n return {\n from: { outerRadius: element.getGraphicAttribute('outerRadius', true) },\n to: { outerRadius: finalAttrs?.innerRadius }\n };\n};\n\nconst growRadiusOutOverall = (\n element: IElement,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n innerRadius: element.getGraphicAttribute('innerRadius', true),\n outerRadius: element.getGraphicAttribute('outerRadius', true)\n },\n to: {\n innerRadius: overallValue,\n outerRadius: overallValue\n }\n };\n};\n\nexport const growRadiusOut: TypeAnimation<IElement> = (\n element: IElement,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growRadiusOutOverall(element, options, animationParameters)\n : growRadiusOutIndividual(element, options, animationParameters);\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/graph/animation/animation/grow-polar.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAW5C,MAAM,qBAAqB,GAAG,CAC5B,OAAiB,EACjB,OAAmC,EACnC,mBAAyC,EACzC,EAAE;IACF,MAAM,KAAK,GAAG,OAAO,CAAC,2BAA2B,EAAE,CAAC;IACpD,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,eAAe,EAAE;QACjD,OAAO;YACL,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,EAAE;YACrC,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,EAAE;SACtC,CAAC;KACH;IACD,OAAO;QACL,IAAI,EAAE,EAAE,QAAQ,EAAE,KAAK,aAAL,KAAK,uBAAL,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AE,YAAY;SAC1B;KACF,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,aAAa,GAA4B,CACpD,OAAiB,EACjB,OAAoC,EACpC,mBAAyC,EACzC,EAAE;;IACF,OAAO,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,mCAAI,KAAK,CAAC,KAAK,KAAK;QAC1C,CAAC,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,mBAAmB,CAAC;QAC7D,CAAC,CAAC,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC;AACrE,CAAC,CAAC;AARW,QAAA,aAAa,iBAQxB","file":"grow-polar.js","sourcesContent":["import { isNumber } from '@visactor/vutils';\nimport type {\n IElement,\n IGrowAngleAnimationOptions,\n IAnimationParameters,\n IGrowRadiusAnimationOptions,\n TypeAnimation\n} from '../../../types';\n\n// grow angle\n\nconst growAngleInIndividual = (\n element: IElement,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = element.getFinalAnimationAttributes();\n if (options && options.orient === 'anticlockwise') {\n return {\n from: { startAngle: attrs?.endAngle },\n to: { startAngle: attrs?.startAngle }\n };\n }\n return {\n from: { endAngle: attrs?.startAngle },\n to: { endAngle: attrs?.endAngle }\n };\n};\n\nconst growAngleInOverall = (\n element: IElement,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = element.getFinalAnimationAttributes();\n\n if (options && options.orient === 'anticlockwise') {\n const overallValue = isNumber(options.overall) ? options.overall : Math.PI * 2;\n return {\n from: {\n startAngle: overallValue,\n endAngle: overallValue\n },\n to: {\n startAngle: attrs?.startAngle,\n endAngle: attrs?.endAngle\n }\n };\n }\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n startAngle: overallValue,\n endAngle: overallValue\n },\n to: {\n startAngle: attrs?.startAngle,\n endAngle: attrs?.endAngle\n }\n };\n};\n\nexport const growAngleIn: TypeAnimation<IElement> = (\n element: IElement,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growAngleInOverall(element, options, animationParameters)\n : growAngleInIndividual(element, options, animationParameters);\n};\n\nconst growAngleOutIndividual = (\n element: IElement,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = element.getFinalAnimationAttributes();\n\n if (options && options.orient === 'anticlockwise') {\n return {\n from: { startAngle: element.getGraphicAttribute('startAngle', true) },\n to: { startAngle: attrs?.endAngle }\n };\n }\n return {\n from: { endAngle: element.getGraphicAttribute('endAngle', true) },\n to: { endAngle: attrs?.startAngle }\n };\n};\n\nconst growAngleOutOverall = (\n element: IElement,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n if (options && options.orient === 'anticlockwise') {\n const overallValue = isNumber(options.overall) ? options.overall : Math.PI * 2;\n return {\n from: {\n startAngle: element.getGraphicAttribute('startAngle', true),\n endAngle: element.getGraphicAttribute('endAngle', true)\n },\n to: {\n startAngle: overallValue,\n endAngle: overallValue\n }\n };\n }\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n startAngle: element.getGraphicAttribute('startAngle', true),\n endAngle: element.getGraphicAttribute('endAngle', true)\n },\n to: {\n startAngle: overallValue,\n endAngle: overallValue\n }\n };\n};\n\nexport const growAngleOut: TypeAnimation<IElement> = (\n element: IElement,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growAngleOutOverall(element, options, animationParameters)\n : growAngleOutIndividual(element, options, animationParameters);\n};\n\n// grow radius\n\nconst growRadiusInIndividual = (\n element: IElement,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = element.getFinalAnimationAttributes();\n\n if (options && options.orient === 'inside') {\n return {\n from: { innerRadius: attrs?.outerRadius },\n to: { innerRadius: attrs?.innerRadius }\n };\n }\n return {\n from: { outerRadius: attrs?.innerRadius },\n to: { outerRadius: attrs?.outerRadius }\n };\n};\n\nconst growRadiusInOverall = (\n element: IElement,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = element.getFinalAnimationAttributes();\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n innerRadius: overallValue,\n outerRadius: overallValue\n },\n to: {\n innerRadius: attrs?.innerRadius,\n outerRadius: attrs?.outerRadius\n }\n };\n};\n\nexport const growRadiusIn: TypeAnimation<IElement> = (\n element: IElement,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growRadiusInOverall(element, options, animationParameters)\n : growRadiusInIndividual(element, options, animationParameters);\n};\n\nconst growRadiusOutIndividual = (\n element: IElement,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = element.getFinalAnimationAttributes();\n if (options && options.orient === 'inside') {\n return {\n from: { innerRadius: element.getGraphicAttribute('innerRadius', true) },\n to: { innerRadius: attrs?.outerRadius }\n };\n }\n return {\n from: { outerRadius: element.getGraphicAttribute('outerRadius', true) },\n to: { outerRadius: attrs?.innerRadius }\n };\n};\n\nconst growRadiusOutOverall = (\n element: IElement,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n innerRadius: element.getGraphicAttribute('innerRadius', true),\n outerRadius: element.getGraphicAttribute('outerRadius', true)\n },\n to: {\n innerRadius: overallValue,\n outerRadius: overallValue\n }\n };\n};\n\nexport const growRadiusOut: TypeAnimation<IElement> = (\n element: IElement,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growRadiusOutOverall(element, options, animationParameters)\n : growRadiusOutIndividual(element, options, animationParameters);\n};\n"]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
}), exports.moveOut = exports.moveIn = void 0;
|
|
6
6
|
|
|
7
7
|
const vutils_1 = require("@visactor/vutils"), moveIn = (element, options, animationParameters) => {
|
|
8
|
-
var _a, _b
|
|
8
|
+
var _a, _b;
|
|
9
9
|
const {offset: offset = 0, orient: orient, direction: direction, point: pointOpt, excludeChannels: excludeChannels = []} = null != options ? options : {};
|
|
10
10
|
let changedX = 0, changedY = 0;
|
|
11
11
|
"negative" === orient && (animationParameters.group ? (changedX = null !== (_a = animationParameters.groupWidth) && void 0 !== _a ? _a : animationParameters.group.getBounds().width(),
|
|
@@ -13,7 +13,7 @@ const vutils_1 = require("@visactor/vutils"), moveIn = (element, options, animat
|
|
|
13
13
|
animationParameters.groupWidth = changedX, animationParameters.groupHeight = changedY) : (changedX = animationParameters.width,
|
|
14
14
|
changedY = animationParameters.height)), changedX += offset, changedY += offset;
|
|
15
15
|
const point = (0, vutils_1.isFunction)(pointOpt) ? pointOpt.call(null, element.getDatum(), element, animationParameters) : pointOpt, fromX = point && (0,
|
|
16
|
-
vutils_1.isValidNumber)(point.x) ? point.x : changedX, fromY = point && (0, vutils_1.isValidNumber)(point.y) ? point.y : changedY, finalAttrsX = excludeChannels.includes("x") ? element.getGraphicAttribute("x") :
|
|
16
|
+
vutils_1.isValidNumber)(point.x) ? point.x : changedX, fromY = point && (0, vutils_1.isValidNumber)(point.y) ? point.y : changedY, finalAttrsX = excludeChannels.includes("x") ? element.getGraphicAttribute("x") : element.getFinalAnimationAttribute("x"), finalAttrsY = excludeChannels.includes("y") ? element.getGraphicAttribute("y") : element.getFinalAnimationAttribute("y");
|
|
17
17
|
switch (direction) {
|
|
18
18
|
case "x":
|
|
19
19
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/animation/animation/move.ts"],"names":[],"mappings":";;;AAAA,6CAA6D;AAMtD,MAAM,MAAM,GAA4B,CAC7C,OAAiB,EACjB,OAA8B,E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IAAI,IAAA,sBAAa,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IACnE,MAAM,KAAK,GAAG,KAAK,IAAI,IAAA,sBAAa,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAEnE,QAAQ,SAAS,EAAE;QACjB,KAAK,GAAG;YACN,OAAO;gBACL,IAAI,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE;gBACnD,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE;aACjB,CAAC;QACJ,KAAK,GAAG;YACN,OAAO;gBACL,IAAI,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE;gBACnD,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE;aACjB,CAAC;QACJ,KAAK,IAAI,CAAC;QACV;YACE,OAAO;gBACL,IAAI,EAAE;oBACJ,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC;oBACzC,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC;iBAC1C;gBACD,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE;aAC3B,CAAC;KACL;AACH,CAAC,CAAC;AAtCW,QAAA,OAAO,WAsClB","file":"move.js","sourcesContent":["import { isFunction, isValidNumber } from '@visactor/vutils';\nimport type { IElement, IMoveAnimationOptions, IAnimationParameters, TypeAnimation } from '../../../types';\n\n// When user did not provide proper x/y value, move animation will never work properly,\n// due to that, default x/y value won't be set.\n\nexport const moveIn: TypeAnimation<IElement> = (\n element: IElement,\n options: IMoveAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const { offset = 0, orient, direction, point: pointOpt, excludeChannels = [] } = options ?? {};\n let changedX = 0;\n let changedY = 0;\n\n if (orient === 'negative') {\n // consider the offset of group\n if (animationParameters.group) {\n changedX = (animationParameters as any).groupWidth ?? animationParameters.group.getBounds().width();\n changedY = (animationParameters as any).groupHeight ?? animationParameters.group.getBounds().height();\n\n (animationParameters as any).groupWidth = changedX;\n (animationParameters as any).groupHeight = changedY;\n } else {\n changedX = animationParameters.width;\n changedY = animationParameters.height;\n }\n }\n\n changedX += offset;\n changedY += offset;\n const point = isFunction(pointOpt) ? pointOpt.call(null, element.getDatum(), element, animationParameters) : pointOpt;\n const fromX = point && isValidNumber(point.x) ? point.x : changedX;\n const fromY = point && isValidNumber(point.y) ? point.y : changedY;\n const finalAttrsX = excludeChannels.includes('x')\n ? element.getGraphicAttribute('x')\n : element.getFinalAnimationAttribute('x');\n const finalAttrsY = excludeChannels.includes('y')\n ? element.getGraphicAttribute('y')\n : element.getFinalAnimationAttribute('y');\n\n switch (direction) {\n case 'x':\n return {\n from: { x: fromX },\n to: { x: finalAttrsX }\n };\n case 'y':\n return {\n from: { y: fromY },\n to: { y: finalAttrsY }\n };\n case 'xy':\n default:\n return {\n from: { x: fromX, y: fromY },\n to: {\n x: finalAttrsX,\n y: finalAttrsY\n }\n };\n }\n};\n\nexport const moveOut: TypeAnimation<IElement> = (\n element: IElement,\n options: IMoveAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const { offset = 0, orient, direction, point: pointOpt } = options ?? {};\n\n // consider the offset of group\n const groupBounds = animationParameters.group ? animationParameters.group.getBounds() : null;\n const groupWidth = groupBounds?.width() ?? animationParameters.width;\n const groupHeight = groupBounds?.height() ?? animationParameters.height;\n const changedX = (orient === 'negative' ? groupWidth : 0) + offset;\n const changedY = (orient === 'negative' ? groupHeight : 0) + offset;\n const point = isFunction(pointOpt) ? pointOpt.call(null, element.getDatum(), element, animationParameters) : pointOpt;\n const fromX = point && isValidNumber(point.x) ? point.x : changedX;\n const fromY = point && isValidNumber(point.y) ? point.y : changedY;\n\n switch (direction) {\n case 'x':\n return {\n from: { x: element.getGraphicAttribute('x', true) },\n to: { x: fromX }\n };\n case 'y':\n return {\n from: { y: element.getGraphicAttribute('y', true) },\n to: { y: fromY }\n };\n case 'xy':\n default:\n return {\n from: {\n x: element.getGraphicAttribute('x', true),\n y: element.getGraphicAttribute('y', true)\n },\n to: { x: fromX, y: fromY }\n };\n }\n};\n"]}
|
|
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
}), exports.rotateOut = exports.rotateIn = void 0;
|
|
6
6
|
|
|
7
7
|
const vutils_1 = require("@visactor/vutils"), rotateIn = (element, options, animationParameters) => {
|
|
8
|
-
var _a
|
|
9
|
-
const
|
|
8
|
+
var _a;
|
|
9
|
+
const attributeAngle = null !== (_a = element.getFinalAnimationAttribute("angle")) && void 0 !== _a ? _a : 0;
|
|
10
10
|
let angle = 0;
|
|
11
|
-
return angle = (0, vutils_1.isNumberClose)(
|
|
12
|
-
vutils_1.isValidNumber)(null == options ? void 0 : options.angle) ? options.angle : "anticlockwise" === (null == options ? void 0 : options.orient) ? Math.ceil(
|
|
11
|
+
return angle = (0, vutils_1.isNumberClose)(attributeAngle / (2 * Math.PI), 0) ? Math.round(attributeAngle / (2 * Math.PI)) * Math.PI * 2 : (0,
|
|
12
|
+
vutils_1.isValidNumber)(null == options ? void 0 : options.angle) ? options.angle : "anticlockwise" === (null == options ? void 0 : options.orient) ? Math.ceil(attributeAngle / (2 * Math.PI)) * Math.PI * 2 : Math.floor(attributeAngle / (2 * Math.PI)) * Math.PI * 2,
|
|
13
13
|
{
|
|
14
14
|
from: {
|
|
15
15
|
angle: angle
|
|
16
16
|
},
|
|
17
17
|
to: {
|
|
18
|
-
angle:
|
|
18
|
+
angle: attributeAngle
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/animation/animation/rotate.ts"],"names":[],"mappings":";;;AAAA,6CAAgE;AAGzD,MAAM,QAAQ,GAA4B,CAC/C,OAAiB,EACjB,OAAgC,EAChC,mBAAyC,EACzC,EAAE;;IACF,MAAM,
|
|
1
|
+
{"version":3,"sources":["../src/graph/animation/animation/rotate.ts"],"names":[],"mappings":";;;AAAA,6CAAgE;AAGzD,MAAM,QAAQ,GAA4B,CAC/C,OAAiB,EACjB,OAAgC,EAChC,mBAAyC,EACzC,EAAE;;IACF,MAAM,cAAc,GAAG,MAAA,OAAO,CAAC,0BAA0B,CAAC,OAAO,CAAC,mCAAI,CAAC,CAAC;IAExE,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,IAAA,sBAAa,EAAC,cAAc,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;QACpD,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;KAClE;SAAM,IAAI,IAAA,sBAAa,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,EAAE;QACxC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;KACvB;SAAM,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,MAAK,eAAe,EAAE;QAC9C,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;KACjE;SAAM;QACL,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;KAClE;IACD,OAAO;QACL,IAAI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C;AACJ,CAAC,CAAC;AApBW,QAAA,SAAS,aAoBpB","file":"rotate.js","sourcesContent":["import { isNumberClose, isValidNumber } from '@visactor/vutils';\nimport type { IAnimationParameters, IRotateAnimationOptions, TypeAnimation, IElement } from '../../../types';\n\nexport const rotateIn: TypeAnimation<IElement> = (\n element: IElement,\n options: IRotateAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attributeAngle = element.getFinalAnimationAttribute('angle') ?? 0;\n\n let angle = 0;\n if (isNumberClose(attributeAngle / (Math.PI * 2), 0)) {\n angle = Math.round(attributeAngle / (Math.PI * 2)) * Math.PI * 2;\n } else if (isValidNumber(options?.angle)) {\n angle = options.angle;\n } else if (options?.orient === 'anticlockwise') {\n angle = Math.ceil(attributeAngle / (Math.PI * 2)) * Math.PI * 2;\n } else {\n angle = Math.floor(attributeAngle / (Math.PI * 2)) * Math.PI * 2;\n }\n return {\n from: { angle },\n to: { angle: attributeAngle }\n };\n};\n\nexport const rotateOut: TypeAnimation<IElement> = (\n element: IElement,\n options: IRotateAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const finalAngle = element.getGraphicAttribute('angle', true) ?? 0;\n let angle = 0;\n if (isNumberClose(finalAngle / (Math.PI * 2), 0)) {\n angle = Math.round(finalAngle / (Math.PI * 2)) * Math.PI * 2;\n } else if (isValidNumber(options?.angle)) {\n angle = options.angle;\n } else if (options?.orient === 'anticlockwise') {\n angle = Math.ceil(finalAngle / (Math.PI * 2)) * Math.PI * 2;\n } else {\n angle = Math.floor(finalAngle / (Math.PI * 2)) * Math.PI * 2;\n }\n return {\n from: { angle: finalAngle },\n to: { angle }\n };\n};\n"]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
|
|
7
7
|
const scaleIn = (element, options, animationParameters) => {
|
|
8
8
|
var _a, _b, _c, _d;
|
|
9
|
-
const
|
|
9
|
+
const attrs = element.getFinalAnimationAttributes();
|
|
10
10
|
switch (null == options ? void 0 : options.direction) {
|
|
11
11
|
case "x":
|
|
12
12
|
return {
|
|
@@ -14,7 +14,7 @@ const scaleIn = (element, options, animationParameters) => {
|
|
|
14
14
|
scaleX: 0
|
|
15
15
|
},
|
|
16
16
|
to: {
|
|
17
|
-
scaleX: null !== (_a = null ==
|
|
17
|
+
scaleX: null !== (_a = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _a ? _a : 1
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -24,7 +24,7 @@ const scaleIn = (element, options, animationParameters) => {
|
|
|
24
24
|
scaleY: 0
|
|
25
25
|
},
|
|
26
26
|
to: {
|
|
27
|
-
scaleY: null !== (_b = null ==
|
|
27
|
+
scaleY: null !== (_b = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _b ? _b : 1
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -35,8 +35,8 @@ const scaleIn = (element, options, animationParameters) => {
|
|
|
35
35
|
scaleY: 0
|
|
36
36
|
},
|
|
37
37
|
to: {
|
|
38
|
-
scaleX: null !== (_c = null ==
|
|
39
|
-
scaleY: null !== (_d = null ==
|
|
38
|
+
scaleX: null !== (_c = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _c ? _c : 1,
|
|
39
|
+
scaleY: null !== (_d = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _d ? _d : 1
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/animation/animation/scale.ts"],"names":[],"mappings":";;;AAIO,MAAM,OAAO,GAA4B,CAC9C,OAAiB,EACjB,OAA+B,EAC/B,mBAAyC,EACzC,EAAE;;IACF,MAAM,
|
|
1
|
+
{"version":3,"sources":["../src/graph/animation/animation/scale.ts"],"names":[],"mappings":";;;AAIO,MAAM,OAAO,GAA4B,CAC9C,OAAiB,EACjB,OAA+B,EAC/B,mBAAyC,EACzC,EAAE;;IACF,MAAM,KAA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OAAO;gBACL,IAAI,EAAE,EAAE,MAAM,EAAE,MAAA,OAAO,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,mCAAI,CAAC,EAAE;gBAClE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;aAClB,CAAC;QACJ,KAAK,IAAI,CAAC;QACV;YACE,OAAO;gBACL,IAAI,EAAE;oBACJ,MAAM,EAAE,MAAA,OAAO,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,mCAAI,CAAC;oBACxD,MAAM,EAAE,MAAA,OAAO,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,mCAAI,CAAC;iBACzD;gBACD,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;aAC7B,CAAC;KACL;AACH,CAAC,CAAC;AA1BW,QAAA,QAAQ,YA0BnB","file":"scale.js","sourcesContent":["import type { IElement, IScaleAnimationOptions, IAnimationParameters, TypeAnimation } from '../../../types';\n\n// TODO: negative direction, need support from VRender\n\nexport const scaleIn: TypeAnimation<IElement> = (\n element: IElement,\n options: IScaleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = element.getFinalAnimationAttributes();\n\n switch (options?.direction) {\n case 'x':\n return {\n from: { scaleX: 0 },\n to: { scaleX: attrs?.scaleX ?? 1 }\n };\n case 'y':\n return {\n from: { scaleY: 0 },\n to: { scaleY: attrs?.scaleY ?? 1 }\n };\n case 'xy':\n default:\n return {\n from: { scaleX: 0, scaleY: 0 },\n to: {\n scaleX: attrs?.scaleX ?? 1,\n scaleY: attrs?.scaleY ?? 1\n }\n };\n }\n};\n\nexport const scaleOut: TypeAnimation<IElement> = (\n element: IElement,\n options: IScaleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n switch (options?.direction) {\n case 'x':\n return {\n from: { scaleX: element.getGraphicAttribute('scaleX', true) ?? 1 },\n to: { scaleX: 0 }\n };\n case 'y':\n return {\n from: { scaleY: element.getGraphicAttribute('scaleY', true) ?? 1 },\n to: { scaleY: 0 }\n };\n case 'xy':\n default:\n return {\n from: {\n scaleX: element.getGraphicAttribute('scaleX', true) ?? 1,\n scaleY: element.getGraphicAttribute('scaleY', true) ?? 1\n },\n to: { scaleX: 0, scaleY: 0 }\n };\n }\n};\n"]}
|
|
@@ -10,7 +10,7 @@ vrender_core_1.Animate.mode |= vrender_core_1.AnimateMode.SET_ATTR_IMMEDIATELY;
|
|
|
10
10
|
|
|
11
11
|
let GlobalAnimatorId = 0;
|
|
12
12
|
|
|
13
|
-
const isCustomAnimateCtor = custom => !(0, vutils_1.isNil)(custom) && (custom.prototype instanceof vrender_core_1.ACustomAnimate || "onBind" in custom.prototype && "onStart" in custom.prototype && "onEnd" in custom.prototype && "onUpdate" in custom.prototype);
|
|
13
|
+
const isCustomAnimateCtor = custom => !(0, vutils_1.isNil)(custom) && !(0, vutils_1.isNil)(custom.prototype) && (custom.prototype instanceof vrender_core_1.ACustomAnimate || "onBind" in custom.prototype && "onStart" in custom.prototype && "onEnd" in custom.prototype && "onUpdate" in custom.prototype);
|
|
14
14
|
|
|
15
15
|
class Animator {
|
|
16
16
|
constructor(element, unit, animationOptions) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/animation/animator.ts"],"names":[],"mappings":";;;AAAA,6CAAwD;AAGxD,yDAA4F;AAa5F,2CAAwH;AAExH,sBAAO,CAAC,IAAI,IAAI,0BAAW,CAAC,oBAAoB,CAAC;AAEjD,IAAI,gBAAgB,GAAG,CAAC,CAAC;AAEzB,MAAM,mBAAmB,GAAG,CAAC,MAAoE,EAAE,EAAE;IACnG,IAAI,IAAA,cAAK,EAAC,MAAM,CAAC,EAAE;QACjB,OAAO,KAAK,CAAC;KACd;IACD,OAAO,CACL,MAAM,CAAC,SAAS,YAAY,6BAAc;QAE1C,CAAC,QAAQ,IAAI,MAAM,CAAC,SAAS;YAC3B,SAAS,IAAI,MAAM,CAAC,SA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I,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;gBACpC,cAAc,CAAC,IAAI,CAAC,IAAI,2BAAY,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC;aACjE;SACF;QAED,IAAI,UAAU,GAAG,CAAC,EAAE;YAClB,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACjC;IACH,CAAC;CACF;AArMD,4BAqMC","file":"animator.js","sourcesContent":["import { isNil, isValidNumber } from '@visactor/vutils';\nimport type { IAnimate as IGraphicAnimate } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { ACustomAnimate, Animate, AnimateGroup, AnimateMode } from '@visactor/vrender-core';\nimport type {\n IAnimationChannelInterpolator,\n IAnimationCustomConstructor,\n IAnimationTimeline,\n IAnimator,\n IAnimatorOptions,\n IAnimationUnit,\n IAnimationParameters,\n IAnimationTimeSlice,\n IElement,\n IAnimationEffect\n} from '../../types';\nimport { AttributeAnimate, channelAnimationAttributes, CustomInterpolator, typeAnimationAttributes } from './attribute';\n\nAnimate.mode |= AnimateMode.SET_ATTR_IMMEDIATELY;\n\nlet GlobalAnimatorId = 0;\n\nconst isCustomAnimateCtor = (custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor) => {\n if (isNil(custom)) {\n return false;\n }\n return (\n custom.prototype instanceof ACustomAnimate ||\n // similar to ACustomAnimate, apply for different vrender version\n ('onBind' in custom.prototype &&\n 'onStart' in custom.prototype &&\n 'onEnd' in custom.prototype &&\n 'onUpdate' in custom.prototype)\n );\n};\n\nexport class Animator implements IAnimator {\n id: number = GlobalAnimatorId++;\n element: IElement;\n animationOptions: IAnimatorOptions;\n isAnimating: boolean = false;\n\n private unit: IAnimationUnit;\n private runnings: IGraphicAnimate[] = [];\n private callbackFunction: (...args: any[]) => any;\n\n constructor(\n element: IElement,\n unit: IAnimationUnit,\n animationOptions: {\n state: string;\n timeline: IAnimationTimeline;\n id: string;\n }\n ) {\n this.element = element;\n this.animationOptions = animationOptions;\n this.unit = unit;\n }\n\n callback(callbackFunction: (...args: any[]) => void): this {\n this.callbackFunction = callbackFunction;\n return this;\n }\n\n animate(animationParameters: IAnimationParameters, parameters: any): this {\n this.isAnimating = true;\n\n this.animateElement(animationParameters, parameters);\n\n // if no valid running, end animating immediately\n if (this.runnings.length === 0) {\n this.animationEnd();\n }\n return this;\n }\n\n stop(stopState: 'start' | 'end' = 'end', invokeCallback: boolean = true): this {\n // FIXME: wait for VRender to fix 'end' parameter\n this.runnings.forEach(running => running.stop(stopState));\n this.animationEnd(invokeCallback);\n return this;\n }\n\n pause(): this {\n this.runnings.forEach(running => running.pause());\n return this;\n }\n\n resume(): this {\n this.runnings.forEach(running => running.resume());\n return this;\n }\n\n startAt(startTime: number): this {\n this.runnings.forEach(running => {\n const initialDelay = this.unit.initialDelay;\n running.startAt(initialDelay + startTime);\n });\n return this;\n }\n\n getTotalAnimationTime() {\n const timeLineDuration = this.unit.initialDelay + this.unit.loopDuration * this.unit.loopCount;\n return this.unit.totalTime ?? timeLineDuration;\n }\n\n getEndAttributes() {\n return this.runnings.reduce((attributes, running) => {\n return Object.assign(attributes, running.getEndProps());\n }, {} as Record<string, any>);\n }\n\n private animationEnd(invokeCallback: boolean = true) {\n this.isAnimating = false;\n this.runnings = null;\n if (invokeCallback) {\n this.callbackFunction?.call(null);\n }\n }\n\n private animateElement(animationParameters: IAnimationParameters, parameters: any) {\n const graphicItem = this.element.getGraphicItem();\n\n if (!graphicItem) {\n return;\n }\n\n const graphicAnimate: IGraphicAnimate = graphicItem.animate();\n this.runnings.push(graphicAnimate);\n // initialDelay is only used at first loop\n graphicAnimate.startAt(this.unit.initialDelay);\n // execute loop animation\n graphicAnimate.wait(this.unit.loopDelay);\n this.unit.timeSlices.forEach(timeSlice => {\n this.animateTimeSlice(graphicAnimate, timeSlice, animationParameters, parameters);\n });\n graphicAnimate.wait(this.unit.loopDelayAfter);\n\n graphicAnimate.loop(this.unit.loopCount - 1);\n\n if (isValidNumber(this.unit.totalTime)) {\n // FIXME: use VRender api instead after VRender refactor is finished\n setTimeout(() => {\n if (graphicAnimate) {\n graphicAnimate.stop('end');\n }\n }, this.unit.totalTime);\n }\n\n graphicAnimate.onEnd(() => {\n this.runnings = this.runnings.filter(running => running !== graphicAnimate);\n if (this.runnings.length === 0) {\n this.animationEnd();\n }\n });\n }\n\n private animateTimeSlice(\n graphicAnimate: IGraphicAnimate,\n timeSlice: IAnimationTimeSlice,\n animationParameters: IAnimationParameters,\n parameters: any\n ) {\n const delay = timeSlice.delay as number;\n const delayAfter = timeSlice.delayAfter as number;\n const duration = timeSlice.duration as number;\n const effects = timeSlice.effects as IAnimationEffect[];\n\n // wait in loop animation before animation starts\n if (delay > 0) {\n graphicAnimate.wait(delay);\n }\n\n if (effects.length < 0) {\n graphicAnimate.wait(duration);\n } else {\n const customAnimates = effects\n .map((effect, index) => {\n const attributes =\n (effect.type\n ? typeAnimationAttributes(this.element, effect, animationParameters, parameters)\n : effect.channel\n ? channelAnimationAttributes(this.element, effect, animationParameters, parameters)\n : undefined) ?? {};\n\n const customOption = attributes.custom || effect?.custom;\n const customParametersOption = attributes?.customParameters || effect?.customParameters;\n\n if (\n attributes.from &&\n Object.keys(attributes.from).length &&\n this.unit &&\n this.animationOptions.timeline.controlOptions.immediatelyApply &&\n this.element.mark.markType !== 'component'\n ) {\n this.element.getGraphicItem().setAttributes(attributes.from);\n }\n\n const isCustomAnimate = isCustomAnimateCtor(customOption);\n const isCustomInterpolator = !isNil(customOption) && !isCustomAnimateCtor(customOption);\n\n if (isCustomInterpolator) {\n return new CustomInterpolator(attributes.from, attributes.to, duration, effect.easing, {\n interpolator: customOption as IAnimationChannelInterpolator,\n element: this.element,\n parameters: customParametersOption\n });\n } else if (isCustomAnimate) {\n return new (customOption as IAnimationCustomConstructor)(\n attributes.from,\n attributes.to,\n duration,\n effect.easing,\n customParametersOption\n );\n } else if (attributes.to) {\n return new AttributeAnimate(attributes.from, attributes.to, duration, effect.easing);\n }\n })\n .filter(animate => !isNil(animate));\n\n if (customAnimates.length === 1) {\n graphicAnimate.play(customAnimates[0]);\n } else if (customAnimates.length > 1) {\n graphicAnimate.play(new AnimateGroup(duration, customAnimates));\n }\n }\n\n if (delayAfter > 0) {\n graphicAnimate.wait(delayAfter);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/graph/animation/animator.ts"],"names":[],"mappings":";;;AAAA,6CAAwD;AAGxD,yDAA4F;AAa5F,2CAAwH;AAExH,sBAAO,CAAC,IAAI,IAAI,0BAAW,CAAC,oBAAoB,CAAC;AAEjD,IAAI,gBAAgB,GAAG,CAAC,CAAC;AAEzB,MAAM,mBAAmB,GAAG,CAAC,MAAoE,EAAE,EAAE;IACnG,IAAI,IAAA,cAAK,EAAC,MAAM,CAAC,IAAI,IAAA,cAAK,EAAC,MAAM,CAAC,SAAS,CAAC,EAAE;QAC5C,OAAO,KAAK,CAAC;KACd;IACD,OAAO,CACL,MAAM,CAAC,SAAS,YAAY,6BAAc;QAE1C,CAAC,QAAQ,IAAI,MAAM,CAAC,SAAS;YAC3B,SAAS,IAAI,MAAM,CAAC,SAAS;YAC7B,OAAO,IAAI,MAAM,CAAC,SAAS;YAC3B,UAAU,IAAI,MAAM,CAAC,SAAS,CAAC,CAClC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAa,QAAQ;IAUnB,YACE,OAAiB,EACjB,IAAoB,EACpB,gBAIC;QAhBH,OAAE,GAAW,gBAAgB,EAAE,CAAC;QAGhC,gBAAW,GAAY,KAAK,CAAC;QAGrB,aAAQ,GAAsB,EAAE,CAAC;QAYvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,QAAQ,CAAC,gBAA0C;QACjD,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAA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wBACrF,YAAY,EAAE,YAA6C;wBAC3D,OAAO,EAAE,IAAI,CAAC,OAAO;wBACrB,UAAU,EAAE,sBAAsB;qBACnC,CAAC,CAAC;iBACJ;qBAAM,IAAI,eAAe,EAAE;oBAC1B,OAAO,IAAK,YAA4C,CACtD,UAAU,CAAC,IAAI,EACf,UAAU,CAAC,EAAE,EACb,QAAQ,EACR,MAAM,CAAC,MAAM,EACb,sBAAsB,CACvB,CAAC;iBACH;qBAAM,IAAI,UAAU,CAAC,EAAE,EAAE;oBACxB,OAAO,IAAI,4BAAgB,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;iBACtF;YACH,CAAC,CAAC;iBACD,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAA,cAAK,EAAC,OAAO,CAAC,CAAC,CAAC;YAEtC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC/B,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;aACxC;iBAAM,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;gBACpC,cAAc,CAAC,IAAI,CAAC,IAAI,2BAAY,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC;aACjE;SACF;QAED,IAAI,UAAU,GAAG,CAAC,EAAE;YAClB,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACjC;IACH,CAAC;CACF;AArMD,4BAqMC","file":"animator.js","sourcesContent":["import { isNil, isValidNumber } from '@visactor/vutils';\nimport type { IAnimate as IGraphicAnimate } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { ACustomAnimate, Animate, AnimateGroup, AnimateMode } from '@visactor/vrender-core';\nimport type {\n IAnimationChannelInterpolator,\n IAnimationCustomConstructor,\n IAnimationTimeline,\n IAnimator,\n IAnimatorOptions,\n IAnimationUnit,\n IAnimationParameters,\n IAnimationTimeSlice,\n IElement,\n IAnimationEffect\n} from '../../types';\nimport { AttributeAnimate, channelAnimationAttributes, CustomInterpolator, typeAnimationAttributes } from './attribute';\n\nAnimate.mode |= AnimateMode.SET_ATTR_IMMEDIATELY;\n\nlet GlobalAnimatorId = 0;\n\nconst isCustomAnimateCtor = (custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor) => {\n if (isNil(custom) || isNil(custom.prototype)) {\n return false;\n }\n return (\n custom.prototype instanceof ACustomAnimate ||\n // similar to ACustomAnimate, apply for different vrender version\n ('onBind' in custom.prototype &&\n 'onStart' in custom.prototype &&\n 'onEnd' in custom.prototype &&\n 'onUpdate' in custom.prototype)\n );\n};\n\nexport class Animator implements IAnimator {\n id: number = GlobalAnimatorId++;\n element: IElement;\n animationOptions: IAnimatorOptions;\n isAnimating: boolean = false;\n\n private unit: IAnimationUnit;\n private runnings: IGraphicAnimate[] = [];\n private callbackFunction: (...args: any[]) => any;\n\n constructor(\n element: IElement,\n unit: IAnimationUnit,\n animationOptions: {\n state: string;\n timeline: IAnimationTimeline;\n id: string;\n }\n ) {\n this.element = element;\n this.animationOptions = animationOptions;\n this.unit = unit;\n }\n\n callback(callbackFunction: (...args: any[]) => void): this {\n this.callbackFunction = callbackFunction;\n return this;\n }\n\n animate(animationParameters: IAnimationParameters, parameters: any): this {\n this.isAnimating = true;\n\n this.animateElement(animationParameters, parameters);\n\n // if no valid running, end animating immediately\n if (this.runnings.length === 0) {\n this.animationEnd();\n }\n return this;\n }\n\n stop(stopState: 'start' | 'end' = 'end', invokeCallback: boolean = true): this {\n // FIXME: wait for VRender to fix 'end' parameter\n this.runnings.forEach(running => running.stop(stopState));\n this.animationEnd(invokeCallback);\n return this;\n }\n\n pause(): this {\n this.runnings.forEach(running => running.pause());\n return this;\n }\n\n resume(): this {\n this.runnings.forEach(running => running.resume());\n return this;\n }\n\n startAt(startTime: number): this {\n this.runnings.forEach(running => {\n const initialDelay = this.unit.initialDelay;\n running.startAt(initialDelay + startTime);\n });\n return this;\n }\n\n getTotalAnimationTime() {\n const timeLineDuration = this.unit.initialDelay + this.unit.loopDuration * this.unit.loopCount;\n return this.unit.totalTime ?? timeLineDuration;\n }\n\n getEndAttributes() {\n return this.runnings.reduce((attributes, running) => {\n return Object.assign(attributes, running.getEndProps());\n }, {} as Record<string, any>);\n }\n\n private animationEnd(invokeCallback: boolean = true) {\n this.isAnimating = false;\n this.runnings = null;\n if (invokeCallback) {\n this.callbackFunction?.call(null);\n }\n }\n\n private animateElement(animationParameters: IAnimationParameters, parameters: any) {\n const graphicItem = this.element.getGraphicItem();\n\n if (!graphicItem) {\n return;\n }\n\n const graphicAnimate: IGraphicAnimate = graphicItem.animate();\n this.runnings.push(graphicAnimate);\n // initialDelay is only used at first loop\n graphicAnimate.startAt(this.unit.initialDelay);\n // execute loop animation\n graphicAnimate.wait(this.unit.loopDelay);\n this.unit.timeSlices.forEach(timeSlice => {\n this.animateTimeSlice(graphicAnimate, timeSlice, animationParameters, parameters);\n });\n graphicAnimate.wait(this.unit.loopDelayAfter);\n\n graphicAnimate.loop(this.unit.loopCount - 1);\n\n if (isValidNumber(this.unit.totalTime)) {\n // FIXME: use VRender api instead after VRender refactor is finished\n setTimeout(() => {\n if (graphicAnimate) {\n graphicAnimate.stop('end');\n }\n }, this.unit.totalTime);\n }\n\n graphicAnimate.onEnd(() => {\n this.runnings = this.runnings.filter(running => running !== graphicAnimate);\n if (this.runnings.length === 0) {\n this.animationEnd();\n }\n });\n }\n\n private animateTimeSlice(\n graphicAnimate: IGraphicAnimate,\n timeSlice: IAnimationTimeSlice,\n animationParameters: IAnimationParameters,\n parameters: any\n ) {\n const delay = timeSlice.delay as number;\n const delayAfter = timeSlice.delayAfter as number;\n const duration = timeSlice.duration as number;\n const effects = timeSlice.effects as IAnimationEffect[];\n\n // wait in loop animation before animation starts\n if (delay > 0) {\n graphicAnimate.wait(delay);\n }\n\n if (effects.length < 0) {\n graphicAnimate.wait(duration);\n } else {\n const customAnimates = effects\n .map((effect, index) => {\n const attributes =\n (effect.type\n ? typeAnimationAttributes(this.element, effect, animationParameters, parameters)\n : effect.channel\n ? channelAnimationAttributes(this.element, effect, animationParameters, parameters)\n : undefined) ?? {};\n\n const customOption = attributes.custom || effect?.custom;\n const customParametersOption = attributes?.customParameters || effect?.customParameters;\n\n if (\n attributes.from &&\n Object.keys(attributes.from).length &&\n this.unit &&\n this.animationOptions.timeline.controlOptions.immediatelyApply &&\n this.element.mark.markType !== 'component'\n ) {\n this.element.getGraphicItem().setAttributes(attributes.from);\n }\n\n const isCustomAnimate = isCustomAnimateCtor(customOption);\n const isCustomInterpolator = !isNil(customOption) && !isCustomAnimateCtor(customOption);\n\n if (isCustomInterpolator) {\n return new CustomInterpolator(attributes.from, attributes.to, duration, effect.easing, {\n interpolator: customOption as IAnimationChannelInterpolator,\n element: this.element,\n parameters: customParametersOption\n });\n } else if (isCustomAnimate) {\n return new (customOption as IAnimationCustomConstructor)(\n attributes.from,\n attributes.to,\n duration,\n effect.easing,\n customParametersOption\n );\n } else if (attributes.to) {\n return new AttributeAnimate(attributes.from, attributes.to, duration, effect.easing);\n }\n })\n .filter(animate => !isNil(animate));\n\n if (customAnimates.length === 1) {\n graphicAnimate.play(customAnimates[0]);\n } else if (customAnimates.length > 1) {\n graphicAnimate.play(new AnimateGroup(duration, customAnimates));\n }\n }\n\n if (delayAfter > 0) {\n graphicAnimate.wait(delayAfter);\n }\n }\n}\n"]}
|
package/cjs/graph/element.d.ts
CHANGED
|
@@ -54,6 +54,8 @@ export declare class Element implements IElement {
|
|
|
54
54
|
[channel: string]: any;
|
|
55
55
|
}): void;
|
|
56
56
|
getNextGraphicAttributes(): any;
|
|
57
|
+
getFinalAnimationAttribute(channel: string): any;
|
|
58
|
+
getFinalAnimationAttributes(): any;
|
|
57
59
|
protected setNextGraphicAttributes(attributes: {
|
|
58
60
|
[channel: string]: any;
|
|
59
61
|
}): void;
|
package/cjs/graph/element.js
CHANGED
|
@@ -285,6 +285,14 @@ class Element {
|
|
|
285
285
|
getNextGraphicAttributes() {
|
|
286
286
|
return this.graphicItem.nextAttrs;
|
|
287
287
|
}
|
|
288
|
+
getFinalAnimationAttribute(channel) {
|
|
289
|
+
var _a, _b;
|
|
290
|
+
return null !== (_b = null === (_a = this.getFinalGraphicAttributes()) || void 0 === _a ? void 0 : _a[channel]) && void 0 !== _b ? _b : this.getGraphicAttribute(channel);
|
|
291
|
+
}
|
|
292
|
+
getFinalAnimationAttributes() {
|
|
293
|
+
var _a;
|
|
294
|
+
return null !== (_a = this.getFinalGraphicAttributes()) && void 0 !== _a ? _a : this.graphicItem.attribute;
|
|
295
|
+
}
|
|
288
296
|
setNextGraphicAttributes(attributes) {
|
|
289
297
|
this.graphicItem.nextAttrs = attributes;
|
|
290
298
|
}
|