@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/cjs/canvas/constants.js
CHANGED
|
@@ -3,5 +3,4 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.Context2dFactory = exports.CanvasFactory = void 0, exports.CanvasFactory = Symbol.for("CanvasFactory"),
|
|
6
|
-
exports.Context2dFactory = Symbol.for("Context2dFactory");
|
|
7
|
-
//# sourceMappingURL=constants.js.map
|
|
6
|
+
exports.Context2dFactory = Symbol.for("Context2dFactory");
|
|
@@ -18,4 +18,5 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
20
|
}), __exportStar(require("./interpolate"), exports), __exportStar(require("./store"), exports),
|
|
21
|
-
__exportStar(require("./colorName"), exports);
|
|
21
|
+
__exportStar(require("./colorName"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/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/cjs/graphic/graphic.js
CHANGED
|
@@ -254,6 +254,14 @@ class Graphic extends node_tree_1.Node {
|
|
|
254
254
|
"deep" === this.stateMergeMode && isPlainObjectValue(previousValue) && isPlainObjectValue(nextValue) ? snapshot[key] = deepMergeAttributeValue(previousValue, nextValue) : snapshot[key] = cloneAttributeValue(nextValue);
|
|
255
255
|
})), snapshot) : snapshot;
|
|
256
256
|
}
|
|
257
|
+
buildStateAnimationTargetAttrs(resolvedStateAttrs, previousResolvedStatePatch) {
|
|
258
|
+
const targetAttrs = cloneAttributeValue(resolvedStateAttrs);
|
|
259
|
+
if (!previousResolvedStatePatch) return targetAttrs;
|
|
260
|
+
const snapshot = this.buildStaticAttributeSnapshot();
|
|
261
|
+
return Object.keys(previousResolvedStatePatch).forEach((key => {
|
|
262
|
+
Object.prototype.hasOwnProperty.call(targetAttrs, key) || (targetAttrs[key] = Object.prototype.hasOwnProperty.call(snapshot, key) ? cloneAttributeValue(snapshot[key]) : this.getDefaultAttribute(key));
|
|
263
|
+
})), targetAttrs;
|
|
264
|
+
}
|
|
257
265
|
syncObjectToSnapshot(target, snapshot) {
|
|
258
266
|
const delta = new Map;
|
|
259
267
|
return new Set([ ...Object.keys(target), ...Object.keys(snapshot) ]).forEach((key => {
|
|
@@ -743,7 +751,7 @@ class Graphic extends node_tree_1.Node {
|
|
|
743
751
|
useStates(states, hasAnimation) {
|
|
744
752
|
var _a, _b, _c, _d, _e;
|
|
745
753
|
if (!states.length) return void this.clearStates(hasAnimation);
|
|
746
|
-
const previousStates = this.currentStates ? this.currentStates.slice() : [], stateResolveBaseAttrs = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute, stateModel = this.createStateModel();
|
|
754
|
+
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();
|
|
747
755
|
null === (_b = this.stateEngine) || void 0 === _b || _b.setResolveContext(this, stateResolveBaseAttrs);
|
|
748
756
|
const transition = stateModel.useStates(states);
|
|
749
757
|
if (!transition.changed && this.sameStateNames(previousStates, transition.states)) return;
|
|
@@ -755,7 +763,7 @@ class Graphic extends node_tree_1.Node {
|
|
|
755
763
|
null === (_e = (0, state_perf_monitor_1.getStageStatePerfMonitor)(this.stage)) || void 0 === _e || _e.recordEvent("state-commit", {
|
|
756
764
|
graphicId: this._uid,
|
|
757
765
|
targetStates: [ ...transition.states ]
|
|
758
|
-
}), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation)) : (this.stopStateAnimates(),
|
|
766
|
+
}), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(this.buildStateAnimationTargetAttrs(resolvedStateAttrs, previousResolvedStatePatch), transition.states, hasAnimation)) : (this.stopStateAnimates(),
|
|
759
767
|
this._restoreAttributeFromStaticTruth({
|
|
760
768
|
type: enums_1.AttributeUpdateType.STATE
|
|
761
769
|
}), this._emitCustomEvent("afterStateUpdate", {
|