@visactor/vrender-core 1.1.0-alpha.13 → 1.1.0-alpha.15

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.
@@ -192,7 +192,7 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
192
192
  protected setWidthHeightWithoutTransform(aabbBounds: IAABBBounds): void;
193
193
  setAttributesAndPreventAnimate(params: Partial<T>, forceUpdateTag?: boolean, context?: ISetAttributeContext, ignorePriority?: boolean): void;
194
194
  protected captureTransientFromAttrsBeforePreventAnimate(params: Partial<T>, keys: string[], context?: ISetAttributeContext): void;
195
- protected consumeTransientFromAttrsBeforePreventAnimate(rawDiffAttrs: Record<string, any>, diffAttrs: Record<string, any>): Record<string, any> | null;
195
+ protected consumeTransientFromAttrsBeforePreventAnimate(diffAttrs: Record<string, any>): Record<string, any> | null;
196
196
  setAttributes(params: Partial<T>, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
197
197
  _setAttributes(params: Partial<T>, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
198
198
  setAttribute(key: string, value: any, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
@@ -526,10 +526,13 @@ class Graphic extends node_tree_1.Node {
526
526
  })), this.applyTransientAttributes(params, forceUpdateTag, context);
527
527
  }
528
528
  captureTransientFromAttrsBeforePreventAnimate(params, keys, context) {
529
- var _a;
530
- const graphicContext = this.context, diffAttrs = null == graphicContext ? void 0 : graphicContext.diffAttrs, updateType = null == context ? void 0 : context.type;
531
- if (!keys.length || !graphicContext || !diffAttrs || updateType === enums_1.AttributeUpdateType.STATE || null != updateType && updateType >= enums_1.AttributeUpdateType.ANIMATE_BIND && updateType <= enums_1.AttributeUpdateType.ANIMATE_END) return;
532
- let fromAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs && null !== (_a = this.transientFromAttrsBeforePreventAnimate) && void 0 !== _a ? _a : null, captured = !1;
529
+ var _a, _b;
530
+ const graphicContext = this.context, diffAttrs = null !== (_a = null == graphicContext ? void 0 : graphicContext.diffAttrs) && void 0 !== _a ? _a : params, updateType = null == context ? void 0 : context.type;
531
+ if (!keys.length || !diffAttrs || updateType === enums_1.AttributeUpdateType.STATE || null != updateType && updateType >= enums_1.AttributeUpdateType.ANIMATE_BIND && updateType <= enums_1.AttributeUpdateType.ANIMATE_END) return;
532
+ const sameDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs;
533
+ let fromAttrs = sameDiffAttrs && null !== (_b = this.transientFromAttrsBeforePreventAnimate) && void 0 !== _b ? _b : null;
534
+ sameDiffAttrs || (this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null);
535
+ let captured = !1;
533
536
  for (let i = 0; i < keys.length; i++) {
534
537
  const key = keys[i];
535
538
  if (!Object.prototype.hasOwnProperty.call(diffAttrs, key)) continue;
@@ -539,9 +542,11 @@ class Graphic extends node_tree_1.Node {
539
542
  }
540
543
  captured && (this.transientFromAttrsBeforePreventAnimate = fromAttrs, this.transientFromAttrsBeforePreventAnimateDiffAttrs = diffAttrs);
541
544
  }
542
- consumeTransientFromAttrsBeforePreventAnimate(rawDiffAttrs, diffAttrs) {
543
- const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate;
544
- if (!transientFromAttrs || this.transientFromAttrsBeforePreventAnimateDiffAttrs !== rawDiffAttrs) return null;
545
+ consumeTransientFromAttrsBeforePreventAnimate(diffAttrs) {
546
+ const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate, sourceDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs;
547
+ if (!transientFromAttrs || !sourceDiffAttrs) return null;
548
+ for (const key in diffAttrs) if (Object.prototype.hasOwnProperty.call(diffAttrs, key) && (!Object.prototype.hasOwnProperty.call(sourceDiffAttrs, key) || !(0,
549
+ vutils_1.isEqual)(sourceDiffAttrs[key], diffAttrs[key]))) return null;
545
550
  let fromAttrs = null, remaining = !1;
546
551
  for (const key in transientFromAttrs) Object.prototype.hasOwnProperty.call(transientFromAttrs, key) && (Object.prototype.hasOwnProperty.call(diffAttrs, key) ? (null != fromAttrs || (fromAttrs = {}),
547
552
  fromAttrs[key] = transientFromAttrs[key]) : remaining = !0);