@visactor/vchart 2.1.2-alpha.9 → 2.1.2
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/build/es5/index.js +1 -1
- package/build/index.es.js +40 -13
- package/build/index.js +40 -13
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/callback-disappear.d.ts +1 -1
- package/cjs/animation/callback-disappear.js.map +1 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/mark/base/base-mark.d.ts +1 -0
- package/cjs/mark/base/base-mark.js +9 -1
- package/cjs/mark/base/base-mark.js.map +1 -1
- package/cjs/mark/group.js +2 -1
- package/cjs/mark/group.js.map +1 -1
- package/esm/animation/callback-disappear.d.ts +1 -1
- package/esm/animation/callback-disappear.js.map +1 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/mark/base/base-mark.d.ts +1 -0
- package/esm/mark/base/base-mark.js +9 -1
- package/esm/mark/base/base-mark.js.map +1 -1
- package/esm/mark/group.js +2 -1
- package/esm/mark/group.js.map +1 -1
- package/package.json +9 -9
package/cjs/mark/group.js
CHANGED
|
@@ -65,7 +65,8 @@ class GroupMark extends base_mark_1.BaseMark {
|
|
|
65
65
|
const newAttrs = this._getAttrsFromConfig(style);
|
|
66
66
|
if (this._product.context.finalAttrs = newAttrs, this._product.context.diffState === interface_1.DiffState.update) {
|
|
67
67
|
const hasAnimation = this.hasAnimation(), diffAttrs = (0, mark_1.getDiffAttributesOfGraphic)(this._product, newAttrs);
|
|
68
|
-
this._product.context.diffAttrs = diffAttrs, this.hasAnimationByState(this._product.context.animationState) || (hasAnimation ? this._product.setAttributesAndPreventAnimate(diffAttrs)
|
|
68
|
+
this._product.context.diffAttrs = diffAttrs, this.hasAnimationByState(this._product.context.animationState) || (hasAnimation ? (this._product.setAttributesAndPreventAnimate(diffAttrs),
|
|
69
|
+
this._commitPreventedAnimationStaticAttrs(this._product, diffAttrs)) : this._product.setAttributes(diffAttrs));
|
|
69
70
|
} else this._product.setAttributes(newAttrs);
|
|
70
71
|
this.needClear = !0;
|
|
71
72
|
}
|
package/cjs/mark/group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/mark/group.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAG5C,yCAA0C;AAE1C,gDAA4C;AAC5C,2CAOqB;AAKrB,mFAA+E;AAC/E,6FAAyF;AACzF,6CAAyC;AACzC,0CAAoD;AACpD,uCAA0D;AAE1D,MAAa,SAAU,SAAQ,oBAAwB;IAAvD;;QAEW,SAAI,GAAG,SAAS,CAAC,IAAI,CAAC;QACrB,WAAM,GAAY,EAAE,CAAC;QAKrB,eAAU,GAAG,qBAAS,CAAC,KAAK,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/mark/group.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAG5C,yCAA0C;AAE1C,gDAA4C;AAC5C,2CAOqB;AAKrB,mFAA+E;AAC/E,6FAAyF;AACzF,6CAAyC;AACzC,0CAAoD;AACpD,uCAA0D;AAE1D,MAAa,SAAU,SAAQ,oBAAwB;IAAvD;;QAEW,SAAI,GAAG,SAAS,CAAC,IAAI,CAAC;QACrB,WAAM,GAAY,EAAE,CAAC;QAKrB,eAAU,GAAG,qBAAS,CAAC,KAAK,CAAC;IA6IzC,CAAC;IAjJC,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAMS,WAAW,CAAC,IAAW;QAC/B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC,KAAK,SAAS,CAAC;IAC/D,CAAC;IAED,OAAO,CAAC,IAAW;QACjB,IAAI,IAAI,CAAC,WAAW,CAAC,I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C;QAChB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;;AApJH,8BAqJC;AApJiB,cAAI,WAAsB;AAsJrC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,IAAA,wCAAkB,GAAE,CAAC;IACrB,IAAA,8BAAa,GAAE,CAAC;IAChB,iBAAO,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAClD,CAAC,CAAC;AAJW,QAAA,iBAAiB,qBAI5B","file":"group.js","sourcesContent":["import { Factory } from './../core/factory';\nimport type { Maybe } from '../typings';\n// eslint-disable-next-line no-duplicate-imports\nimport { log, warn } from '../util/debug';\nimport type { IGroupMarkSpec } from '../typings/visual';\nimport { BaseMark } from './base/base-mark';\nimport {\n DiffState,\n type AnimationStateValues,\n type IGroupMark,\n type IMark,\n type IMarkGraphic,\n type MarkType\n} from './interface';\n// eslint-disable-next-line no-duplicate-imports\nimport { MarkTypeEnum } from './interface/type';\nimport { type IMarkCompileOption } from '../compile/mark';\nimport type { IGroup, IGroupGraphicAttribute } from '@visactor/vrender-core';\nimport { registerGroup } from '@visactor/vrender-kits/register/register-group';\nimport { registerShadowRoot } from '@visactor/vrender-kits/register/register-shadowRoot';\nimport { isNil } from '@visactor/vutils';\nimport { traverseGroupMark } from '../compile/util';\nimport { getDiffAttributesOfGraphic } from '../util/mark';\n\nexport class GroupMark extends BaseMark<IGroupMarkSpec> implements IGroupMark {\n static readonly type = MarkTypeEnum.group;\n readonly type = GroupMark.type;\n protected _marks: IMark[] = [];\n getMarks(): IMark[] {\n return this._marks;\n }\n\n protected _diffState = DiffState.enter;\n protected declare _product: Maybe<IGroup>;\n declare getProduct: () => Maybe<IGroup>;\n\n protected isMarkExist(mark: IMark): boolean {\n return this._marks.find(m => m.id === mark.id) !== undefined;\n }\n\n addMark(mark: IMark): boolean {\n if (this.isMarkExist(mark)) {\n warn('Mark already exists, add mark failed.');\n return false;\n }\n\n this._marks.push(mark);\n return true;\n }\n\n removeMark(mark: IMark): boolean {\n const index = this._marks.findIndex(m => m.id === mark.id || m.name === mark.name);\n if (index === -1) {\n warn('Mark does not exists, removeMark failed.');\n return false;\n }\n this._marks.splice(index, 1);\n return true;\n }\n\n getMarkInType(type: MarkType) {\n return this._marks.filter(m => m.type === type);\n }\n\n getMarkInId(id: number) {\n return this._marks.find(m => m.id === id);\n }\n\n getMarkInUserId(id: string | number) {\n let result: IMark | undefined;\n traverseGroupMark(\n this,\n m => {\n result = m;\n },\n m => m.getUserId() === id,\n null,\n true\n );\n\n return result;\n }\n\n getMarkInName(name: string) {\n return this._marks.filter(m => m.name === name);\n }\n\n protected _compileProduct(option?: IMarkCompileOption): void {\n // 编译自身\n super._compileProduct(option);\n\n // 设置zIndex\n // this._product.configure({\n // zIndex: this._markConfig.zIndex\n // });\n\n // 编译子元素\n this.getMarks().forEach(mark => {\n mark.compile({ group: this._product });\n });\n }\n\n protected _getAttrsFromConfig(attrs: IGroupGraphicAttribute = {}) {\n const configAttrs = super._getAttrsFromConfig(attrs);\n\n if (!isNil(this._markConfig.interactive)) {\n configAttrs.pickable = this._markConfig.interactive;\n }\n return attrs;\n }\n\n getGraphics(): IMarkGraphic[] {\n return [this._product as unknown as IMarkGraphic];\n }\n\n renderInner() {\n if (!this._product) {\n return;\n }\n\n const style = this._simpleStyle ?? this.getAttributesOfState({});\n\n this._product.context = {\n ...this._product.context,\n ...this._getCommonContext(),\n diffState: this._diffState\n };\n this._setAnimationState(this._product as unknown as IMarkGraphic);\n const newAttrs = this._getAttrsFromConfig(style);\n this._product.context.finalAttrs = newAttrs;\n\n // TODO: 需要优化,现在group mark 走了一些特殊逻辑\n if (this._product.context.diffState === DiffState.update) {\n const hasAnimation = this.hasAnimation();\n const diffAttrs = getDiffAttributesOfGraphic(this._product as unknown as IMarkGraphic, newAttrs);\n this._product.context.diffAttrs = diffAttrs;\n\n if (!this.hasAnimationByState(this._product.context.animationState)) {\n if (hasAnimation) {\n this._product.setAttributesAndPreventAnimate(diffAttrs);\n this._commitPreventedAnimationStaticAttrs(this._product as unknown as IMarkGraphic, diffAttrs);\n } else {\n this._product.setAttributes(diffAttrs);\n }\n }\n } else {\n this._product.setAttributes(newAttrs);\n }\n\n this.needClear = true;\n }\n\n clearExitGraphics() {\n // group 暂时不需要clear元素,完成首次渲染后 将状态设置为update\n this._diffState = DiffState.update;\n }\n\n render(): void {\n if (this._isCommited) {\n log(`render mark: ${this.getProductId()}, type is ${this.type}`);\n this.renderInner();\n this.uncommit();\n }\n\n this.getMarks().forEach(mark => {\n mark.render();\n });\n }\n\n release() {\n super.release();\n this.removeProduct(true);\n }\n}\n\nexport const registerGroupMark = () => {\n registerShadowRoot();\n registerGroup();\n Factory.registerMark(GroupMark.type, GroupMark);\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AStageAnimate } from '@visactor/vrender-animate/custom/custom-animate';
|
|
2
|
-
import { EasingType } from '@visactor/vrender-core';
|
|
2
|
+
import type { EasingType } from '@visactor/vrender-core';
|
|
3
3
|
export declare class CallbackDisappearAnimate extends AStageAnimate<any> {
|
|
4
4
|
protected currentAnimationRatio: number;
|
|
5
5
|
protected animationTime: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/animation/callback-disappear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAMhF,MAAM,OAAO,wBAAyB,SAAQ,aAAkB;IAI9D,YAAY,IAAU,EAAE,EAAQ,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAAW;QACjF,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAJlC,0BAAqB,GAAG,CAAC,CAAC;QAC1B,kBAAa,GAAG,CAAC,CAAC;IAI5B,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAQ;QAC5C,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QAChC,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,KAAK,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3C,CAAC;IAKS,gBAAgB;QACxB,IAAI,IAAI,CAAC,qBAAqB,GAAG,CAAC,EAAE;YAClC,OAAO,IAAI,CAAC,aAAa,CAAC;SAC3B;QACD,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC;IAC7B,CAAC;IAES,gBAAgB,CAAC,KAAU,EAAE,MAAyB;;QAC9D,OAAO,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,QAAQ,mDAAG,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,qBAAqB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAChG,CAAC;CACF","file":"callback-disappear.js","sourcesContent":["import { AStageAnimate } from '@visactor/vrender-animate/custom/custom-animate';\nimport { EasingType } from '@visactor/vrender-core';\n\n/**\n * 特效动画基类,提取公共的WebGL和Canvas 2D操作\n */\nexport class CallbackDisappearAnimate extends AStageAnimate<any> {\n protected currentAnimationRatio = 0;\n protected animationTime = 0;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params: any) {\n super(from, to, duration, easing, params);\n }\n\n onUpdate(end: boolean, ratio: number, out: any): void {\n super.onUpdate(end, ratio, out);\n this.currentAnimationRatio = ratio;\n this.animationTime = ratio * Math.PI * 2;\n }\n\n /**\n * 获取基于动画进度的时间\n */\n protected getAnimationTime(): number {\n if (this.currentAnimationRatio > 0) {\n return this.animationTime;\n }\n return Date.now() / 1000.0;\n }\n\n protected afterStageRender(stage: any, canvas: HTMLCanvasElement): void {\n return this.params?.callBack?.(stage, canvas, this.currentAnimationRatio, this.animationTime);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/animation/callback-disappear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAMhF,MAAM,OAAO,wBAAyB,SAAQ,aAAkB;IAI9D,YAAY,IAAU,EAAE,EAAQ,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAAW;QACjF,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAJlC,0BAAqB,GAAG,CAAC,CAAC;QAC1B,kBAAa,GAAG,CAAC,CAAC;IAI5B,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAQ;QAC5C,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QAChC,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,KAAK,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3C,CAAC;IAKS,gBAAgB;QACxB,IAAI,IAAI,CAAC,qBAAqB,GAAG,CAAC,EAAE;YAClC,OAAO,IAAI,CAAC,aAAa,CAAC;SAC3B;QACD,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC;IAC7B,CAAC;IAES,gBAAgB,CAAC,KAAU,EAAE,MAAyB;;QAC9D,OAAO,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,QAAQ,mDAAG,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,qBAAqB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAChG,CAAC;CACF","file":"callback-disappear.js","sourcesContent":["import { AStageAnimate } from '@visactor/vrender-animate/custom/custom-animate';\nimport type { EasingType } from '@visactor/vrender-core';\n\n/**\n * 特效动画基类,提取公共的WebGL和Canvas 2D操作\n */\nexport class CallbackDisappearAnimate extends AStageAnimate<any> {\n protected currentAnimationRatio = 0;\n protected animationTime = 0;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params: any) {\n super(from, to, duration, easing, params);\n }\n\n onUpdate(end: boolean, ratio: number, out: any): void {\n super.onUpdate(end, ratio, out);\n this.currentAnimationRatio = ratio;\n this.animationTime = ratio * Math.PI * 2;\n }\n\n /**\n * 获取基于动画进度的时间\n */\n protected getAnimationTime(): number {\n if (this.currentAnimationRatio > 0) {\n return this.animationTime;\n }\n return Date.now() / 1000.0;\n }\n\n protected afterStageRender(stage: any, canvas: HTMLCanvasElement): void {\n return this.params?.callBack?.(stage, canvas, this.currentAnimationRatio, this.animationTime);\n }\n}\n"]}
|
package/esm/core/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VChart } from './vchart';
|
|
2
2
|
import { Factory } from './factory';
|
|
3
3
|
export { VChart, Factory };
|
|
4
|
-
export declare const version = "2.1.
|
|
4
|
+
export declare const version = "2.1.2";
|
|
5
5
|
export type { IVChart } from './interface';
|
|
6
6
|
export type { IStateSpec, StateValueType } from '../compile/mark';
|
|
7
7
|
export type { IRegion } from '../region/interface';
|
package/esm/core/index.js
CHANGED
package/esm/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAG3B,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAO/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAI3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAK/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EACL,OAAO,EACP,WAAW,EACX,cAAc,EACd,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAG3E,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,6BAA6B,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC","file":"index.js","sourcesContent":["/**\n * @description The core module of VChart, containing the necessary interfaces for using VChart.\n */\n\nimport { VChart } from './vchart';\nimport { Factory } from './factory';\n\nexport { VChart, Factory };\n\n// export the version\nexport const version = \"2.1.
|
|
1
|
+
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAG3B,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAO/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAI3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAK/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EACL,OAAO,EACP,WAAW,EACX,cAAc,EACd,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAG3E,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,6BAA6B,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC","file":"index.js","sourcesContent":["/**\n * @description The core module of VChart, containing the necessary interfaces for using VChart.\n */\n\nimport { VChart } from './vchart';\nimport { Factory } from './factory';\n\nexport { VChart, Factory };\n\n// export the version\nexport const version = \"2.1.2\";\n\n// export necessary types\nexport type { IVChart } from './interface';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\nexport type { IRegion } from '../region/interface';\n\nexport * from '../event/interface';\nexport * from '../theme/interface';\nexport * from '../model/interface';\n\nexport * from './interface';\nexport * from '../typings';\nexport type { IMarkGraphic, IGraphicContext } from '../mark/interface/';\n\n// some constants\nexport * from '../constant/base';\nexport * from '../constant/data';\nexport * from '../constant/layout';\nexport { AttributeLevel } from '../constant/attribute';\nexport { TransformLevel } from '../data/initialize';\nexport { STATE_VALUE_ENUM } from '../compile/mark/interface';\nexport { ChartEvent } from '../constant/event';\n\n/**\n * spec\n */\nexport * from '../typings/spec/index';\nexport * from '../typings/visual';\n\n// tooltip\nexport * from '../typings/tooltip';\n\n// theme\nexport * from '../theme/index';\n\n// vrender\nexport {\n vglobal,\n createGroup,\n createRichText,\n createText,\n createArc,\n createArea,\n createRect,\n createLine,\n createSymbol\n} from '@visactor/vrender-core';\nexport { ManualTicker } from '@visactor/vrender-animate/ticker/manual-ticker';\nexport { StreamLight } from '@visactor/vrender-animate/custom/streamLight';\n\n// utils\nexport * from '../util/space';\nexport { transformToGraphic } from '../util/style';\nexport { getSpecInfo } from '../component/util';\nexport { registerDataSetInstanceParser, registerDataSetInstanceTransform } from '../data/register';\nexport { lookup } from '../data/transforms/lookup';\nexport { warn } from '../util/debug';\nexport { measureText } from '../util/text';\n"]}
|
|
@@ -167,6 +167,7 @@ export declare class BaseMark<T extends ICommonSpec> extends GrammarItem impleme
|
|
|
167
167
|
protected _runEncoder(graphics: IMarkGraphic[], noGroupEncode?: boolean): void;
|
|
168
168
|
protected _excludeStateControlledDiffAttrs(g: IMarkGraphic, diffAttrs: Record<string, any>): Record<string, any>;
|
|
169
169
|
protected _hasDiffAttrs(g: IMarkGraphic): boolean;
|
|
170
|
+
protected _commitPreventedAnimationStaticAttrs(g: IMarkGraphic, attrs: Record<string, any>): void;
|
|
170
171
|
protected _runApplyGraphic(graphics: IMarkGraphic[]): void;
|
|
171
172
|
protected _updateEncoderByState(): void;
|
|
172
173
|
protected _runState(graphics: IMarkGraphic[]): void;
|
|
@@ -760,6 +760,13 @@ export class BaseMark extends GrammarItem {
|
|
|
760
760
|
_hasDiffAttrs(g) {
|
|
761
761
|
return !!g.context.diffAttrs && Object.keys(g.context.diffAttrs).length > 0;
|
|
762
762
|
}
|
|
763
|
+
_commitPreventedAnimationStaticAttrs(g, attrs) {
|
|
764
|
+
var _a, _b;
|
|
765
|
+
if (!attrs || !Object.keys(attrs).length) return;
|
|
766
|
+
const graphic = g;
|
|
767
|
+
null === (_a = graphic.setFinalAttributes) || void 0 === _a || _a.call(graphic, attrs),
|
|
768
|
+
graphic._commitAnimationStaticAttributes ? graphic._commitAnimationStaticAttributes(attrs) : null === (_b = graphic.commitInternalBaseAttributes) || void 0 === _b || _b.call(graphic, attrs);
|
|
769
|
+
}
|
|
763
770
|
_runApplyGraphic(graphics) {
|
|
764
771
|
const hasAnimation = this.hasAnimation();
|
|
765
772
|
graphics.forEach(((g, index) => {
|
|
@@ -768,7 +775,8 @@ export class BaseMark extends GrammarItem {
|
|
|
768
775
|
if (g.setAttributes) {
|
|
769
776
|
const diffAttrs = this._excludeStateControlledDiffAttrs(g, getDiffAttributesOfGraphic(g, finalAttrs));
|
|
770
777
|
g.context.diffAttrs = diffAttrs, g.context.reusing ? (g.context.lastAttrs = g.attribute,
|
|
771
|
-
g.initAttributes(finalAttrs), g.context.reusing = !1) : hasStateAnimation || (hasAnimation ? g.setAttributesAndPreventAnimate(diffAttrs)
|
|
778
|
+
g.initAttributes(finalAttrs), g.context.reusing = !1) : hasStateAnimation || (hasAnimation ? (g.setAttributesAndPreventAnimate(diffAttrs),
|
|
779
|
+
this._commitPreventedAnimationStaticAttrs(g, diffAttrs)) : g.setAttributes(diffAttrs)),
|
|
772
780
|
!(null === (_b = this.renderContext) || void 0 === _b ? void 0 : _b.progressive) && this._product && g.parent !== this._product && this._product.appendChild(g);
|
|
773
781
|
} else {
|
|
774
782
|
const mockGraphic = g;
|