@visactor/vrender-core 1.1.0-alpha.5 → 1.1.0-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/canvas/constants.js +1 -2
- package/cjs/color-string/index.js +2 -1
- package/cjs/graphic/graphic.d.ts +1 -0
- package/cjs/graphic/graphic.js +10 -2
- package/cjs/graphic/graphic.js.map +1 -1
- package/dist/index.es.js +20 -1
- package/es/canvas/constants.js +1 -2
- package/es/color-string/index.js +2 -1
- package/es/graphic/graphic.d.ts +1 -0
- package/es/graphic/graphic.js +10 -2
- package/es/graphic/graphic.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -10859,6 +10859,22 @@ class Graphic extends Node {
|
|
|
10859
10859
|
});
|
|
10860
10860
|
return snapshot;
|
|
10861
10861
|
}
|
|
10862
|
+
buildStateAnimationTargetAttrs(resolvedStateAttrs, previousResolvedStatePatch) {
|
|
10863
|
+
const targetAttrs = cloneAttributeValue(resolvedStateAttrs);
|
|
10864
|
+
if (!previousResolvedStatePatch) {
|
|
10865
|
+
return targetAttrs;
|
|
10866
|
+
}
|
|
10867
|
+
const snapshot = this.buildStaticAttributeSnapshot();
|
|
10868
|
+
Object.keys(previousResolvedStatePatch).forEach(key => {
|
|
10869
|
+
if (Object.prototype.hasOwnProperty.call(targetAttrs, key)) {
|
|
10870
|
+
return;
|
|
10871
|
+
}
|
|
10872
|
+
targetAttrs[key] = Object.prototype.hasOwnProperty.call(snapshot, key)
|
|
10873
|
+
? cloneAttributeValue(snapshot[key])
|
|
10874
|
+
: this.getDefaultAttribute(key);
|
|
10875
|
+
});
|
|
10876
|
+
return targetAttrs;
|
|
10877
|
+
}
|
|
10862
10878
|
syncObjectToSnapshot(target, snapshot) {
|
|
10863
10879
|
const delta = new Map();
|
|
10864
10880
|
const keySet = new Set([...Object.keys(target), ...Object.keys(snapshot)]);
|
|
@@ -11668,6 +11684,9 @@ class Graphic extends Node {
|
|
|
11668
11684
|
return;
|
|
11669
11685
|
}
|
|
11670
11686
|
const previousStates = this.currentStates ? this.currentStates.slice() : [];
|
|
11687
|
+
const previousResolvedStatePatch = this.resolvedStatePatch
|
|
11688
|
+
? cloneAttributeValue(this.resolvedStatePatch)
|
|
11689
|
+
: undefined;
|
|
11671
11690
|
const stateResolveBaseAttrs = ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : this.attribute);
|
|
11672
11691
|
const stateModel = this.createStateModel();
|
|
11673
11692
|
(_b = this.stateEngine) === null || _b === void 0 ? void 0 : _b.setResolveContext(this, stateResolveBaseAttrs);
|
|
@@ -11693,7 +11712,7 @@ class Graphic extends Node {
|
|
|
11693
11712
|
});
|
|
11694
11713
|
if (hasAnimation) {
|
|
11695
11714
|
this._syncFinalAttributeFromStaticTruth();
|
|
11696
|
-
this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation);
|
|
11715
|
+
this.applyStateAttrs(this.buildStateAnimationTargetAttrs(resolvedStateAttrs, previousResolvedStatePatch), transition.states, hasAnimation);
|
|
11697
11716
|
}
|
|
11698
11717
|
else {
|
|
11699
11718
|
this.stopStateAnimates();
|
package/es/canvas/constants.js
CHANGED
package/es/color-string/index.js
CHANGED
package/es/graphic/graphic.d.ts
CHANGED
|
@@ -149,6 +149,7 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
|
|
|
149
149
|
};
|
|
150
150
|
protected recomputeCurrentStatePatch(): void;
|
|
151
151
|
protected buildStaticAttributeSnapshot(): Partial<T>;
|
|
152
|
+
protected buildStateAnimationTargetAttrs(resolvedStateAttrs: Partial<T>, previousResolvedStatePatch?: Partial<T>): Partial<T>;
|
|
152
153
|
protected syncObjectToSnapshot(target: Record<string, any>, snapshot: Record<string, any>): AttributeDelta;
|
|
153
154
|
protected _syncAttribute(): AttributeDelta;
|
|
154
155
|
protected _syncFinalAttributeFromStaticTruth(): void;
|
package/es/graphic/graphic.js
CHANGED
|
@@ -297,6 +297,14 @@ export class Graphic extends Node {
|
|
|
297
297
|
"deep" === this.stateMergeMode && isPlainObjectValue(previousValue) && isPlainObjectValue(nextValue) ? snapshot[key] = deepMergeAttributeValue(previousValue, nextValue) : snapshot[key] = cloneAttributeValue(nextValue);
|
|
298
298
|
})), snapshot) : snapshot;
|
|
299
299
|
}
|
|
300
|
+
buildStateAnimationTargetAttrs(resolvedStateAttrs, previousResolvedStatePatch) {
|
|
301
|
+
const targetAttrs = cloneAttributeValue(resolvedStateAttrs);
|
|
302
|
+
if (!previousResolvedStatePatch) return targetAttrs;
|
|
303
|
+
const snapshot = this.buildStaticAttributeSnapshot();
|
|
304
|
+
return Object.keys(previousResolvedStatePatch).forEach((key => {
|
|
305
|
+
Object.prototype.hasOwnProperty.call(targetAttrs, key) || (targetAttrs[key] = Object.prototype.hasOwnProperty.call(snapshot, key) ? cloneAttributeValue(snapshot[key]) : this.getDefaultAttribute(key));
|
|
306
|
+
})), targetAttrs;
|
|
307
|
+
}
|
|
300
308
|
syncObjectToSnapshot(target, snapshot) {
|
|
301
309
|
const delta = new Map;
|
|
302
310
|
return new Set([ ...Object.keys(target), ...Object.keys(snapshot) ]).forEach((key => {
|
|
@@ -778,7 +786,7 @@ export class Graphic extends Node {
|
|
|
778
786
|
useStates(states, hasAnimation) {
|
|
779
787
|
var _a, _b, _c, _d, _e;
|
|
780
788
|
if (!states.length) return void this.clearStates(hasAnimation);
|
|
781
|
-
const previousStates = this.currentStates ? this.currentStates.slice() : [], stateResolveBaseAttrs = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute, stateModel = this.createStateModel();
|
|
789
|
+
const previousStates = this.currentStates ? this.currentStates.slice() : [], previousResolvedStatePatch = this.resolvedStatePatch ? cloneAttributeValue(this.resolvedStatePatch) : void 0, stateResolveBaseAttrs = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute, stateModel = this.createStateModel();
|
|
782
790
|
null === (_b = this.stateEngine) || void 0 === _b || _b.setResolveContext(this, stateResolveBaseAttrs);
|
|
783
791
|
const transition = stateModel.useStates(states);
|
|
784
792
|
if (!transition.changed && this.sameStateNames(previousStates, transition.states)) return;
|
|
@@ -789,7 +797,7 @@ export class Graphic extends Node {
|
|
|
789
797
|
null === (_e = getStageStatePerfMonitor(this.stage)) || void 0 === _e || _e.recordEvent("state-commit", {
|
|
790
798
|
graphicId: this._uid,
|
|
791
799
|
targetStates: [ ...transition.states ]
|
|
792
|
-
}), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation)) : (this.stopStateAnimates(),
|
|
800
|
+
}), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(this.buildStateAnimationTargetAttrs(resolvedStateAttrs, previousResolvedStatePatch), transition.states, hasAnimation)) : (this.stopStateAnimates(),
|
|
793
801
|
this._restoreAttributeFromStaticTruth({
|
|
794
802
|
type: AttributeUpdateType.STATE
|
|
795
803
|
}), this._emitCustomEvent("afterStateUpdate", {
|