@visactor/vrender-components 0.19.24-alpha.4 → 0.19.24-alpha.6
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/axis/animate/group-transition.js +1 -1
- package/cjs/axis/animate/group-transition.js.map +1 -1
- package/cjs/axis/circle.js +12 -20
- package/cjs/axis/circle.js.map +1 -1
- package/cjs/axis/grid/base.js +12 -5
- package/cjs/axis/grid/base.js.map +1 -1
- package/cjs/axis/grid/line.js +12 -3
- package/cjs/axis/grid/line.js.map +1 -1
- package/cjs/axis/type.d.ts +0 -1
- package/cjs/axis/type.js.map +1 -1
- package/cjs/axis/util.d.ts +0 -2
- package/cjs/axis/util.js +2 -19
- package/cjs/axis/util.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/timeline/timeline.js +8 -4
- package/cjs/timeline/timeline.js.map +1 -1
- package/dist/index.es.js +102 -101
- package/es/axis/animate/group-transition.js +1 -1
- package/es/axis/animate/group-transition.js.map +1 -1
- package/es/axis/circle.js +13 -22
- package/es/axis/circle.js.map +1 -1
- package/es/axis/grid/base.js +13 -6
- package/es/axis/grid/base.js.map +1 -1
- package/es/axis/grid/line.js +11 -4
- package/es/axis/grid/line.js.map +1 -1
- package/es/axis/type.d.ts +0 -1
- package/es/axis/type.js.map +1 -1
- package/es/axis/util.d.ts +0 -2
- package/es/axis/util.js +0 -16
- package/es/axis/util.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/timeline/timeline.js +8 -4
- package/es/timeline/timeline.js.map +1 -1
- package/package.json +3 -3
package/cjs/timeline/timeline.js
CHANGED
|
@@ -77,8 +77,10 @@ class Timeline extends base_1.AbstractComponent {
|
|
|
77
77
|
}, activeLineDuration, easing)), this._symbolGroup) {
|
|
78
78
|
const size = this._symbolGroup.count - 1, delay = percent * (1 === size ? 0 : 400 / (size - 1)), delayNormal = percent * (1 === size ? 0 : 240 / (size - 1));
|
|
79
79
|
this._symbolGroup.forEachChildren(((symbol, i) => {
|
|
80
|
-
const originAttrs =
|
|
81
|
-
|
|
80
|
+
const originAttrs = {};
|
|
81
|
+
Object.keys(activeSymbolStyle).forEach((k => {
|
|
82
|
+
originAttrs[k] = symbol.attribute[k];
|
|
83
|
+
})), symbol.setAttributes({
|
|
82
84
|
opacity: 0
|
|
83
85
|
}), symbol.animate().wait(symbolDelay + delay * i).to({
|
|
84
86
|
opacity: 1
|
|
@@ -94,8 +96,10 @@ class Timeline extends base_1.AbstractComponent {
|
|
|
94
96
|
if (this._labelGroup) {
|
|
95
97
|
const size = this._labelGroup.count - 1, delay = percent * (1 === size ? 0 : 400 / (size - 1)), delayNormal = percent * (1 === size ? 0 : 240 / (size - 1));
|
|
96
98
|
this._labelGroup.forEachChildren(((label, i) => {
|
|
97
|
-
const originAttrs =
|
|
98
|
-
|
|
99
|
+
const originAttrs = {};
|
|
100
|
+
Object.keys(activeLabelStyle).forEach((k => {
|
|
101
|
+
originAttrs[k] = label.attribute[k];
|
|
102
|
+
})), label.setAttributes({
|
|
99
103
|
opacity: 0
|
|
100
104
|
}), label.animate().wait(symbolDelay + delay * i).to({
|
|
101
105
|
opacity: 1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/timeline/timeline.ts"],"names":[],"mappings":";;;AAAA,6CAAkD;AAClD,uCAAiD;AACjD,yCAAmD;AAMnD,IAAA,gCAAqB,GAAE,CAAC;AAExB,MAAa,QAAS,SAAQ,wBAA0C;IA4CtE,YAAY,UAAyB,EAAE,OAA0B;QAC/D,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,QAAQ,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QA5C/F,SAAI,GAA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IAAI,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;IAC/B,CAAC;;AA/RH,4BAgSC;AAvRQ,0BAAiB,GAA2B;IACjD,UAAU,EAAE,EAAE;IACd,eAAe,EAAE,cAAc;IAC/B,SAAS,EAAE,IAAI;IACf,WAAW,EAAE;QACX,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,EAAE;QACR,UAAU,EAAE,QAAQ;KACrB;IACD,iBAAiB,EAAE;QACjB,IAAI,EAAE,QAAQ;KACf;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,OAAO;QACf,SAAS,EAAE,CAAC;KACb;IACD,eAAe,EAAE;QACf,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,CAAC;KACb;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,KAAK;KACpB;IACD,gBAAgB,EAAE;QAChB,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,QAAQ;KACf;IACD,SAAS,EAAE,CAAC;CACb,CAAC","file":"timeline.js","sourcesContent":["import { isArray, merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport { loadTimelineComponent } from './register';\nimport type { TimelineAttrs } from './type';\nimport type { ComponentOptions } from '../interface';\nimport type { IGraphicAttribute, IGroup, ILine, IText } from '@visactor/vrender-core';\nimport type { ISymbol } from '@visactor/vrender-core';\n\nloadTimelineComponent();\n\nexport class Timeline extends AbstractComponent<Required<TimelineAttrs>> {\n name = 'timeline';\n\n private _line?: ILine;\n private _activeLine?: ILine;\n private _symbolGroup?: IGroup;\n private _labelGroup?: IGroup;\n private _timesPercent?: number[];\n\n static defaultAttributes: Partial<TimelineAttrs> = {\n labelSpace: 10,\n pointLayoutMode: 'space-around',\n animation: true,\n symbolStyle: {\n fill: 'black',\n size: 12,\n symbolType: 'circle'\n },\n activeSymbolStyle: {\n fill: 'orange'\n },\n lineStyle: {\n lineDash: [2, 2],\n lineCap: 'butt',\n stroke: 'black',\n lineWidth: 2\n },\n activeLineStyle: {\n stroke: 'orange',\n lineWidth: 4\n },\n labelStyle: {\n fontSize: 12,\n fill: 'black',\n textAlign: 'center',\n textBaseline: 'top'\n },\n activeLabelStyle: {\n fontSize: 14,\n fill: 'orange'\n },\n clipRange: 0\n };\n\n constructor(attributes: TimelineAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Timeline.defaultAttributes, attributes));\n }\n\n protected render(): void {\n const {\n width,\n lineStyle,\n activeLineStyle,\n symbolStyle,\n activeSymbolStyle,\n labelStyle,\n activeLabelStyle,\n times,\n pointLayoutMode,\n labelSpace,\n clipRange,\n animation\n } = this.attribute;\n\n if (!(times && times.length)) {\n return;\n }\n\n // 计算线段中心的y位置,考虑线宽和symbol宽度\n const symbolHeight = (isArray(symbolStyle.size) ? symbolStyle.size[1] : symbolStyle.size) || 0;\n const activeSymbolHeight =\n (isArray(activeSymbolStyle.size) ? activeSymbolStyle.size[1] : activeSymbolStyle.size) || 0;\n const lineSymbolHeight = Math.max(\n lineStyle.lineWidth || 0,\n activeLineStyle.lineWidth || 0,\n symbolHeight,\n activeSymbolHeight\n );\n const lineY = lineSymbolHeight / 2;\n const lineAttr = {\n y: lineY,\n points: [\n { x: 0, y: 0 },\n { x: width, y: 0 }\n ]\n };\n this._line = this.createOrUpdateChild(\n 'line-axes',\n {\n ...lineStyle,\n ...lineAttr\n },\n 'line'\n ) as ILine;\n this._activeLine = this.createOrUpdateChild(\n 'active-line-axes',\n {\n ...activeLineStyle,\n ...lineAttr,\n clipRange\n },\n 'line'\n ) as ILine;\n\n const activeWidth = width * clipRange;\n\n const symbolGroup = this.createOrUpdateChild(\n 'symbol-group',\n {\n y: lineY\n },\n 'group'\n ) as IGroup;\n const symbolSpace =\n times.length === 1\n ? width\n : pointLayoutMode === 'space-between'\n ? width / (times.length - 1)\n : width / times.length;\n const symbolStartX = pointLayoutMode === 'space-between' ? 0 : symbolSpace / 2;\n this._timesPercent = times.map((_, i) => (symbolStartX + symbolSpace * i) / width);\n\n times.forEach((item, i) => {\n const x = this._timesPercent[i] * width;\n symbolGroup.createOrUpdateChild(\n item.label,\n {\n ...symbolStyle,\n x\n },\n 'symbol'\n );\n });\n this._symbolGroup = symbolGroup;\n\n const labelY = lineSymbolHeight + labelSpace;\n const labelGroup = this.createOrUpdateChild(\n 'label-group',\n {\n y: labelY\n },\n 'group'\n ) as IGroup;\n\n times.forEach((item, i) => {\n const x = this._timesPercent[i] * width;\n labelGroup.createOrUpdateChild(\n item.label,\n {\n ...labelStyle,\n x,\n text: item.label\n },\n 'text'\n );\n });\n this._labelGroup = labelGroup;\n\n const setActive = (group: IGroup, activeStyle: Partial<IGraphicAttribute>) => {\n group.forEachChildren((label: IText) => {\n if (label.currentStates) {\n const currentStates = label.currentStates;\n label.clearStates();\n label.useStates(currentStates, false);\n }\n label.states = {\n active: activeStyle\n };\n if (label.attribute.x <= activeWidth) {\n label.useStates(['active'], animation);\n }\n });\n };\n\n setActive(labelGroup, activeLabelStyle);\n setActive(symbolGroup, activeSymbolStyle);\n }\n\n appearAnimate(animateConfig: { duration?: number; easing?: string }) {\n // 基准时间,line[0, 500], point[100, 600] 100 onebyone, pointNormal[600, 1000] 90+90 onebyone, activeLine[500, 700]\n // line和activeLine的clipRange\n const { duration = 1000, easing = 'quadOut' } = animateConfig;\n const { activeLabelStyle, activeSymbolStyle } = this.attribute;\n const percent = duration / 1000;\n const lineDuration = percent * 500;\n const activeLineDuration = percent * 200;\n const perSymbolDuration = percent * 100;\n const perSymbolNormalDuration = percent * 90;\n const symbolDelay = percent * 100;\n const symbolNormalDelay = percent * 600;\n if (this._line) {\n this._line.setAttributes({ clipRange: 0 });\n this._line.animate().to({ clipRange: 1 }, lineDuration, easing as any);\n }\n if (this._activeLine) {\n this._activeLine.setAttributes({ opacity: 0 });\n this._activeLine\n .animate()\n .wait(500)\n .to({ opacity: 1 }, activeLineDuration, easing as any);\n }\n if (this._symbolGroup) {\n const size = this._symbolGroup.count - 1;\n const delay = percent * (size === 1 ? 0 : (500 - 100) / (size - 1));\n const delayNormal = percent * (size === 1 ? 0 : (400 - 160) / (size - 1));\n this._symbolGroup.forEachChildren((symbol: ISymbol, i) => {\n const originAttrs = { ...symbol.attribute };\n symbol.setAttributes({ opacity: 0 });\n symbol\n .animate()\n .wait(symbolDelay + delay * i)\n .to({ opacity: 1 }, perSymbolDuration, easing as any);\n symbol\n .animate()\n .wait(symbolNormalDelay + delayNormal * i)\n .to({ scaleX: 1.8, scaleY: 1.8, ...activeSymbolStyle }, perSymbolNormalDuration, easing as any)\n .to({ scaleX: 1, scaleY: 1, ...originAttrs }, perSymbolNormalDuration, easing as any);\n });\n }\n if (this._labelGroup) {\n const size = this._labelGroup.count - 1;\n const delay = percent * (size === 1 ? 0 : (500 - 100) / (size - 1));\n const delayNormal = percent * (size === 1 ? 0 : (400 - 160) / (size - 1));\n this._labelGroup.forEachChildren((label: IText, i) => {\n const originAttrs = { ...label.attribute };\n label.setAttributes({ opacity: 0 });\n label\n .animate()\n .wait(symbolDelay + delay * i)\n .to({ opacity: 1 }, perSymbolDuration, easing as any);\n label\n .animate()\n .wait(symbolNormalDelay + delayNormal * i)\n .to({ dy: 10, ...activeLabelStyle }, perSymbolNormalDuration, easing as any)\n .to({ dy: 0, ...originAttrs }, perSymbolNormalDuration, easing as any);\n });\n }\n }\n\n goto(flag: 1 | -1, animateConfig: { duration?: number; easing?: string }) {\n let { clipRange } = this.attribute;\n const { animation } = this.attribute;\n\n // 合法性判断\n if (flag > 0) {\n if (clipRange >= 1) {\n return;\n } else if (clipRange < 0) {\n clipRange = 0;\n }\n } else {\n if (clipRange <= 0) {\n return;\n } else if (clipRange > 1) {\n clipRange = 1;\n }\n }\n\n if (clipRange !== this.attribute.clipRange) {\n this.setAttributes({ clipRange });\n }\n\n // 判断区间\n let i = 0;\n for (; i < this._timesPercent.length; i++) {\n if (clipRange < this._timesPercent[i]) {\n break;\n }\n }\n\n const nextClipRange = flag > 0 ? this._timesPercent[i] : this._timesPercent[i - 1] || 0;\n if (animation) {\n const { duration = 1000, easing = 'quadOut' } = animateConfig;\n const actDuration =\n (Math.abs(nextClipRange - clipRange) / (this._timesPercent[i] - (this._timesPercent[i - 1] ?? 0))) * duration;\n this.animate().to({ clipRange: nextClipRange }, actDuration, easing as any);\n } else {\n this.setAttributes({ clipRange: nextClipRange });\n }\n }\n\n forward(animateConfig: { duration?: number; easing?: string }) {\n this.goto(1, animateConfig);\n }\n\n backward(animateConfig: { duration?: number; easing?: string }) {\n this.goto(-1, animateConfig);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/timeline/timeline.ts"],"names":[],"mappings":";;;AAAA,6CAAkD;AAClD,uCAAiD;AACjD,yCAAmD;AAMnD,IAAA,gCAAqB,GAAE,CAAC;AAExB,MAAa,QAAS,SAAQ,wBAA0C;IA4CtE,YAAY,UAAyB,EAAE,OAA0B;QAC/D,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,QAAQ,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QA5C/F,SAAI,GAAG,UAAU,CAAC;IA6ClB,CAAC;IAES,MAAM;QACd,MAAM,EACJ,KAAK,EACL,SAAS,EACT,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,KAAK,EACL,eAAe,EACf,UAAU,EACV,SAAS,EACT,SAAS,EACV,GAAG,IAAI,CAAC,SAAS,CAAC;QAEnB,IAAI,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE;YAC5B,OAAO;SACR;QAGD,MAAM,YAAY,GAAG,CAAC,IAAA,gBAAO,EA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CAAC,EAAE,aAAa,CAAC,CAAC;IAC/B,CAAC;;AAtSH,4BAuSC;AA9RQ,0BAAiB,GAA2B;IACjD,UAAU,EAAE,EAAE;IACd,eAAe,EAAE,cAAc;IAC/B,SAAS,EAAE,IAAI;IACf,WAAW,EAAE;QACX,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,EAAE;QACR,UAAU,EAAE,QAAQ;KACrB;IACD,iBAAiB,EAAE;QACjB,IAAI,EAAE,QAAQ;KACf;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,OAAO;QACf,SAAS,EAAE,CAAC;KACb;IACD,eAAe,EAAE;QACf,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,CAAC;KACb;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,KAAK;KACpB;IACD,gBAAgB,EAAE;QAChB,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,QAAQ;KACf;IACD,SAAS,EAAE,CAAC;CACb,CAAC","file":"timeline.js","sourcesContent":["import { isArray, merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport { loadTimelineComponent } from './register';\nimport type { TimelineAttrs } from './type';\nimport type { ComponentOptions } from '../interface';\nimport { getTheme, type IGraphicAttribute, type IGroup, type ILine, type IText } from '@visactor/vrender-core';\nimport type { ISymbol } from '@visactor/vrender-core';\n\nloadTimelineComponent();\n\nexport class Timeline extends AbstractComponent<Required<TimelineAttrs>> {\n name = 'timeline';\n\n private _line?: ILine;\n private _activeLine?: ILine;\n private _symbolGroup?: IGroup;\n private _labelGroup?: IGroup;\n private _timesPercent?: number[];\n\n static defaultAttributes: Partial<TimelineAttrs> = {\n labelSpace: 10,\n pointLayoutMode: 'space-around',\n animation: true,\n symbolStyle: {\n fill: 'black',\n size: 12,\n symbolType: 'circle'\n },\n activeSymbolStyle: {\n fill: 'orange'\n },\n lineStyle: {\n lineDash: [2, 2],\n lineCap: 'butt',\n stroke: 'black',\n lineWidth: 2\n },\n activeLineStyle: {\n stroke: 'orange',\n lineWidth: 4\n },\n labelStyle: {\n fontSize: 12,\n fill: 'black',\n textAlign: 'center',\n textBaseline: 'top'\n },\n activeLabelStyle: {\n fontSize: 14,\n fill: 'orange'\n },\n clipRange: 0\n };\n\n constructor(attributes: TimelineAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Timeline.defaultAttributes, attributes));\n }\n\n protected render(): void {\n const {\n width,\n lineStyle,\n activeLineStyle,\n symbolStyle,\n activeSymbolStyle,\n labelStyle,\n activeLabelStyle,\n times,\n pointLayoutMode,\n labelSpace,\n clipRange,\n animation\n } = this.attribute;\n\n if (!(times && times.length)) {\n return;\n }\n\n // 计算线段中心的y位置,考虑线宽和symbol宽度\n const symbolHeight = (isArray(symbolStyle.size) ? symbolStyle.size[1] : symbolStyle.size) || 0;\n const activeSymbolHeight =\n (isArray(activeSymbolStyle.size) ? activeSymbolStyle.size[1] : activeSymbolStyle.size) || 0;\n const lineSymbolHeight = Math.max(\n lineStyle.lineWidth || 0,\n activeLineStyle.lineWidth || 0,\n symbolHeight,\n activeSymbolHeight\n );\n const lineY = lineSymbolHeight / 2;\n const lineAttr = {\n y: lineY,\n points: [\n { x: 0, y: 0 },\n { x: width, y: 0 }\n ]\n };\n this._line = this.createOrUpdateChild(\n 'line-axes',\n {\n ...lineStyle,\n ...lineAttr\n },\n 'line'\n ) as ILine;\n this._activeLine = this.createOrUpdateChild(\n 'active-line-axes',\n {\n ...activeLineStyle,\n ...lineAttr,\n clipRange\n },\n 'line'\n ) as ILine;\n\n const activeWidth = width * clipRange;\n\n const symbolGroup = this.createOrUpdateChild(\n 'symbol-group',\n {\n y: lineY\n },\n 'group'\n ) as IGroup;\n const symbolSpace =\n times.length === 1\n ? width\n : pointLayoutMode === 'space-between'\n ? width / (times.length - 1)\n : width / times.length;\n const symbolStartX = pointLayoutMode === 'space-between' ? 0 : symbolSpace / 2;\n this._timesPercent = times.map((_, i) => (symbolStartX + symbolSpace * i) / width);\n\n times.forEach((item, i) => {\n const x = this._timesPercent[i] * width;\n symbolGroup.createOrUpdateChild(\n item.label,\n {\n ...symbolStyle,\n x\n },\n 'symbol'\n );\n });\n this._symbolGroup = symbolGroup;\n\n const labelY = lineSymbolHeight + labelSpace;\n const labelGroup = this.createOrUpdateChild(\n 'label-group',\n {\n y: labelY\n },\n 'group'\n ) as IGroup;\n\n times.forEach((item, i) => {\n const x = this._timesPercent[i] * width;\n labelGroup.createOrUpdateChild(\n item.label,\n {\n ...labelStyle,\n x,\n text: item.label\n },\n 'text'\n );\n });\n this._labelGroup = labelGroup;\n\n const setActive = (group: IGroup, activeStyle: Partial<IGraphicAttribute>) => {\n group.forEachChildren((label: IText) => {\n if (label.currentStates) {\n const currentStates = label.currentStates;\n label.clearStates();\n label.useStates(currentStates, false);\n }\n label.states = {\n active: activeStyle\n };\n if (label.attribute.x <= activeWidth) {\n label.useStates(['active'], animation);\n }\n });\n };\n\n setActive(labelGroup, activeLabelStyle);\n setActive(symbolGroup, activeSymbolStyle);\n }\n\n appearAnimate(animateConfig: { duration?: number; easing?: string }) {\n // 基准时间,line[0, 500], point[100, 600] 100 onebyone, pointNormal[600, 1000] 90+90 onebyone, activeLine[500, 700]\n // line和activeLine的clipRange\n const { duration = 1000, easing = 'quadOut' } = animateConfig;\n const { activeLabelStyle, activeSymbolStyle } = this.attribute;\n const percent = duration / 1000;\n const lineDuration = percent * 500;\n const activeLineDuration = percent * 200;\n const perSymbolDuration = percent * 100;\n const perSymbolNormalDuration = percent * 90;\n const symbolDelay = percent * 100;\n const symbolNormalDelay = percent * 600;\n if (this._line) {\n this._line.setAttributes({ clipRange: 0 });\n this._line.animate().to({ clipRange: 1 }, lineDuration, easing as any);\n }\n if (this._activeLine) {\n this._activeLine.setAttributes({ opacity: 0 });\n this._activeLine\n .animate()\n .wait(500)\n .to({ opacity: 1 }, activeLineDuration, easing as any);\n }\n if (this._symbolGroup) {\n const size = this._symbolGroup.count - 1;\n const delay = percent * (size === 1 ? 0 : (500 - 100) / (size - 1));\n const delayNormal = percent * (size === 1 ? 0 : (400 - 160) / (size - 1));\n this._symbolGroup.forEachChildren((symbol: ISymbol, i) => {\n const originAttrs: Record<string, any> = {};\n Object.keys(activeSymbolStyle).forEach(k => {\n originAttrs[k] = (symbol.attribute as any)[k];\n });\n\n symbol.setAttributes({ opacity: 0 });\n symbol\n .animate()\n .wait(symbolDelay + delay * i)\n .to({ opacity: 1 }, perSymbolDuration, easing as any);\n symbol\n .animate()\n .wait(symbolNormalDelay + delayNormal * i)\n .to({ scaleX: 1.8, scaleY: 1.8, ...activeSymbolStyle }, perSymbolNormalDuration, easing as any)\n .to({ scaleX: 1, scaleY: 1, ...originAttrs }, perSymbolNormalDuration, easing as any);\n });\n }\n if (this._labelGroup) {\n const size = this._labelGroup.count - 1;\n const delay = percent * (size === 1 ? 0 : (500 - 100) / (size - 1));\n const delayNormal = percent * (size === 1 ? 0 : (400 - 160) / (size - 1));\n this._labelGroup.forEachChildren((label: IText, i) => {\n const originAttrs: Record<string, any> = {};\n Object.keys(activeLabelStyle).forEach(k => {\n originAttrs[k] = (label.attribute as any)[k];\n });\n label.setAttributes({ opacity: 0 });\n label\n .animate()\n .wait(symbolDelay + delay * i)\n .to({ opacity: 1 }, perSymbolDuration, easing as any);\n label\n .animate()\n .wait(symbolNormalDelay + delayNormal * i)\n .to({ dy: 10, ...activeLabelStyle }, perSymbolNormalDuration, easing as any)\n .to({ dy: 0, ...originAttrs }, perSymbolNormalDuration, easing as any);\n });\n }\n }\n\n goto(flag: 1 | -1, animateConfig: { duration?: number; easing?: string }) {\n let { clipRange } = this.attribute;\n const { animation } = this.attribute;\n\n // 合法性判断\n if (flag > 0) {\n if (clipRange >= 1) {\n return;\n } else if (clipRange < 0) {\n clipRange = 0;\n }\n } else {\n if (clipRange <= 0) {\n return;\n } else if (clipRange > 1) {\n clipRange = 1;\n }\n }\n\n if (clipRange !== this.attribute.clipRange) {\n this.setAttributes({ clipRange });\n }\n\n // 判断区间\n let i = 0;\n for (; i < this._timesPercent.length; i++) {\n if (clipRange < this._timesPercent[i]) {\n break;\n }\n }\n\n const nextClipRange = flag > 0 ? this._timesPercent[i] : this._timesPercent[i - 1] || 0;\n if (animation) {\n const { duration = 1000, easing = 'quadOut' } = animateConfig;\n const actDuration =\n (Math.abs(nextClipRange - clipRange) / (this._timesPercent[i] - (this._timesPercent[i - 1] ?? 0))) * duration;\n this.animate().to({ clipRange: nextClipRange }, actDuration, easing as any);\n } else {\n this.setAttributes({ clipRange: nextClipRange });\n }\n }\n\n forward(animateConfig: { duration?: number; easing?: string }) {\n this.goto(1, animateConfig);\n }\n\n backward(animateConfig: { duration?: number; easing?: string }) {\n this.goto(-1, animateConfig);\n }\n}\n"]}
|
package/dist/index.es.js
CHANGED
|
@@ -8105,7 +8105,7 @@ class Wrapper {
|
|
|
8105
8105
|
}
|
|
8106
8106
|
}
|
|
8107
8107
|
|
|
8108
|
-
const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
8108
|
+
const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", "fill", "stroke", "fontSize", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
8109
8109
|
class RichText extends Graphic {
|
|
8110
8110
|
constructor(params) {
|
|
8111
8111
|
super(params), this.type = "richtext", this._currentHoverIcon = null, this.numberType = RICHTEXT_NUMBER_TYPE;
|
|
@@ -8318,10 +8318,11 @@ class RichText extends Graphic {
|
|
|
8318
8318
|
let pickIcon;
|
|
8319
8319
|
return frameCache.icons.forEach(icon => {
|
|
8320
8320
|
var _a, _b;
|
|
8321
|
-
icon.AABBBounds.
|
|
8321
|
+
const bounds = icon.AABBBounds.clone();
|
|
8322
|
+
bounds.translate(icon._marginArray[3], icon._marginArray[0]), bounds.containsPoint({
|
|
8322
8323
|
x: point.x - x,
|
|
8323
8324
|
y: point.y - y
|
|
8324
|
-
}) && (pickIcon = icon, pickIcon.globalX = (null !== (_a = pickIcon.attribute.x) && void 0 !== _a ? _a : 0) + x, pickIcon.globalY = (null !== (_b = pickIcon.attribute.y) && void 0 !== _b ? _b : 0) + y);
|
|
8325
|
+
}) && (pickIcon = icon, pickIcon.globalX = (null !== (_a = pickIcon.attribute.x) && void 0 !== _a ? _a : 0) + x + icon._marginArray[3], pickIcon.globalY = (null !== (_b = pickIcon.attribute.y) && void 0 !== _b ? _b : 0) + y + icon._marginArray[0]);
|
|
8325
8326
|
}), pickIcon;
|
|
8326
8327
|
}
|
|
8327
8328
|
getNoWorkAnimateAttr() {
|
|
@@ -10301,26 +10302,27 @@ function createRectPath(path, x, y, width, height, rectCornerRadius, edgeCb) {
|
|
|
10301
10302
|
leftBottomPoint1 = [leftBottom[0] + _cornerRadius[3], leftBottom[1]],
|
|
10302
10303
|
leftBottomPoint2 = [leftBottom[0], leftBottom[1] - _cornerRadius[3]];
|
|
10303
10304
|
if (path.moveTo(leftTopPoint1[0], leftTopPoint1[1]), edgeCb && edgeCb[0] ? edgeCb[0](leftTopPoint1[0], leftTopPoint1[1], rightTopPoint1[0], rightTopPoint1[1]) : path.lineTo(rightTopPoint1[0], rightTopPoint1[1]), !arrayEqual(rightTopPoint1, rightTopPoint2)) {
|
|
10305
|
+
edgeCb && edgeCb[0] && path.moveTo(rightTopPoint1[0], rightTopPoint1[1]);
|
|
10304
10306
|
const centerX = rightTopPoint1[0],
|
|
10305
10307
|
centerY = rightTopPoint1[1] + _cornerRadius[1];
|
|
10306
10308
|
path.arc(centerX, centerY, _cornerRadius[1], -halfPi, 0, !1);
|
|
10307
10309
|
}
|
|
10308
|
-
if (edgeCb && edgeCb[1] ? edgeCb[1](
|
|
10310
|
+
if (edgeCb && edgeCb[1] ? edgeCb[1](rightTopPoint2[0], rightTopPoint2[1], rightBottomPoint2[0], rightBottomPoint2[1]) : path.lineTo(rightBottomPoint2[0], rightBottomPoint2[1]), !arrayEqual(rightBottomPoint1, rightBottomPoint2)) {
|
|
10309
10311
|
const centerX = rightBottomPoint2[0] - _cornerRadius[2],
|
|
10310
10312
|
centerY = rightBottomPoint2[1];
|
|
10311
|
-
path.arc(centerX, centerY, _cornerRadius[2], 0, halfPi, !1);
|
|
10313
|
+
edgeCb && edgeCb[1] && path.moveTo(rightBottomPoint2[0], rightBottomPoint2[1]), path.arc(centerX, centerY, _cornerRadius[2], 0, halfPi, !1);
|
|
10312
10314
|
}
|
|
10313
|
-
if (edgeCb && edgeCb[2] ? edgeCb[2](
|
|
10315
|
+
if (edgeCb && edgeCb[2] ? edgeCb[2](rightBottomPoint1[0], rightBottomPoint1[1], leftBottomPoint1[0], leftBottomPoint1[1]) : path.lineTo(leftBottomPoint1[0], leftBottomPoint1[1]), !arrayEqual(leftBottomPoint1, leftBottomPoint2)) {
|
|
10314
10316
|
const centerX = leftBottomPoint1[0],
|
|
10315
10317
|
centerY = leftBottomPoint1[1] - _cornerRadius[3];
|
|
10316
|
-
path.arc(centerX, centerY, _cornerRadius[3], halfPi, pi, !1);
|
|
10318
|
+
edgeCb && edgeCb[2] && path.moveTo(leftBottomPoint1[0], leftBottomPoint1[1]), path.arc(centerX, centerY, _cornerRadius[3], halfPi, pi, !1);
|
|
10317
10319
|
}
|
|
10318
|
-
if (edgeCb && edgeCb[3] ? edgeCb[3](
|
|
10320
|
+
if (edgeCb && edgeCb[3] ? edgeCb[3](leftBottomPoint2[0], leftBottomPoint2[1], leftTopPoint2[0], leftTopPoint2[1]) : path.lineTo(leftTopPoint2[0], leftTopPoint2[1]), !arrayEqual(leftTopPoint1, leftTopPoint2)) {
|
|
10319
10321
|
const centerX = leftTopPoint1[0],
|
|
10320
10322
|
centerY = leftTopPoint1[1] + _cornerRadius[0];
|
|
10321
|
-
path.arc(centerX, centerY, _cornerRadius[0], pi, pi + halfPi, !1);
|
|
10323
|
+
edgeCb && edgeCb[3] && path.moveTo(leftTopPoint2[0], leftTopPoint2[1]), path.arc(centerX, centerY, _cornerRadius[0], pi, pi + halfPi, !1);
|
|
10322
10324
|
}
|
|
10323
|
-
return path.closePath(), path;
|
|
10325
|
+
return !edgeCb && path.closePath(), path;
|
|
10324
10326
|
}
|
|
10325
10327
|
|
|
10326
10328
|
var __decorate$K = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
@@ -10416,20 +10418,21 @@ let SplitRectAfterRenderContribution = class {
|
|
|
10416
10418
|
width: width,
|
|
10417
10419
|
height: height
|
|
10418
10420
|
} = rect.attribute;
|
|
10419
|
-
if (width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0, Array.isArray(stroke) && stroke.some(s => !1 === s))
|
|
10421
|
+
if (width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0, Array.isArray(stroke) && stroke.some(s => !1 === s)) {
|
|
10422
|
+
if (context.setStrokeStyle(rect, rect.attribute, x, y, groupAttribute), !(0 === cornerRadius || isArray(cornerRadius) && cornerRadius.every(num => 0 === num))) {
|
|
10423
|
+
let lastStroke,
|
|
10424
|
+
lastStrokeI = 0;
|
|
10425
|
+
return createRectPath(context, x, y, width, height, cornerRadius, new Array(4).fill(0).map((_, i) => (x1, y1, x2, y2) => {
|
|
10426
|
+
stroke[i] && (lastStrokeI === i - 1 && stroke[i] === lastStroke || (context.setStrokeStyle(rect, Object.assign(Object.assign({}, rect.attribute), {
|
|
10427
|
+
stroke: stroke[i]
|
|
10428
|
+
}), x, y, groupAttribute), context.beginPath(), context.moveTo(x1, y1), lastStroke = stroke[i]), lastStrokeI = i, context.lineTo(x2, y2), context.stroke(), 3 === i && context.beginPath());
|
|
10429
|
+
})), void context.stroke();
|
|
10430
|
+
}
|
|
10420
10431
|
if (context.beginPath(), context.moveTo(x, y), stroke[0] ? context.lineTo(x + width, y) : context.moveTo(x + width, y), stroke[1] ? context.lineTo(x + width, y + height) : context.moveTo(x + width, y + height), stroke[2] ? context.lineTo(x, y + height) : context.moveTo(x, y + height), stroke[3]) {
|
|
10421
10432
|
const adjustY = stroke[0] ? y - context.lineWidth / 2 : y;
|
|
10422
10433
|
context.lineTo(x, adjustY);
|
|
10423
10434
|
} else context.moveTo(x, y);
|
|
10424
10435
|
context.stroke();
|
|
10425
|
-
} else {
|
|
10426
|
-
let lastStroke,
|
|
10427
|
-
lastStrokeI = 0;
|
|
10428
|
-
createRectPath(context, x, y, width, height, cornerRadius, new Array(4).fill(0).map((_, i) => (x1, y1, x2, y2) => {
|
|
10429
|
-
stroke[i] && (lastStrokeI === i - 1 && stroke[i] === lastStroke || (context.setStrokeStyle(rect, Object.assign(Object.assign({}, rect.attribute), {
|
|
10430
|
-
stroke: stroke[i]
|
|
10431
|
-
}), x, y, groupAttribute), context.beginPath(), context.moveTo(x1, y1), lastStroke = stroke[i]), lastStrokeI = i, context.lineTo(x2, y2), context.stroke());
|
|
10432
|
-
}));
|
|
10433
10436
|
}
|
|
10434
10437
|
}
|
|
10435
10438
|
};
|
|
@@ -11334,9 +11337,9 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11334
11337
|
data = this.valid(area, areaAttribute, fillCb, strokeCb);
|
|
11335
11338
|
if (!data) return;
|
|
11336
11339
|
const {
|
|
11337
|
-
doFill: doFill
|
|
11338
|
-
doStroke: doStroke
|
|
11340
|
+
doFill: doFill
|
|
11339
11341
|
} = data,
|
|
11342
|
+
doStroke = data.doStroke && data.sVisible,
|
|
11340
11343
|
{
|
|
11341
11344
|
clipRange = areaAttribute.clipRange,
|
|
11342
11345
|
closePath: closePath,
|
|
@@ -12298,7 +12301,7 @@ class ShadowRootDrawItemInterceptorContribution {
|
|
|
12298
12301
|
const m = graphic.globalTransMatrix.getInverse();
|
|
12299
12302
|
drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m), drawContribution.backupDirtyBounds.copy(drawContribution.dirtyBounds);
|
|
12300
12303
|
}
|
|
12301
|
-
return drawContribution.renderGroup(graphic.shadowRoot, drawContext,
|
|
12304
|
+
return drawContribution.renderGroup(graphic.shadowRoot, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)), context.highPerformanceRestore(), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds && (drawContribution.dirtyBounds.copy(tempDirtyBounds), drawContribution.backupDirtyBounds.copy(tempBackupDirtyBounds)), !0;
|
|
12302
12305
|
}
|
|
12303
12306
|
}
|
|
12304
12307
|
class DebugDrawItemInterceptorContribution {
|
|
@@ -19215,33 +19218,6 @@ function getPolarAngleLabelPosition(angle, center, radius, labelOffset, inside,
|
|
|
19215
19218
|
const vector = getCircleVerticalVector(labelOffset || 1, labelPoint, center, inside);
|
|
19216
19219
|
return getCircleLabelPosition(labelPoint, vector, text, style);
|
|
19217
19220
|
}
|
|
19218
|
-
function getCirclePoints(center, count, radius, startAngle, endAngle) {
|
|
19219
|
-
const points = [];
|
|
19220
|
-
const range = endAngle - startAngle;
|
|
19221
|
-
for (let i = 0; i < count; i++) {
|
|
19222
|
-
const angle = startAngle + (i * range) / count;
|
|
19223
|
-
points.push(polarToCartesian$1(center, radius, angle));
|
|
19224
|
-
}
|
|
19225
|
-
return points;
|
|
19226
|
-
}
|
|
19227
|
-
function getPolygonPath(points, closed) {
|
|
19228
|
-
let path = '';
|
|
19229
|
-
if (points.length === 0) {
|
|
19230
|
-
return path;
|
|
19231
|
-
}
|
|
19232
|
-
points.forEach((point, index) => {
|
|
19233
|
-
if (index === 0) {
|
|
19234
|
-
path = `M${point.x},${point.y}`;
|
|
19235
|
-
}
|
|
19236
|
-
else {
|
|
19237
|
-
path += `L${point.x},${point.y}`;
|
|
19238
|
-
}
|
|
19239
|
-
});
|
|
19240
|
-
if (closed) {
|
|
19241
|
-
path += 'Z';
|
|
19242
|
-
}
|
|
19243
|
-
return path;
|
|
19244
|
-
}
|
|
19245
19221
|
|
|
19246
19222
|
const dispatchHoverState = (e, container, lastHover) => {
|
|
19247
19223
|
const target = e.target;
|
|
@@ -20556,29 +20532,22 @@ class CircleAxis extends AxisBase {
|
|
|
20556
20532
|
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, CircleAxis.defaultAttributes, attributes));
|
|
20557
20533
|
}
|
|
20558
20534
|
renderLine(container) {
|
|
20559
|
-
const { startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE, radius, center, innerRadius = 0, line = {}, inside = false
|
|
20535
|
+
const { startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE, radius, center, innerRadius = 0, line = {}, inside = false } = this.attribute;
|
|
20560
20536
|
let arcRadius = radius;
|
|
20561
20537
|
let arcInnerRadius = innerRadius;
|
|
20562
20538
|
if (inside && innerRadius > 0) {
|
|
20563
20539
|
arcRadius = innerRadius;
|
|
20564
20540
|
arcInnerRadius = 0;
|
|
20565
20541
|
}
|
|
20566
|
-
|
|
20567
|
-
|
|
20568
|
-
|
|
20569
|
-
|
|
20570
|
-
|
|
20571
|
-
else {
|
|
20572
|
-
const arcAttrs = Object.assign(Object.assign(Object.assign({}, center), { startAngle,
|
|
20573
|
-
endAngle, radius: arcRadius, innerRadius: arcInnerRadius }), line.style);
|
|
20574
|
-
lineGraphic = graphicCreator.circle(arcAttrs);
|
|
20575
|
-
}
|
|
20576
|
-
lineGraphic.name = AXIS_ELEMENT_NAME.line;
|
|
20577
|
-
lineGraphic.id = this._getNodeId('line');
|
|
20542
|
+
const arcAttrs = Object.assign(Object.assign(Object.assign({}, center), { startAngle,
|
|
20543
|
+
endAngle, radius: arcRadius, innerRadius: arcInnerRadius }), line.style);
|
|
20544
|
+
const axisLine = graphicCreator.circle(arcAttrs);
|
|
20545
|
+
axisLine.name = AXIS_ELEMENT_NAME.line;
|
|
20546
|
+
axisLine.id = this._getNodeId('line');
|
|
20578
20547
|
if (!isEmpty(line.state)) {
|
|
20579
|
-
|
|
20548
|
+
axisLine.states = merge({}, DEFAULT_STATES$1, line.state);
|
|
20580
20549
|
}
|
|
20581
|
-
container.add(
|
|
20550
|
+
container.add(axisLine);
|
|
20582
20551
|
}
|
|
20583
20552
|
getTitleAttribute() {
|
|
20584
20553
|
var _a, _b, _c;
|
|
@@ -20747,34 +20716,33 @@ class GroupTransition extends ACustomAnimate {
|
|
|
20747
20716
|
onStart() {
|
|
20748
20717
|
let duration = this.duration;
|
|
20749
20718
|
let easing = this.easing;
|
|
20750
|
-
this._newElementAttrMap
|
|
20751
|
-
|
|
20752
|
-
|
|
20753
|
-
|
|
20754
|
-
|
|
20755
|
-
|
|
20756
|
-
|
|
20757
|
-
|
|
20758
|
-
|
|
20759
|
-
|
|
20760
|
-
|
|
20761
|
-
|
|
20762
|
-
|
|
20763
|
-
|
|
20764
|
-
|
|
20765
|
-
return true;
|
|
20766
|
-
}
|
|
20767
|
-
return false;
|
|
20719
|
+
Object.keys(this._newElementAttrMap).forEach(id => {
|
|
20720
|
+
var _a;
|
|
20721
|
+
const { node, attrs, state } = this._newElementAttrMap[id];
|
|
20722
|
+
if (state === 'enter') {
|
|
20723
|
+
const { enter = {} } = (_a = this.params) !== null && _a !== void 0 ? _a : {};
|
|
20724
|
+
duration = isValidNumber(enter.duration) ? enter.duration : duration;
|
|
20725
|
+
easing = enter.easing ? enter.easing : easing;
|
|
20726
|
+
}
|
|
20727
|
+
if (node.type === 'path') {
|
|
20728
|
+
node
|
|
20729
|
+
.animate({
|
|
20730
|
+
interpolate(key, ratio, from, to, nextAttributes) {
|
|
20731
|
+
if (key === 'path') {
|
|
20732
|
+
nextAttributes.path = interpolateString(from, to)(ratio);
|
|
20733
|
+
return true;
|
|
20768
20734
|
}
|
|
20769
|
-
|
|
20770
|
-
|
|
20771
|
-
}
|
|
20772
|
-
|
|
20773
|
-
|
|
20774
|
-
|
|
20775
|
-
|
|
20776
|
-
|
|
20777
|
-
|
|
20735
|
+
return false;
|
|
20736
|
+
}
|
|
20737
|
+
})
|
|
20738
|
+
.to(attrs, duration, easing);
|
|
20739
|
+
}
|
|
20740
|
+
else {
|
|
20741
|
+
node
|
|
20742
|
+
.animate()
|
|
20743
|
+
.to(attrs, duration, easing);
|
|
20744
|
+
}
|
|
20745
|
+
});
|
|
20778
20746
|
}
|
|
20779
20747
|
onUpdate(end, ratio, out) {
|
|
20780
20748
|
}
|
|
@@ -21319,6 +21287,24 @@ const ticks = (scale, op) => {
|
|
|
21319
21287
|
return convertDomainToTickData(scale.domain());
|
|
21320
21288
|
};
|
|
21321
21289
|
|
|
21290
|
+
function getLinePath(points, closed) {
|
|
21291
|
+
let path = '';
|
|
21292
|
+
if (points.length === 0) {
|
|
21293
|
+
return path;
|
|
21294
|
+
}
|
|
21295
|
+
points.forEach((point, index) => {
|
|
21296
|
+
if (index === 0) {
|
|
21297
|
+
path = `M${point.x},${point.y}`;
|
|
21298
|
+
}
|
|
21299
|
+
else {
|
|
21300
|
+
path += `L${point.x},${point.y}`;
|
|
21301
|
+
}
|
|
21302
|
+
});
|
|
21303
|
+
if (closed) {
|
|
21304
|
+
path += 'Z';
|
|
21305
|
+
}
|
|
21306
|
+
return path;
|
|
21307
|
+
}
|
|
21322
21308
|
function getArcPath(center, points, reverse, closed) {
|
|
21323
21309
|
let path = '';
|
|
21324
21310
|
if (!center || points.length === 0) {
|
|
@@ -21351,8 +21337,8 @@ function getRegionPath(from, to, attribute) {
|
|
|
21351
21337
|
const fromStart = from[0];
|
|
21352
21338
|
const toEnd = reversePoints[0];
|
|
21353
21339
|
const center = attribute.center;
|
|
21354
|
-
regionPath =
|
|
21355
|
-
nextPath =
|
|
21340
|
+
regionPath = getLinePath(from, !!closed);
|
|
21341
|
+
nextPath = getLinePath(reversePoints, !!closed);
|
|
21356
21342
|
const toEndRadius = PointService.distancePP(toEnd, center);
|
|
21357
21343
|
const fromStartRadius = PointService.distancePP(fromStart, center);
|
|
21358
21344
|
regionPath += `A${toEndRadius},${toEndRadius},0,0,1,${toEnd.x},${toEnd.y}L${toEnd.x},${toEnd.y}`;
|
|
@@ -21364,8 +21350,8 @@ function getRegionPath(from, to, attribute) {
|
|
|
21364
21350
|
nextPath = getArcPath(center, reversePoints, true, !!closed);
|
|
21365
21351
|
}
|
|
21366
21352
|
else if (type === 'line' || type === 'polygon') {
|
|
21367
|
-
regionPath =
|
|
21368
|
-
nextPath =
|
|
21353
|
+
regionPath = getLinePath(from, !!closed);
|
|
21354
|
+
nextPath = getLinePath(reversePoints, !!closed);
|
|
21369
21355
|
}
|
|
21370
21356
|
if (closed) {
|
|
21371
21357
|
regionPath += nextPath;
|
|
@@ -21426,7 +21412,7 @@ class BaseGrid extends AbstractComponent {
|
|
|
21426
21412
|
const { id, points } = item;
|
|
21427
21413
|
let path = '';
|
|
21428
21414
|
if (type === 'line' || type === 'polygon') {
|
|
21429
|
-
path =
|
|
21415
|
+
path = getLinePath(points, !!closed);
|
|
21430
21416
|
}
|
|
21431
21417
|
else if (type === 'circle') {
|
|
21432
21418
|
const { center } = this.attribute;
|
|
@@ -21448,7 +21434,7 @@ class BaseGrid extends AbstractComponent {
|
|
|
21448
21434
|
const dirLen = Math.sqrt(dir.x * dir.x + dir.y * dir.y);
|
|
21449
21435
|
const ratio = depth / dirLen;
|
|
21450
21436
|
nextPoints.push({ x: points[0].x + dir.x * ratio, y: points[0].y + dir.y * ratio });
|
|
21451
|
-
const path =
|
|
21437
|
+
const path = getLinePath(nextPoints, !!closed);
|
|
21452
21438
|
const deltaX = abs(nextPoints[0].x - nextPoints[1].x);
|
|
21453
21439
|
const deltaY = abs(nextPoints[0].y - nextPoints[1].y);
|
|
21454
21440
|
const shape = graphicCreator.path(Object.assign({ path, z: 0, alpha: deltaX > deltaY ? ((points[1].x - points[0].x > 0 ? -1 : 1) * pi) / 2 : 0, beta: deltaX < deltaY ? -pi / 2 : 0, anchor3d: deltaX > deltaY ? [nextPoints[0].x, 0] : [0, nextPoints[0].y] }, (isFunction(style)
|
|
@@ -21504,6 +21490,15 @@ BaseGrid.defaultAttributes = {
|
|
|
21504
21490
|
}
|
|
21505
21491
|
};
|
|
21506
21492
|
|
|
21493
|
+
function getCirclePoints(center, count, radius, startAngle, endAngle) {
|
|
21494
|
+
const points = [];
|
|
21495
|
+
const range = endAngle - startAngle;
|
|
21496
|
+
for (let i = 0; i < count; i++) {
|
|
21497
|
+
const angle = startAngle + (i * range) / count;
|
|
21498
|
+
points.push(polarToCartesian$1(center, radius, angle));
|
|
21499
|
+
}
|
|
21500
|
+
return points;
|
|
21501
|
+
}
|
|
21507
21502
|
loadLineAxisGridComponent();
|
|
21508
21503
|
class LineAxisGrid extends BaseGrid {
|
|
21509
21504
|
constructor(attributes, options) {
|
|
@@ -29149,7 +29144,10 @@ class Timeline extends AbstractComponent {
|
|
|
29149
29144
|
const delay = percent * (size === 1 ? 0 : (500 - 100) / (size - 1));
|
|
29150
29145
|
const delayNormal = percent * (size === 1 ? 0 : (400 - 160) / (size - 1));
|
|
29151
29146
|
this._symbolGroup.forEachChildren((symbol, i) => {
|
|
29152
|
-
const originAttrs =
|
|
29147
|
+
const originAttrs = {};
|
|
29148
|
+
Object.keys(activeSymbolStyle).forEach(k => {
|
|
29149
|
+
originAttrs[k] = symbol.attribute[k];
|
|
29150
|
+
});
|
|
29153
29151
|
symbol.setAttributes({ opacity: 0 });
|
|
29154
29152
|
symbol
|
|
29155
29153
|
.animate()
|
|
@@ -29167,7 +29165,10 @@ class Timeline extends AbstractComponent {
|
|
|
29167
29165
|
const delay = percent * (size === 1 ? 0 : (500 - 100) / (size - 1));
|
|
29168
29166
|
const delayNormal = percent * (size === 1 ? 0 : (400 - 160) / (size - 1));
|
|
29169
29167
|
this._labelGroup.forEachChildren((label, i) => {
|
|
29170
|
-
const originAttrs =
|
|
29168
|
+
const originAttrs = {};
|
|
29169
|
+
Object.keys(activeLabelStyle).forEach(k => {
|
|
29170
|
+
originAttrs[k] = label.attribute[k];
|
|
29171
|
+
});
|
|
29171
29172
|
label.setAttributes({ opacity: 0 });
|
|
29172
29173
|
label
|
|
29173
29174
|
.animate()
|
|
@@ -29617,6 +29618,6 @@ EmptyTip.defaultAttributes = {
|
|
|
29617
29618
|
}
|
|
29618
29619
|
};
|
|
29619
29620
|
|
|
29620
|
-
const version = "0.19.24-alpha.
|
|
29621
|
+
const version = "0.19.24-alpha.6";
|
|
29621
29622
|
|
|
29622
|
-
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AreaLabel, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupFadeIn, GroupFadeOut, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineDataLabel, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Timeline, Title, Tooltip, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, clampRadian, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, direction, fuzzyEqualNumber, getCircleLabelPosition,
|
|
29623
|
+
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AreaLabel, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupFadeIn, GroupFadeOut, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineDataLabel, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Timeline, Title, Tooltip, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, clampRadian, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, direction, fuzzyEqualNumber, getCircleLabelPosition, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, loadPoptip, measureTextSize, normalize, reactAttributeTransform, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, ticks, traverseGroup, version };
|
|
@@ -48,7 +48,7 @@ export class GroupTransition extends ACustomAnimate {
|
|
|
48
48
|
}
|
|
49
49
|
onStart() {
|
|
50
50
|
let duration = this.duration, easing = this.easing;
|
|
51
|
-
|
|
51
|
+
Object.keys(this._newElementAttrMap).forEach((id => {
|
|
52
52
|
var _a;
|
|
53
53
|
const {node: node, attrs: attrs, state: state} = this._newElementAttrMap[id];
|
|
54
54
|
if ("enter" === state) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/axis/animate/group-transition.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,OAAO,eAAgB,SAAQ,cAAmB;IAAxD;;QAIE,SAAI,GAAG,WAAW,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/axis/animate/group-transition.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,OAAO,eAAgB,SAAQ,cAAmB;IAAxD;;QAIE,SAAI,GAAG,WAAW,CAAC,MAAM,CAAC;IA+F5B,CAAC;IA7FC,MAAM;QAEJ,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,YAA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E,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;4BACzD,OAAO,IAAI,CAAC;yBACb;wBAED,OAAO,KAAK,CAAC;oBACf,CAAC;iBACF,CAAC;qBAED,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAoB,CAAC,CAAC;aAC9C;iBAAM;gBACJ,IAAiB;qBACf,OAAO,EAAE;qBAET,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAoB,CAAC,CAAC;aAC9C;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;IAE9D,CAAC;CACF","file":"group-transition.js","sourcesContent":["import type { EasingType, IGraphic, IGroup } from '@visactor/vrender-core';\nimport { ACustomAnimate, AnimateMode } from '@visactor/vrender-core';\nimport type { Dict } from '@visactor/vutils';\nimport { cloneDeep, interpolateString, isEqual, isValidNumber } from '@visactor/vutils';\nimport { traverseGroup } from '../../util';\n\nexport class GroupTransition extends ACustomAnimate<any> {\n declare target: IGroup;\n\n private _newElementAttrMap: Dict<any>;\n mode = AnimateMode.NORMAL; // 组件的群组动画不需要设置走 AnimateMode.SET_ATTR_IMMEDIATELY\n\n onBind(): void {\n // @ts-ignore\n const currentInnerView = this.target.getInnerView();\n // @ts-ignore\n const prevInnerView = this.target.getPrevInnerView();\n if (!prevInnerView) {\n return;\n }\n\n this._newElementAttrMap = {};\n\n // 遍历新的场景树,将新节点属性更新为旧节点\n // TODO: 目前只处理更新场景\n traverseGroup(currentInnerView, (el: IGraphic) => {\n if ((el as IGraphic).type !== 'group' && el.id) {\n const oldEl = prevInnerView[el.id];\n if (oldEl) {\n if (!isEqual((el as IGraphic).attribute, (oldEl as IGraphic).attribute)) {\n // 更新\n const newProps = cloneDeep((el as IGraphic).attribute);\n this._newElementAttrMap[el.id] = {\n state: 'update',\n node: el,\n attrs: {\n ...newProps,\n opacity: newProps.opacity ?? 1,\n fillOpacity: newProps.fillOpacity ?? 1,\n strokeOpacity: newProps.strokeOpacity ?? 1\n }\n };\n\n (el as IGraphic).setAttributes((oldEl as IGraphic).attribute);\n }\n } else {\n // 新入场元素,进行 fadeIn 动画\n const finalOpacityAttrs = {\n opacity: el.attribute.opacity ?? 1,\n fillOpacity: el.attribute.fillOpacity ?? 1,\n strokeOpacity: el.attribute.strokeOpacity ?? 1\n };\n this._newElementAttrMap[el.id] = {\n state: 'enter',\n node: el,\n attrs: finalOpacityAttrs\n };\n (el as IGraphic).setAttributes({\n opacity: 0,\n fillOpacity: 0,\n strokeOpacity: 0\n });\n }\n }\n });\n }\n\n onStart(): void {\n let duration = this.duration;\n let easing = this.easing;\n\n // 新的场景树\n Object.keys(this._newElementAttrMap).forEach(id => {\n const { node, attrs, state } = this._newElementAttrMap[id];\n if (state === 'enter') {\n const { enter = {} } = this.params ?? {};\n duration = isValidNumber(enter.duration) ? enter.duration : duration;\n easing = enter.easing ? enter.easing : easing;\n }\n if ((node as IGraphic).type === 'path') {\n (node as IGraphic)\n .animate({\n interpolate(key: string, ratio: number, from: any, to: any, nextAttributes: any) {\n if (key === 'path') {\n nextAttributes.path = interpolateString(from, to)(ratio);\n return true;\n }\n\n return false;\n }\n })\n // .wait(delay)\n .to(attrs, duration, easing as EasingType);\n } else {\n (node as IGraphic)\n .animate()\n // .wait(delay)\n .to(attrs, duration, easing as EasingType);\n }\n });\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n // do nothing\n }\n}\n"]}
|
package/es/axis/circle.js
CHANGED
|
@@ -10,7 +10,7 @@ var __rest = this && this.__rest || function(s, e) {
|
|
|
10
10
|
|
|
11
11
|
import { graphicCreator } from "@visactor/vrender-core";
|
|
12
12
|
|
|
13
|
-
import { isNil, get, merge, isNumberClose, isEmpty, mixin
|
|
13
|
+
import { isNil, get, merge, isNumberClose, isEmpty, mixin } from "@visactor/vutils";
|
|
14
14
|
|
|
15
15
|
import { POLAR_END_ANGLE, POLAR_START_ANGLE } from "../constant";
|
|
16
16
|
|
|
@@ -22,7 +22,7 @@ import { AXIS_ELEMENT_NAME, DEFAULT_STATES } from "./constant";
|
|
|
22
22
|
|
|
23
23
|
import { CircleAxisMixin } from "./mixin/circle";
|
|
24
24
|
|
|
25
|
-
import { getCircleLabelPosition
|
|
25
|
+
import { getCircleLabelPosition } from "./util";
|
|
26
26
|
|
|
27
27
|
import { loadCircleAxisComponent } from "./register";
|
|
28
28
|
|
|
@@ -33,26 +33,17 @@ export class CircleAxis extends AxisBase {
|
|
|
33
33
|
super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, CircleAxis.defaultAttributes, attributes));
|
|
34
34
|
}
|
|
35
35
|
renderLine(container) {
|
|
36
|
-
const {startAngle: startAngle = POLAR_START_ANGLE, endAngle: endAngle = POLAR_END_ANGLE, radius: radius, center: center, innerRadius: innerRadius = 0, line: line = {}, inside: inside = !1
|
|
37
|
-
let
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
endAngle: endAngle,
|
|
48
|
-
radius: arcRadius,
|
|
49
|
-
innerRadius: arcInnerRadius
|
|
50
|
-
}), line.style);
|
|
51
|
-
lineGraphic = graphicCreator.circle(arcAttrs);
|
|
52
|
-
}
|
|
53
|
-
lineGraphic.name = AXIS_ELEMENT_NAME.line, lineGraphic.id = this._getNodeId("line"),
|
|
54
|
-
isEmpty(line.state) || (lineGraphic.states = merge({}, DEFAULT_STATES, line.state)),
|
|
55
|
-
container.add(lineGraphic);
|
|
36
|
+
const {startAngle: startAngle = POLAR_START_ANGLE, endAngle: endAngle = POLAR_END_ANGLE, radius: radius, center: center, innerRadius: innerRadius = 0, line: line = {}, inside: inside = !1} = this.attribute;
|
|
37
|
+
let arcRadius = radius, arcInnerRadius = innerRadius;
|
|
38
|
+
inside && innerRadius > 0 && (arcRadius = innerRadius, arcInnerRadius = 0);
|
|
39
|
+
const arcAttrs = Object.assign(Object.assign(Object.assign({}, center), {
|
|
40
|
+
startAngle: startAngle,
|
|
41
|
+
endAngle: endAngle,
|
|
42
|
+
radius: arcRadius,
|
|
43
|
+
innerRadius: arcInnerRadius
|
|
44
|
+
}), line.style), axisLine = graphicCreator.circle(arcAttrs);
|
|
45
|
+
axisLine.name = AXIS_ELEMENT_NAME.line, axisLine.id = this._getNodeId("line"), isEmpty(line.state) || (axisLine.states = merge({}, DEFAULT_STATES, line.state)),
|
|
46
|
+
container.add(axisLine);
|
|
56
47
|
}
|
|
57
48
|
getTitleAttribute() {
|
|
58
49
|
var _a, _b, _c;
|