@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.
package/dist/index.es.js CHANGED
@@ -11323,12 +11323,11 @@ class Graphic extends Node {
11323
11323
  this.applyTransientAttributes(params, forceUpdateTag, context);
11324
11324
  }
11325
11325
  captureTransientFromAttrsBeforePreventAnimate(params, keys, context) {
11326
- var _a;
11326
+ var _a, _b;
11327
11327
  const graphicContext = this.context;
11328
- const diffAttrs = graphicContext === null || graphicContext === void 0 ? void 0 : graphicContext.diffAttrs;
11328
+ const diffAttrs = (_a = graphicContext === null || graphicContext === void 0 ? void 0 : graphicContext.diffAttrs) !== null && _a !== void 0 ? _a : params;
11329
11329
  const updateType = context === null || context === void 0 ? void 0 : context.type;
11330
11330
  if (!keys.length ||
11331
- !graphicContext ||
11332
11331
  !diffAttrs ||
11333
11332
  updateType === AttributeUpdateType.STATE ||
11334
11333
  (updateType != null &&
@@ -11336,9 +11335,14 @@ class Graphic extends Node {
11336
11335
  updateType <= AttributeUpdateType.ANIMATE_END)) {
11337
11336
  return;
11338
11337
  }
11339
- let fromAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs
11340
- ? (_a = this.transientFromAttrsBeforePreventAnimate) !== null && _a !== void 0 ? _a : null
11338
+ const sameDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs;
11339
+ let fromAttrs = sameDiffAttrs
11340
+ ? (_b = this.transientFromAttrsBeforePreventAnimate) !== null && _b !== void 0 ? _b : null
11341
11341
  : null;
11342
+ if (!sameDiffAttrs) {
11343
+ this.transientFromAttrsBeforePreventAnimate = null;
11344
+ this.transientFromAttrsBeforePreventAnimateDiffAttrs = null;
11345
+ }
11342
11346
  let captured = false;
11343
11347
  for (let i = 0; i < keys.length; i++) {
11344
11348
  const key = keys[i];
@@ -11359,11 +11363,18 @@ class Graphic extends Node {
11359
11363
  this.transientFromAttrsBeforePreventAnimateDiffAttrs = diffAttrs;
11360
11364
  }
11361
11365
  }
11362
- consumeTransientFromAttrsBeforePreventAnimate(rawDiffAttrs, diffAttrs) {
11366
+ consumeTransientFromAttrsBeforePreventAnimate(diffAttrs) {
11363
11367
  const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate;
11364
- if (!transientFromAttrs || this.transientFromAttrsBeforePreventAnimateDiffAttrs !== rawDiffAttrs) {
11368
+ const sourceDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs;
11369
+ if (!transientFromAttrs || !sourceDiffAttrs) {
11365
11370
  return null;
11366
11371
  }
11372
+ for (const key in diffAttrs) {
11373
+ if (Object.prototype.hasOwnProperty.call(diffAttrs, key) &&
11374
+ (!Object.prototype.hasOwnProperty.call(sourceDiffAttrs, key) || !isEqual(sourceDiffAttrs[key], diffAttrs[key]))) {
11375
+ return null;
11376
+ }
11377
+ }
11367
11378
  let fromAttrs = null;
11368
11379
  let remaining = false;
11369
11380
  for (const key in transientFromAttrs) {
@@ -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;
@@ -562,10 +562,13 @@ export class Graphic extends Node {
562
562
  })), this.applyTransientAttributes(params, forceUpdateTag, context);
563
563
  }
564
564
  captureTransientFromAttrsBeforePreventAnimate(params, keys, context) {
565
- var _a;
566
- const graphicContext = this.context, diffAttrs = null == graphicContext ? void 0 : graphicContext.diffAttrs, updateType = null == context ? void 0 : context.type;
567
- if (!keys.length || !graphicContext || !diffAttrs || updateType === AttributeUpdateType.STATE || null != updateType && updateType >= AttributeUpdateType.ANIMATE_BIND && updateType <= AttributeUpdateType.ANIMATE_END) return;
568
- let fromAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs && null !== (_a = this.transientFromAttrsBeforePreventAnimate) && void 0 !== _a ? _a : null, captured = !1;
565
+ var _a, _b;
566
+ 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;
567
+ if (!keys.length || !diffAttrs || updateType === AttributeUpdateType.STATE || null != updateType && updateType >= AttributeUpdateType.ANIMATE_BIND && updateType <= AttributeUpdateType.ANIMATE_END) return;
568
+ const sameDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs;
569
+ let fromAttrs = sameDiffAttrs && null !== (_b = this.transientFromAttrsBeforePreventAnimate) && void 0 !== _b ? _b : null;
570
+ sameDiffAttrs || (this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null);
571
+ let captured = !1;
569
572
  for (let i = 0; i < keys.length; i++) {
570
573
  const key = keys[i];
571
574
  if (!Object.prototype.hasOwnProperty.call(diffAttrs, key)) continue;
@@ -575,9 +578,10 @@ export class Graphic extends Node {
575
578
  }
576
579
  captured && (this.transientFromAttrsBeforePreventAnimate = fromAttrs, this.transientFromAttrsBeforePreventAnimateDiffAttrs = diffAttrs);
577
580
  }
578
- consumeTransientFromAttrsBeforePreventAnimate(rawDiffAttrs, diffAttrs) {
579
- const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate;
580
- if (!transientFromAttrs || this.transientFromAttrsBeforePreventAnimateDiffAttrs !== rawDiffAttrs) return null;
581
+ consumeTransientFromAttrsBeforePreventAnimate(diffAttrs) {
582
+ const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate, sourceDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs;
583
+ if (!transientFromAttrs || !sourceDiffAttrs) return null;
584
+ for (const key in diffAttrs) if (Object.prototype.hasOwnProperty.call(diffAttrs, key) && (!Object.prototype.hasOwnProperty.call(sourceDiffAttrs, key) || !isEqual(sourceDiffAttrs[key], diffAttrs[key]))) return null;
581
585
  let fromAttrs = null, remaining = !1;
582
586
  for (const key in transientFromAttrs) Object.prototype.hasOwnProperty.call(transientFromAttrs, key) && (Object.prototype.hasOwnProperty.call(diffAttrs, key) ? (null != fromAttrs || (fromAttrs = {}),
583
587
  fromAttrs[key] = transientFromAttrs[key]) : remaining = !0);