@visactor/vchart 2.1.5-alpha.0 → 2.1.6-alpha.0

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.
Files changed (36) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +62 -5
  3. package/build/index.js +465 -187
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/chart/base/base-chart.js +1 -1
  7. package/cjs/chart/base/base-chart.js.map +1 -1
  8. package/cjs/component/legend/discrete/interface.d.ts +9 -1
  9. package/cjs/component/legend/discrete/interface.js.map +1 -1
  10. package/cjs/component/legend/discrete/util.js +12 -2
  11. package/cjs/component/legend/discrete/util.js.map +1 -1
  12. package/cjs/component/marker/interface.d.ts +1 -1
  13. package/cjs/component/marker/interface.js.map +1 -1
  14. package/cjs/component/marker/mark-point/base-mark-point.d.ts +5 -0
  15. package/cjs/component/marker/mark-point/base-mark-point.js +30 -2
  16. package/cjs/component/marker/mark-point/base-mark-point.js.map +1 -1
  17. package/cjs/core/expression-function.js +1 -1
  18. package/cjs/core/vchart.js +1 -6
  19. package/cjs/core/vchart.js.map +1 -1
  20. package/cjs/data/data-view-utils.js +1 -1
  21. package/esm/chart/base/base-chart.js +1 -1
  22. package/esm/chart/base/base-chart.js.map +1 -1
  23. package/esm/component/legend/discrete/interface.d.ts +9 -1
  24. package/esm/component/legend/discrete/interface.js.map +1 -1
  25. package/esm/component/legend/discrete/util.js +11 -2
  26. package/esm/component/legend/discrete/util.js.map +1 -1
  27. package/esm/component/marker/interface.d.ts +1 -1
  28. package/esm/component/marker/interface.js.map +1 -1
  29. package/esm/component/marker/mark-point/base-mark-point.d.ts +5 -0
  30. package/esm/component/marker/mark-point/base-mark-point.js +34 -2
  31. package/esm/component/marker/mark-point/base-mark-point.js.map +1 -1
  32. package/esm/core/expression-function.js +1 -1
  33. package/esm/core/vchart.js +1 -6
  34. package/esm/core/vchart.js.map +1 -1
  35. package/esm/data/data-view-utils.js +1 -1
  36. package/package.json +8 -8
package/build/index.js CHANGED
@@ -9105,7 +9105,7 @@
9105
9105
  constructor() {
9106
9106
  super(), this._uid = Generator.GenAutoIncrementId(), this._firstChild = null, this._lastChild = null, this.parent = null, this._count = 1;
9107
9107
  }
9108
- onParentSharedStateTreeChanged(_stage, _layer, _inheritedSharedStateScope) {}
9108
+ onParentSharedStateTreeChanged(_stage, _layer) {}
9109
9109
  forEachChildren(cb, reverse = !1) {
9110
9110
  if (reverse) {
9111
9111
  let child = this._lastChild,
@@ -13375,18 +13375,21 @@
13375
13375
  }
13376
13376
  }
13377
13377
 
13378
- function getScaledStroke(context, width, dpr) {
13378
+ function getScaledStrokeWithMatrix(matrix, width, dpr) {
13379
13379
  let strokeWidth = width;
13380
13380
  const {
13381
13381
  a: a,
13382
13382
  b: b,
13383
13383
  c: c,
13384
13384
  d: d
13385
- } = context.currentMatrix,
13385
+ } = matrix,
13386
13386
  scaleX = Math.sign(a) * Math.sqrt(a * a + b * b),
13387
13387
  scaleY = Math.sign(d) * Math.sqrt(c * c + d * d);
13388
13388
  return scaleX + scaleY === 0 ? 0 : (strokeWidth = strokeWidth / Math.abs(scaleX + scaleY) * 2 * dpr, strokeWidth);
13389
13389
  }
13390
+ function getScaledStroke(context, width, dpr) {
13391
+ return getScaledStrokeWithMatrix(context.currentMatrix, width, dpr);
13392
+ }
13390
13393
  function createColor(context, c, params, offsetX = 0, offsetY = 0) {
13391
13394
  var _a, _b, _c, _d;
13392
13395
  if (!c || !0 === c) return "black";
@@ -14446,7 +14449,7 @@
14446
14449
  }
14447
14450
  class StateTransitionOrchestrator {
14448
14451
  analyzeTransition(targetAttrs, hasAnimation, options = {}) {
14449
- var _a, _b;
14452
+ var _a, _b, _c, _d;
14450
14453
  const plan = {
14451
14454
  targetAttrs: Object.assign({}, targetAttrs),
14452
14455
  animateAttrs: {},
@@ -14455,10 +14458,17 @@
14455
14458
  if (!hasAnimation) return plan;
14456
14459
  const noWorkAnimateAttr = Object.assign(Object.assign({}, null !== (_a = options.noWorkAnimateAttr) && void 0 !== _a ? _a : {}), normalizeNoAnimateAttrConfig(null === (_b = options.animateConfig) || void 0 === _b ? void 0 : _b.noAnimateAttrs)),
14457
14460
  isClear = !0 === options.isClear,
14458
- readDefaultAttribute = options.getDefaultAttribute,
14461
+ getDefaultAttribute = options.getDefaultAttribute,
14462
+ readDefaultAttribute = getDefaultAttribute,
14463
+ readStateTransitionDefaultAttribute = null !== (_c = options.getStateTransitionDefaultAttribute) && void 0 !== _c ? _c : getDefaultAttribute,
14459
14464
  shouldSkipDefaultAttribute = options.shouldSkipDefaultAttribute,
14460
- assignTransitionAttr = (key, value) => {
14461
- if (noWorkAnimateAttr[key]) plan.noAnimateAttrs[key] = value;else if (isClear && void 0 === value) {
14465
+ stateTransitionTargetAttrs = null !== (_d = options.stateTransitionTargetAttrs) && void 0 !== _d ? _d : targetAttrs,
14466
+ assignTransitionAttr = (key, value, isRemovedStateAttr = !1) => {
14467
+ if (noWorkAnimateAttr[key]) plan.noAnimateAttrs[key] = value;else if (isRemovedStateAttr && void 0 === value) {
14468
+ const defaultValue = null == readStateTransitionDefaultAttribute ? void 0 : readStateTransitionDefaultAttribute(key, stateTransitionTargetAttrs);
14469
+ if (void 0 === defaultValue && (null == shouldSkipDefaultAttribute ? void 0 : shouldSkipDefaultAttribute(key, stateTransitionTargetAttrs))) return;
14470
+ plan.animateAttrs[key] = defaultValue;
14471
+ } else if (isClear && void 0 === value) {
14462
14472
  if (null == shouldSkipDefaultAttribute ? void 0 : shouldSkipDefaultAttribute(key, targetAttrs)) return;
14463
14473
  plan.animateAttrs[key] = readDefaultAttribute(key);
14464
14474
  } else plan.animateAttrs[key] = value;
@@ -14470,7 +14480,7 @@
14470
14480
  const extraAnimateAttrs = options.extraAnimateAttrs;
14471
14481
  if (extraAnimateAttrs) for (const key in extraAnimateAttrs) {
14472
14482
  const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetAttrs, key);
14473
- !Object.prototype.hasOwnProperty.call(extraAnimateAttrs, key) || hasTargetAttr && void 0 !== targetAttrs[key] || assignTransitionAttr(key, extraAnimateAttrs[key]);
14483
+ !Object.prototype.hasOwnProperty.call(extraAnimateAttrs, key) || hasTargetAttr && void 0 !== targetAttrs[key] || assignTransitionAttr(key, extraAnimateAttrs[key], !0);
14474
14484
  }
14475
14485
  return plan;
14476
14486
  }
@@ -14502,9 +14512,11 @@
14502
14512
  noWorkAnimateAttr: graphic.getNoWorkAnimateAttr(),
14503
14513
  isClear: !0,
14504
14514
  getDefaultAttribute: graphic.getDefaultAttribute.bind(graphic),
14515
+ getStateTransitionDefaultAttribute: options.getStateTransitionDefaultAttribute,
14505
14516
  shouldSkipDefaultAttribute: null !== (_a = options.shouldSkipDefaultAttribute) && void 0 !== _a ? _a : graphic.shouldSkipStateTransitionDefaultAttribute.bind(graphic),
14506
14517
  animateConfig: options.animateConfig,
14507
- extraAnimateAttrs: options.extraAnimateAttrs
14518
+ extraAnimateAttrs: options.extraAnimateAttrs,
14519
+ stateTransitionTargetAttrs: options.stateTransitionTargetAttrs
14508
14520
  });
14509
14521
  return this.applyTransition(graphic, plan, hasAnimation, options);
14510
14522
  }
@@ -14719,17 +14731,14 @@
14719
14731
  }
14720
14732
  return null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope;
14721
14733
  }
14722
- syncSharedStateScopeBinding(nextScope, markDirty = !0) {
14734
+ syncSharedStateScopeBindingFromTree(markDirty = !0) {
14723
14735
  var _a;
14736
+ const nextScope = this.resolveBoundSharedStateScope();
14724
14737
  return this.boundSharedStateScope === nextScope ? (this.syncSharedStateActiveRegistrations(), !1) : (this.boundSharedStateScope = nextScope, this.boundSharedStateRevision = void 0, this.compiledStateDefinitions = void 0, this.compiledStateDefinitionsCacheKey = void 0, this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0, this.syncSharedStateActiveRegistrations(), markDirty && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.markSharedStateDirty(), !0);
14725
14738
  }
14726
- syncSharedStateScopeBindingFromTree(markDirty = !0, inheritedSharedStateScope) {
14727
- const nextScope = void 0 === inheritedSharedStateScope ? this.resolveBoundSharedStateScope() : null != inheritedSharedStateScope ? inheritedSharedStateScope : void 0;
14728
- return this.syncSharedStateScopeBinding(nextScope, markDirty);
14729
- }
14730
- syncSharedStateScopeBindingOnTreeChange(markDirty = !0, inheritedSharedStateScope) {
14739
+ syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
14731
14740
  var _a, _b;
14732
- return !!((null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || this.boundSharedStateScope || (null === (_b = this.registeredActiveScopes) || void 0 === _b ? void 0 : _b.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingFromTree(markDirty, inheritedSharedStateScope);
14741
+ return !!((null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || this.boundSharedStateScope || (null === (_b = this.registeredActiveScopes) || void 0 === _b ? void 0 : _b.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingFromTree(markDirty);
14733
14742
  }
14734
14743
  syncSharedStateActiveRegistrations() {
14735
14744
  var _a;
@@ -14737,7 +14746,6 @@
14737
14746
  if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
14738
14747
  scope.subtreeActiveDescendants.delete(this);
14739
14748
  }), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
14740
- if ((null == previousScopes ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) return;
14741
14749
  const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
14742
14750
  null == previousScopes || previousScopes.forEach(scope => {
14743
14751
  nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
@@ -14745,15 +14753,6 @@
14745
14753
  scope.subtreeActiveDescendants.add(this);
14746
14754
  }), this.registeredActiveScopes = nextScopes;
14747
14755
  }
14748
- isSharedStateScopeChainRegistered(previousScopes) {
14749
- let scope = this.boundSharedStateScope,
14750
- scopeCount = 0;
14751
- for (; scope;) {
14752
- if (!previousScopes.has(scope)) return !1;
14753
- scopeCount += 1, scope = scope.parentScope;
14754
- }
14755
- return scopeCount === previousScopes.size;
14756
- }
14757
14756
  clearSharedStateActiveRegistrations() {
14758
14757
  const previousScopes = this.registeredActiveScopes;
14759
14758
  previousScopes && (previousScopes.forEach(scope => {
@@ -14763,8 +14762,8 @@
14763
14762
  markSharedStateDirty() {
14764
14763
  this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
14765
14764
  }
14766
- onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
14767
- this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope) : this.setStage(stage, layer, inheritedSharedStateScope);
14765
+ onParentSharedStateTreeChanged(stage, layer) {
14766
+ this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
14768
14767
  }
14769
14768
  refreshSharedStateBeforeRender() {
14770
14769
  var _a;
@@ -14814,21 +14813,20 @@
14814
14813
  }), snapshot) : snapshot;
14815
14814
  }
14816
14815
  buildRemovedStateAnimationAttrs(targetStateAttrs, previousResolvedStatePatch) {
14817
- const extraAttrs = {};
14818
- if (!previousResolvedStatePatch) return extraAttrs;
14816
+ if (!previousResolvedStatePatch) return;
14819
14817
  const snapshot = this.buildStaticAttributeSnapshot(),
14820
- staticTargetAttrs = snapshot;
14818
+ extraAttrs = {};
14821
14819
  return Object.keys(previousResolvedStatePatch).forEach(key => {
14822
14820
  const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetStateAttrs, key);
14823
14821
  if (hasTargetAttr && void 0 !== targetStateAttrs[key]) return;
14824
14822
  const assignFallbackAttr = value => {
14825
- void 0 === value && this.shouldSkipStateTransitionDefaultAttribute(key, staticTargetAttrs) || (extraAttrs[key] = void 0 === value ? value : cloneAttributeValue(value));
14823
+ extraAttrs[key] = void 0 === value ? value : cloneAttributeValue(value);
14826
14824
  };
14827
- if (hasTargetAttr) assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));else if (Object.prototype.hasOwnProperty.call(snapshot, key)) {
14828
- const snapshotValue = snapshot[key];
14829
- assignFallbackAttr(void 0 === snapshotValue ? this.getStateTransitionDefaultAttribute(key, staticTargetAttrs) : snapshotValue);
14830
- } else assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));
14831
- }), extraAttrs;
14825
+ hasTargetAttr ? assignFallbackAttr(targetStateAttrs[key]) : Object.prototype.hasOwnProperty.call(snapshot, key) ? assignFallbackAttr(snapshot[key]) : assignFallbackAttr(void 0);
14826
+ }), {
14827
+ extraAttrs: extraAttrs,
14828
+ stateTransitionTargetAttrs: snapshot
14829
+ };
14832
14830
  }
14833
14831
  syncObjectToSnapshot(target, snapshot, excludedKeys) {
14834
14832
  const delta = new Map();
@@ -15415,10 +15413,6 @@
15415
15413
  var _a;
15416
15414
  return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
15417
15415
  }
15418
- setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
15419
- var _a;
15420
- this.states = definitions, this.localStateDefinitionsSource !== definitions && (this.localStateDefinitionsSource = definitions, this.localStateDefinitionsVersion = (null !== (_a = this.localStateDefinitionsVersion) && void 0 !== _a ? _a : 0) + 1), this.compiledStateDefinitions = compiledDefinitions, this.compiledStateDefinitionsCacheKey = `local:${this.localStateDefinitionsVersion}`;
15421
- }
15422
15416
  getStateResolveBaseAttrs() {
15423
15417
  var _a;
15424
15418
  return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
@@ -15548,29 +15542,37 @@
15548
15542
  resolvedStateAttrs: resolvedStateAttrs
15549
15543
  } = this.resolveGraphicStateTransition(states, !0),
15550
15544
  patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
15551
- patchChanged && !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1) || (this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), patchChanged && (hasAnimation && animateSameStatePatchChange ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
15545
+ if ((!patchChanged || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) && (this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), patchChanged)) if (hasAnimation && animateSameStatePatchChange) {
15546
+ this._syncFinalAttributeFromStaticTruth();
15547
+ const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
15548
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
15549
+ } else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
15552
15550
  type: AttributeUpdateType.STATE
15553
15551
  }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
15554
15552
  type: AttributeUpdateType.STATE
15555
- }), this.emitStateUpdateEvent())));
15553
+ }), this.emitStateUpdateEvent();
15556
15554
  }
15557
15555
  resolveStateAnimateConfig(animateConfig) {
15558
15556
  var _a, _b, _c;
15559
15557
  return null !== (_c = null !== (_a = null != animateConfig ? animateConfig : this.stateAnimateConfig) && void 0 !== _a ? _a : null === (_b = this.context) || void 0 === _b ? void 0 : _b.stateAnimateConfig) && void 0 !== _c ? _c : DefaultStateAnimateConfig;
15560
15558
  }
15561
- applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs) {
15559
+ applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs, stateTransitionTargetAttrs) {
15562
15560
  const resolvedAnimateConfig = hasAnimation ? this.resolveStateAnimateConfig(animateConfig) : void 0,
15563
15561
  transitionOptions = resolvedAnimateConfig ? {
15564
15562
  animateConfig: resolvedAnimateConfig,
15565
15563
  extraAnimateAttrs: extraAnimateAttrs,
15566
- shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
15564
+ getStateTransitionDefaultAttribute: this.getStateTransitionDefaultAttribute.bind(this),
15565
+ shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this),
15566
+ stateTransitionTargetAttrs: stateTransitionTargetAttrs
15567
15567
  } : void 0;
15568
15568
  if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, transitionOptions);
15569
15569
  const plan = this.getStateTransitionOrchestrator().analyzeTransition(attrs, hasAnimation, {
15570
15570
  noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
15571
15571
  animateConfig: resolvedAnimateConfig,
15572
15572
  extraAnimateAttrs: extraAnimateAttrs,
15573
- shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
15573
+ getStateTransitionDefaultAttribute: this.getStateTransitionDefaultAttribute.bind(this),
15574
+ shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this),
15575
+ stateTransitionTargetAttrs: stateTransitionTargetAttrs
15574
15576
  });
15575
15577
  this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
15576
15578
  }
@@ -15597,11 +15599,15 @@
15597
15599
  transition = this.resolveClearStatesTransition();
15598
15600
  if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
15599
15601
  const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
15600
- transition.changed && !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0) || (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
15602
+ if (!transition.changed || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0)) if (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(), hasAnimation) {
15603
+ this._syncFinalAttributeFromStaticTruth();
15604
+ const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
15605
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
15606
+ } else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
15601
15607
  type: AttributeUpdateType.STATE
15602
15608
  }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
15603
15609
  type: AttributeUpdateType.STATE
15604
- }), this.emitStateUpdateEvent()));
15610
+ }), this.emitStateUpdateEvent();
15605
15611
  }
15606
15612
  removeState(stateName, hasAnimation) {
15607
15613
  const transition = this.resolveRemoveStateTransition(stateName);
@@ -15642,11 +15648,15 @@
15642
15648
  effectiveStates: effectiveStates,
15643
15649
  resolvedStateAttrs: resolvedStateAttrs
15644
15650
  } = this.resolveGraphicStateTransition(states);
15645
- !transition.changed && this.sameStateNames(previousStates, transition.states) || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1) && (this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
15651
+ if ((transition.changed || !this.sameStateNames(previousStates, transition.states)) && this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) if (this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), hasAnimation) {
15652
+ this._syncFinalAttributeFromStaticTruth();
15653
+ const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
15654
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
15655
+ } else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
15646
15656
  type: AttributeUpdateType.STATE
15647
15657
  }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
15648
15658
  type: AttributeUpdateType.STATE
15649
- }), this.emitStateUpdateEvent()));
15659
+ }), this.emitStateUpdateEvent();
15650
15660
  }
15651
15661
  invalidateResolver() {
15652
15662
  var _a, _b;
@@ -15766,12 +15776,12 @@
15766
15776
  this._globalTransMatrix.translate(scrollX, scrollY);
15767
15777
  }
15768
15778
  }
15769
- setStage(stage, layer, inheritedSharedStateScope) {
15779
+ setStage(stage, layer) {
15770
15780
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
15771
15781
  const graphicService = null !== (_c = null !== (_a = null == stage ? void 0 : stage.graphicService) && void 0 !== _a ? _a : null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService,
15772
15782
  previousStage = this.stage;
15773
15783
  if (this.stage !== stage || this.layer !== layer) {
15774
- if (this.stage = stage, this.layer = layer, ((null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length) || this.boundSharedStateScope || (null === (_e = this.registeredActiveScopes) || void 0 === _e ? void 0 : _e.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope), this.setStageToShadowRoot(stage, layer), this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
15784
+ if (this.stage = stage, this.layer = layer, ((null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length) || this.boundSharedStateScope || (null === (_e = this.registeredActiveScopes) || void 0 === _e ? void 0 : _e.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0), this.setStageToShadowRoot(stage, layer), this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
15775
15785
  const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
15776
15786
  nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
15777
15787
  detachedStageAnimates = [];
@@ -15788,7 +15798,7 @@
15788
15798
  }
15789
15799
  return this._onSetStage && this._onSetStage(this, stage, layer), void (null === (_h = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _h || _h.call(graphicService, this, stage));
15790
15800
  }
15791
- ((null === (_j = this.currentStates) || void 0 === _j ? void 0 : _j.length) || this.boundSharedStateScope || (null === (_k = this.registeredActiveScopes) || void 0 === _k ? void 0 : _k.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope);
15801
+ ((null === (_j = this.currentStates) || void 0 === _j ? void 0 : _j.length) || this.boundSharedStateScope || (null === (_k = this.registeredActiveScopes) || void 0 === _k ? void 0 : _k.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0);
15792
15802
  }
15793
15803
  detachStageForRelease() {
15794
15804
  var _a, _b, _c;
@@ -16729,13 +16739,13 @@
16729
16739
  child.setStage(null, null);
16730
16740
  }), this.addUpdateBoundTag();
16731
16741
  }
16732
- setStage(stage, layer, inheritedSharedStateScope) {
16742
+ setStage(stage, layer) {
16733
16743
  var _a, _b, _c, _d, _e, _f;
16734
16744
  const graphicService = null !== (_c = null !== (_a = null == stage ? void 0 : stage.graphicService) && void 0 !== _a ? _a : null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService,
16735
16745
  needsSharedStateTreeSync = this.hasSharedStateDefinitions() || this.sharedStateScope || (null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length) || this.boundSharedStateScope || (null === (_e = this.registeredActiveScopes) || void 0 === _e ? void 0 : _e.size) || this.sharedStateDirty;
16736
- if (this.stage !== stage) return this.stage = stage, this.layer = layer, needsSharedStateTreeSync && (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope)), this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), null === (_f = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _f || _f.call(graphicService, this, stage), void this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
16746
+ if (this.stage !== stage) return this.stage = stage, this.layer = layer, needsSharedStateTreeSync && (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0)), this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), null === (_f = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _f || _f.call(graphicService, this, stage), void this.notifyChildrenSharedStateTreeChanged();
16737
16747
  const layerChanged = this.layer !== layer;
16738
- layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope), this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope)) : layerChanged && this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
16748
+ layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.notifyChildrenSharedStateTreeChanged();
16739
16749
  }
16740
16750
  addUpdatePositionTag() {
16741
16751
  super.addUpdatePositionTag(), this.forEachChildren(g => {
@@ -16794,26 +16804,17 @@
16794
16804
  hasSharedStateDefinitions() {
16795
16805
  return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
16796
16806
  }
16797
- resolveChildSharedStateScope(inheritedSharedStateScope) {
16798
- var _a;
16799
- return this.sharedStateScope ? this.sharedStateScope : void 0 !== inheritedSharedStateScope ? inheritedSharedStateScope : null !== (_a = this.resolveBoundSharedStateScope()) && void 0 !== _a ? _a : null;
16800
- }
16801
- notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope) {
16802
- const childSharedStateScope = this.resolveChildSharedStateScope(inheritedSharedStateScope);
16807
+ notifyChildrenSharedStateTreeChanged() {
16803
16808
  this.forEachChildren(item => {
16804
- this.setStageToChild(item, childSharedStateScope);
16809
+ this.syncChildSharedStateTreeBinding(item);
16805
16810
  });
16806
16811
  }
16807
- setStageToChild(child, inheritedSharedStateScope) {
16808
- const graphic = child;
16809
- "function" != typeof graphic.setStage || child.onParentSharedStateTreeChanged !== Graphic.prototype.onParentSharedStateTreeChanged && child.onParentSharedStateTreeChanged !== Group.prototype.onParentSharedStateTreeChanged || graphic.stage === this.stage && graphic.layer === this.layer ? child.onParentSharedStateTreeChanged(this.stage, this.layer, inheritedSharedStateScope) : graphic.setStage(this.stage, this.layer, inheritedSharedStateScope);
16812
+ syncChildSharedStateTreeBinding(child) {
16813
+ child.onParentSharedStateTreeChanged(this.stage, this.layer);
16810
16814
  }
16811
- syncChildSharedStateTreeBinding(child, inheritedSharedStateScope) {
16812
- void 0 === inheritedSharedStateScope && (inheritedSharedStateScope = this.resolveChildSharedStateScope()), this.setStageToChild(child, inheritedSharedStateScope);
16813
- }
16814
- onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
16815
+ onParentSharedStateTreeChanged(stage, layer) {
16815
16816
  var _a;
16816
- this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length), inheritedSharedStateScope), this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope)) : this.setStage(stage, layer, inheritedSharedStateScope);
16817
+ this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length)), this.notifyChildrenSharedStateTreeChanged()) : this.setStage(stage, layer);
16817
16818
  }
16818
16819
  };
16819
16820
  Group$1.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
@@ -17096,7 +17097,204 @@
17096
17097
  return new Path(attributes);
17097
17098
  }
17098
17099
 
17099
- const POLYGON_UPDATE_TAG_KEY = ["points", "cornerRadius", ...GRAPHIC_UPDATE_TAG_KEY];
17100
+ function drawPolygon(path, points, x, y) {
17101
+ if (points && points.length) {
17102
+ path.moveTo(points[0].x + x, points[0].y + y);
17103
+ for (let i = 1; i < points.length; i++) path.lineTo(points[i].x + x, points[i].y + y);
17104
+ }
17105
+ }
17106
+ function drawRoundedPolygon(path, points, x, y, cornerRadius, closePath = !0) {
17107
+ var _a;
17108
+ const normalized = normalizePolygonPoints(points, cornerRadius, closePath);
17109
+ if (normalized) return void drawRoundedPolygon(path, normalized.points, x, y, normalized.cornerRadius, closePath);
17110
+ if (points.length < 3) return void drawPolygon(path, points, x, y);
17111
+ let startI = 0,
17112
+ endI = points.length - 1;
17113
+ closePath || (startI += 1, endI -= 1, path.moveTo(points[0].x + x, points[0].y + y));
17114
+ for (let i = startI; i <= endI; i++) {
17115
+ const p1 = points[0 === i ? endI : (i - 1) % points.length],
17116
+ angularPoint = points[i % points.length],
17117
+ p2 = points[(i + 1) % points.length],
17118
+ dx1 = angularPoint.x - p1.x,
17119
+ dy1 = angularPoint.y - p1.y,
17120
+ dx2 = angularPoint.x - p2.x,
17121
+ dy2 = angularPoint.y - p2.y,
17122
+ angle = (Math.atan2(dy1, dx1) - Math.atan2(dy2, dx2)) / 2,
17123
+ tan = Math.abs(Math.tan(angle));
17124
+ let radius = Array.isArray(cornerRadius) ? null !== (_a = cornerRadius[i % points.length]) && void 0 !== _a ? _a : 0 : cornerRadius,
17125
+ segment = radius / tan;
17126
+ const length1 = getLength(dx1, dy1),
17127
+ length2 = getLength(dx2, dy2),
17128
+ length = Math.min(length1, length2);
17129
+ segment > length && (segment = length, radius = length * tan);
17130
+ const p1Cross = getProportionPoint(angularPoint, segment, length1, dx1, dy1),
17131
+ p2Cross = getProportionPoint(angularPoint, segment, length2, dx2, dy2),
17132
+ dx = 2 * angularPoint.x - p1Cross.x - p2Cross.x,
17133
+ dy = 2 * angularPoint.y - p1Cross.y - p2Cross.y,
17134
+ L = getLength(dx, dy),
17135
+ circlePoint = getProportionPoint(angularPoint, getLength(segment, radius), L, dx, dy);
17136
+ let startAngle = Math.atan2(p1Cross.y - circlePoint.y, p1Cross.x - circlePoint.x);
17137
+ const endAngle = Math.atan2(p2Cross.y - circlePoint.y, p2Cross.x - circlePoint.x);
17138
+ let sweepAngle = endAngle - startAngle;
17139
+ sweepAngle < 0 && (startAngle = endAngle, sweepAngle = -sweepAngle), sweepAngle > Math.PI && (sweepAngle -= Math.PI), 0 === i ? path.moveTo(p1Cross.x + x, p1Cross.y + y) : path.lineTo(p1Cross.x + x, p1Cross.y + y), sweepAngle && path.arcTo(angularPoint.x + x, angularPoint.y + y, p2Cross.x + x, p2Cross.y + y, radius), path.lineTo(p2Cross.x + x, p2Cross.y + y);
17140
+ }
17141
+ closePath || path.lineTo(points[endI + 1].x + x, points[endI + 1].y + y);
17142
+ }
17143
+ function getLength(dx, dy) {
17144
+ return Math.sqrt(dx * dx + dy * dy);
17145
+ }
17146
+ function getProportionPoint(point, segment, length, dx, dy) {
17147
+ const factor = segment / length;
17148
+ return {
17149
+ x: point.x - dx * factor,
17150
+ y: point.y - dy * factor
17151
+ };
17152
+ }
17153
+ function normalizePolygonPoints(points, cornerRadius, closePath = !0) {
17154
+ var _a;
17155
+ let hasDuplicate = !1;
17156
+ for (let i = 1; i < points.length; i++) if (isSamePoint(points[i - 1], points[i])) {
17157
+ hasDuplicate = !0;
17158
+ break;
17159
+ }
17160
+ if (!hasDuplicate && closePath && points.length > 1 && isSamePoint(points[0], points[points.length - 1]) && (hasDuplicate = !0), !hasDuplicate) return null;
17161
+ const normalizedPoints = [],
17162
+ normalizedCornerRadius = Array.isArray(cornerRadius) ? [] : null;
17163
+ for (let i = 0; i < points.length; i++) normalizedPoints.length && isSamePoint(normalizedPoints[normalizedPoints.length - 1], points[i]) || (normalizedPoints.push(points[i]), null == normalizedCornerRadius || normalizedCornerRadius.push(null !== (_a = cornerRadius[i]) && void 0 !== _a ? _a : 0));
17164
+ return closePath && normalizedPoints.length > 1 && isSamePoint(normalizedPoints[0], normalizedPoints[normalizedPoints.length - 1]) && (normalizedPoints.pop(), null == normalizedCornerRadius || normalizedCornerRadius.pop()), {
17165
+ points: normalizedPoints,
17166
+ cornerRadius: null != normalizedCornerRadius ? normalizedCornerRadius : cornerRadius
17167
+ };
17168
+ }
17169
+ function isSamePoint(a, b) {
17170
+ return a.x === b.x && a.y === b.y;
17171
+ }
17172
+ function getPolygonWinding(points) {
17173
+ let signedArea = 0;
17174
+ for (let i = 0; i < points.length; i++) {
17175
+ const current = points[i],
17176
+ next = points[(i + 1) % points.length];
17177
+ signedArea += current.x * next.y - next.x * current.y;
17178
+ }
17179
+ return signedArea > 0 ? 1 : -1;
17180
+ }
17181
+ function offsetPolygonPoints(points, distance, closePath = !0) {
17182
+ var _a;
17183
+ const n = null !== (_a = null == points ? void 0 : points.length) && void 0 !== _a ? _a : 0;
17184
+ if (n < 2 || closePath && n < 3 || !distance) return points;
17185
+ const sign = getPolygonWinding(points),
17186
+ edgeCount = closePath ? n : n - 1,
17187
+ lines = [];
17188
+ for (let i = 0; i < edgeCount; i++) {
17189
+ const cur = points[i],
17190
+ next = points[(i + 1) % n],
17191
+ dx = next.x - cur.x,
17192
+ dy = next.y - cur.y,
17193
+ len = Math.sqrt(dx * dx + dy * dy);
17194
+ if (!len) {
17195
+ lines.push(null);
17196
+ continue;
17197
+ }
17198
+ const offsetX = sign * dy * distance / len,
17199
+ offsetY = -sign * dx * distance / len;
17200
+ lines.push({
17201
+ x: cur.x + offsetX,
17202
+ y: cur.y + offsetY,
17203
+ dx: dx,
17204
+ dy: dy,
17205
+ len: len,
17206
+ offsetX: offsetX,
17207
+ offsetY: offsetY
17208
+ });
17209
+ }
17210
+ const prevLines = new Array(n);
17211
+ let prevLine = null;
17212
+ if (closePath) for (let i = edgeCount - 1; i >= 0; i--) if (lines[i]) {
17213
+ prevLine = lines[i];
17214
+ break;
17215
+ }
17216
+ for (let i = 0; i < n; i++) prevLines[i] = prevLine, i < edgeCount && lines[i] && (prevLine = lines[i]);
17217
+ const nextLines = new Array(n);
17218
+ let nextLine = null;
17219
+ if (closePath) for (let count = 0; count < edgeCount; count++) {
17220
+ const line = lines[(n - 1 + count) % edgeCount];
17221
+ if (line) {
17222
+ nextLine = line;
17223
+ break;
17224
+ }
17225
+ }
17226
+ for (let i = n - 1; i >= 0; i--) i < edgeCount && lines[i] && (nextLine = lines[i]), nextLines[i] = nextLine;
17227
+ const offsetPointByLine = (point, line) => ({
17228
+ x: point.x + line.offsetX,
17229
+ y: point.y + line.offsetY
17230
+ }),
17231
+ result = [];
17232
+ for (let i = 0; i < n; i++) {
17233
+ const prev = prevLines[i],
17234
+ cur = nextLines[i],
17235
+ line = prev || cur;
17236
+ if (!line) {
17237
+ result.push(points[i]);
17238
+ continue;
17239
+ }
17240
+ if (!prev || !cur) {
17241
+ result.push(offsetPointByLine(points[i], line));
17242
+ continue;
17243
+ }
17244
+ const denominator = prev.dx * cur.dy - prev.dy * cur.dx;
17245
+ if (Math.abs(denominator) <= 1e-12 * prev.len * cur.len) {
17246
+ result.push(offsetPointByLine(points[i], cur));
17247
+ continue;
17248
+ }
17249
+ const t = ((cur.x - prev.x) * cur.dy - (cur.y - prev.y) * cur.dx) / denominator,
17250
+ point = {
17251
+ x: prev.x + prev.dx * t,
17252
+ y: prev.y + prev.dy * t
17253
+ };
17254
+ result.push(Number.isFinite(point.x) && Number.isFinite(point.y) ? point : offsetPointByLine(points[i], cur));
17255
+ }
17256
+ return result;
17257
+ }
17258
+
17259
+ const getBoundsScaleMatrix = polygon => {
17260
+ var _a;
17261
+ const globalMatrix = polygon.globalTransMatrix,
17262
+ viewBoxMatrix = null === (_a = polygon.stage) || void 0 === _a ? void 0 : _a.window.getViewBoxTransform();
17263
+ return viewBoxMatrix ? {
17264
+ a: viewBoxMatrix.a * globalMatrix.a + viewBoxMatrix.c * globalMatrix.b,
17265
+ b: viewBoxMatrix.b * globalMatrix.a + viewBoxMatrix.d * globalMatrix.b,
17266
+ c: viewBoxMatrix.a * globalMatrix.c + viewBoxMatrix.c * globalMatrix.d,
17267
+ d: viewBoxMatrix.b * globalMatrix.c + viewBoxMatrix.d * globalMatrix.d
17268
+ } : globalMatrix;
17269
+ };
17270
+ const getPolygonBoundsScale = polygon => getScaledStrokeWithMatrix(getBoundsScaleMatrix(polygon), 1, 1);
17271
+ const updateBoundsOfPolygonOuterBorder = (attribute, polygonTheme, aabbBounds, polygon) => {
17272
+ const {
17273
+ outerBorder: outerBorder,
17274
+ points = polygonTheme.points,
17275
+ closePath = polygonTheme.closePath,
17276
+ shadowBlur = polygonTheme.shadowBlur,
17277
+ keepStrokeScale = polygonTheme.keepStrokeScale
17278
+ } = attribute;
17279
+ if (outerBorder && !1 !== outerBorder.visible) {
17280
+ const defaultOuterBorder = polygonTheme.outerBorder,
17281
+ {
17282
+ distance = defaultOuterBorder.distance,
17283
+ lineWidth = defaultOuterBorder.lineWidth,
17284
+ lineJoin = defaultOuterBorder.lineJoin,
17285
+ strokeBoundsBuffer = defaultOuterBorder.strokeBoundsBuffer
17286
+ } = outerBorder,
17287
+ boundsScale = getPolygonBoundsScale(polygon);
17288
+ let scaledDistance = distance;
17289
+ keepStrokeScale || (scaledDistance *= boundsScale), offsetPolygonPoints(points, scaledDistance, closePath).forEach(point => {
17290
+ aabbBounds.add(point.x, point.y);
17291
+ });
17292
+ boundStroke(aabbBounds, (shadowBlur * boundsScale + lineWidth * (keepStrokeScale ? 1 : boundsScale)) / 2, "miter" === lineJoin, strokeBoundsBuffer);
17293
+ }
17294
+ return aabbBounds;
17295
+ };
17296
+
17297
+ const POLYGON_UPDATE_TAG_KEY = ["points", "cornerRadius", "outerBorder", "keepStrokeScale", ...GRAPHIC_UPDATE_TAG_KEY];
17100
17298
  class Polygon extends Graphic {
17101
17299
  constructor(params) {
17102
17300
  super(params), this.type = "polygon", this.numberType = POLYGON_NUMBER_TYPE;
@@ -17113,6 +17311,16 @@
17113
17311
  getGraphicTheme() {
17114
17312
  return getTheme$1(this).polygon;
17115
17313
  }
17314
+ tryUpdateAABBBounds() {
17315
+ const {
17316
+ outerBorder: outerBorder
17317
+ } = this.attribute;
17318
+ if (outerBorder && !1 !== outerBorder.visible) {
17319
+ const boundsScale = getPolygonBoundsScale(this);
17320
+ boundsScale !== this._outerBorderBoundsScale && (this._outerBorderBoundsScale = boundsScale, this.addUpdateBoundTag());
17321
+ } else this._outerBorderBoundsScale = void 0;
17322
+ return super.tryUpdateAABBBounds();
17323
+ }
17116
17324
  updateAABBBounds(attribute, polygonTheme, aabbBounds) {
17117
17325
  this.updatePathProxyAABBBounds(aabbBounds) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds), application.graphicService.updateTempAABBBounds(aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
17118
17326
  const {
@@ -17126,7 +17334,7 @@
17126
17334
  } = attribute;
17127
17335
  return points.forEach(p => {
17128
17336
  aabbBounds.add(p.x, p.y);
17129
- }), aabbBounds;
17337
+ }), updateBoundsOfPolygonOuterBorder(attribute, polygonTheme, aabbBounds, this), aabbBounds;
17130
17338
  }
17131
17339
  _interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes) {
17132
17340
  "points" === key && (nextAttributes.points = pointsInterpolation(lastStepVal, nextStepVal, ratio));
@@ -18180,8 +18388,8 @@
18180
18388
  clone() {
18181
18389
  return new RichText(Object.assign({}, this.attribute));
18182
18390
  }
18183
- setStage(stage, layer, inheritedSharedStateScope) {
18184
- super.setStage(stage, layer, inheritedSharedStateScope);
18391
+ setStage(stage, layer) {
18392
+ super.setStage(stage, layer);
18185
18393
  this.getFrameCache().icons.forEach(icon => {
18186
18394
  icon.setStage(stage, layer);
18187
18395
  });
@@ -18569,8 +18777,15 @@
18569
18777
  const b = this.AABBBounds;
18570
18778
  return this._OBBBounds.setValue(b.x1, b.y1, b.x2, b.y2), this._OBBBounds;
18571
18779
  }
18572
- this.obbText || (this.obbText = new Text({})), this.obbText.setAttributes(Object.assign(Object.assign({}, attribute), {
18573
- angle: 0
18780
+ this.obbText || (this.obbText = new Text({}));
18781
+ const {
18782
+ dx = 0,
18783
+ dy = 0
18784
+ } = attribute;
18785
+ this.obbText.setAttributes(Object.assign(Object.assign({}, attribute), {
18786
+ angle: 0,
18787
+ dx: 0,
18788
+ dy: 0
18574
18789
  }));
18575
18790
  const bounds1 = this.obbText.AABBBounds,
18576
18791
  {
@@ -18585,7 +18800,7 @@
18585
18800
  x: x,
18586
18801
  y: y
18587
18802
  });
18588
- return this._OBBBounds.copy(bounds1), this._OBBBounds.translate(center.x - boundsCenter.x, center.y - boundsCenter.y), this._OBBBounds.angle = angle, this._OBBBounds;
18803
+ return this._OBBBounds.copy(bounds1), this._OBBBounds.translate(center.x - boundsCenter.x + dx, center.y - boundsCenter.y + dy), this._OBBBounds.angle = angle, this._OBBBounds;
18589
18804
  }
18590
18805
  updateAABBBounds(attribute, textTheme, aabbBounds) {
18591
18806
  const {
@@ -23453,22 +23668,26 @@
23453
23668
  width: width,
23454
23669
  height: height
23455
23670
  } = rect.attribute;
23456
- width = (null != width ? width : x1 - x) || 0, height = (null != height ? height : y1 - y) || 0;
23457
- const renderBorder = (borderStyle, key) => {
23458
- const doStroke = !(!borderStyle || !borderStyle.stroke),
23459
- sign = "outerBorder" === key ? -1 : 1,
23460
- {
23461
- distance = rectAttribute[key].distance
23462
- } = borderStyle,
23463
- d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
23464
- nextX = x + sign * d,
23465
- nextY = y + sign * d,
23466
- dw = 2 * d;
23467
- if (0 === cornerRadius || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) ? (context.beginPath(), context.rect(nextX, nextY, width - sign * dw, height - sign * dw)) : (context.beginPath(), createRectPath(context, nextX, nextY, width - sign * dw, height - sign * dw, cornerRadius, "bevel" !== cornerType)), context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), strokeCb) strokeCb(context, borderStyle, rectAttribute[key]);else if (doStroke) {
23468
- const lastOpacity = rectAttribute[key].opacity;
23469
- rectAttribute[key].opacity = opacity, context.setStrokeStyle(rect, borderStyle, (originX - x) / scaleX, (originY - y) / scaleY, rectAttribute[key]), rectAttribute[key].opacity = lastOpacity, context.stroke();
23470
- }
23471
- };
23671
+ width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
23672
+ const borderX = width < 0 ? x + width : x,
23673
+ borderY = height < 0 ? y + height : y,
23674
+ borderWidth = width < 0 ? -width : width,
23675
+ borderHeight = height < 0 ? -height : height,
23676
+ renderBorder = (borderStyle, key) => {
23677
+ const doStroke = !(!borderStyle || !borderStyle.stroke),
23678
+ sign = "outerBorder" === key ? -1 : 1,
23679
+ {
23680
+ distance = rectAttribute[key].distance
23681
+ } = borderStyle,
23682
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
23683
+ nextX = borderX + sign * d,
23684
+ nextY = borderY + sign * d,
23685
+ dw = 2 * d;
23686
+ if (0 === cornerRadius || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) ? (context.beginPath(), context.rect(nextX, nextY, borderWidth - sign * dw, borderHeight - sign * dw)) : (context.beginPath(), createRectPath(context, nextX, nextY, borderWidth - sign * dw, borderHeight - sign * dw, cornerRadius, "bevel" !== cornerType)), context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), strokeCb) strokeCb(context, borderStyle, rectAttribute[key]);else if (doStroke) {
23687
+ const lastOpacity = rectAttribute[key].opacity;
23688
+ rectAttribute[key].opacity = opacity, context.setStrokeStyle(rect, borderStyle, (originX - x) / scaleX, (originY - y) / scaleY, rectAttribute[key]), rectAttribute[key].opacity = lastOpacity, context.stroke();
23689
+ }
23690
+ };
23472
23691
  doOuterBorder && renderBorder(outerBorder, "outerBorder"), doInnerBorder && renderBorder(innerBorder, "innerBorder");
23473
23692
  }
23474
23693
  }
@@ -23906,7 +24125,8 @@
23906
24125
  const StarRender = Symbol.for("StarRender");
23907
24126
 
23908
24127
  const DrawItemInterceptor = Symbol.for("DrawItemInterceptor");
23909
- const tempDirtyBounds = new AABBBounds(),
24128
+ const INTERACTIVE_POST_MATRIX = "_interactivePostMatrix",
24129
+ tempDirtyBounds = new AABBBounds(),
23910
24130
  tempBackupDirtyBounds = new AABBBounds();
23911
24131
  class ShadowRootDrawItemInterceptorContribution {
23912
24132
  constructor() {
@@ -23970,12 +24190,23 @@
23970
24190
  beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
23971
24191
  return !this.processing && (graphic.baseGraphic ? this.beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) : this.beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params));
23972
24192
  }
24193
+ resolveInteractivePostMatrix(graphic, interactiveGraphic) {
24194
+ const parent = graphic.parent;
24195
+ if (!parent) return graphic.attribute.postMatrix;
24196
+ let matrix = interactiveGraphic[INTERACTIVE_POST_MATRIX];
24197
+ matrix || (matrix = new Matrix(), interactiveGraphic[INTERACTIVE_POST_MATRIX] = matrix);
24198
+ const ancestorMatrix = parent.globalTransMatrix;
24199
+ matrix.setValue(ancestorMatrix.a, ancestorMatrix.b, ancestorMatrix.c, ancestorMatrix.d, ancestorMatrix.e, ancestorMatrix.f);
24200
+ const ownPostMatrix = graphic.attribute.postMatrix;
24201
+ return ownPostMatrix && matrix.multiply(ownPostMatrix.a, ownPostMatrix.b, ownPostMatrix.c, ownPostMatrix.d, ownPostMatrix.e, ownPostMatrix.f), matrix;
24202
+ }
23973
24203
  beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params) {
23974
24204
  let interactiveGraphic = graphic.interactiveGraphic;
23975
24205
  if (graphic.attribute.globalZIndex) {
23976
24206
  interactiveGraphic || (interactiveGraphic = graphic.clone(), graphic.interactiveGraphic = interactiveGraphic, interactiveGraphic.baseGraphic = graphic), interactiveGraphic.setAttributes({
23977
24207
  globalZIndex: 0,
23978
- zIndex: graphic.attribute.globalZIndex
24208
+ zIndex: graphic.attribute.globalZIndex,
24209
+ postMatrix: this.resolveInteractivePostMatrix(graphic, interactiveGraphic)
23979
24210
  }, !1, {
23980
24211
  skipUpdateCallback: !0
23981
24212
  }), drawContext.stage.tryInitInteractiveLayer();
@@ -27718,64 +27949,69 @@
27718
27949
  }
27719
27950
  const pathModule = bindPathRenderModule;
27720
27951
 
27721
- function drawPolygon(path, points, x, y) {
27722
- if (points && points.length) {
27723
- path.moveTo(points[0].x + x, points[0].y + y);
27724
- for (let i = 1; i < points.length; i++) path.lineTo(points[i].x + x, points[i].y + y);
27952
+ const defaultPolygonTextureRenderContribution = defaultBaseTextureRenderContribution;
27953
+ const defaultPolygonBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
27954
+ class DefaultPolygonRenderContribution {
27955
+ constructor() {
27956
+ this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
27725
27957
  }
27726
- }
27727
- function drawRoundedPolygon(path, points, x, y, cornerRadius, closePath = !0) {
27728
- var _a;
27729
- if (points.length < 3) return void drawPolygon(path, points, x, y);
27730
- let startI = 0,
27731
- endI = points.length - 1;
27732
- closePath || (startI += 1, endI -= 1, path.moveTo(points[0].x + x, points[0].y + y));
27733
- for (let i = startI; i <= endI; i++) {
27734
- const p1 = points[0 === i ? endI : (i - 1) % points.length],
27735
- angularPoint = points[i % points.length],
27736
- p2 = points[(i + 1) % points.length],
27737
- dx1 = angularPoint.x - p1.x,
27738
- dy1 = angularPoint.y - p1.y,
27739
- dx2 = angularPoint.x - p2.x,
27740
- dy2 = angularPoint.y - p2.y,
27741
- angle = (Math.atan2(dy1, dx1) - Math.atan2(dy2, dx2)) / 2,
27742
- tan = Math.abs(Math.tan(angle));
27743
- let radius = Array.isArray(cornerRadius) ? null !== (_a = cornerRadius[i % points.length]) && void 0 !== _a ? _a : 0 : cornerRadius,
27744
- segment = radius / tan;
27745
- const length1 = getLength(dx1, dy1),
27746
- length2 = getLength(dx2, dy2),
27747
- length = Math.min(length1, length2);
27748
- segment > length && (segment = length, radius = length * tan);
27749
- const p1Cross = getProportionPoint(angularPoint, segment, length1, dx1, dy1),
27750
- p2Cross = getProportionPoint(angularPoint, segment, length2, dx2, dy2),
27751
- dx = 2 * angularPoint.x - p1Cross.x - p2Cross.x,
27752
- dy = 2 * angularPoint.y - p1Cross.y - p2Cross.y,
27753
- L = getLength(dx, dy),
27754
- circlePoint = getProportionPoint(angularPoint, getLength(segment, radius), L, dx, dy);
27755
- let startAngle = Math.atan2(p1Cross.y - circlePoint.y, p1Cross.x - circlePoint.x);
27756
- const endAngle = Math.atan2(p2Cross.y - circlePoint.y, p2Cross.x - circlePoint.x);
27757
- let sweepAngle = endAngle - startAngle;
27758
- sweepAngle < 0 && (startAngle = endAngle, sweepAngle = -sweepAngle), sweepAngle > Math.PI && (sweepAngle -= Math.PI), 0 === i ? path.moveTo(p1Cross.x + x, p1Cross.y + y) : path.lineTo(p1Cross.x + x, p1Cross.y + y), sweepAngle && path.arcTo(angularPoint.x + x, angularPoint.y + y, p2Cross.x + x, p2Cross.y + y, radius), path.lineTo(p2Cross.x + x, p2Cross.y + y);
27958
+ drawShape(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb) {
27959
+ const {
27960
+ outerBorder: outerBorder,
27961
+ innerBorder: innerBorder
27962
+ } = polygon.attribute,
27963
+ doOuterBorder = outerBorder && !1 !== outerBorder.visible,
27964
+ doInnerBorder = innerBorder && !1 !== innerBorder.visible;
27965
+ if (!doOuterBorder && !doInnerBorder) return;
27966
+ const {
27967
+ points = polygonAttribute.points,
27968
+ cornerRadius = polygonAttribute.cornerRadius,
27969
+ opacity = polygonAttribute.opacity,
27970
+ x: originX = polygonAttribute.x,
27971
+ y: originY = polygonAttribute.y,
27972
+ scaleX = polygonAttribute.scaleX,
27973
+ scaleY = polygonAttribute.scaleY,
27974
+ keepStrokeScale = polygonAttribute.keepStrokeScale,
27975
+ closePath = polygonAttribute.closePath
27976
+ } = polygon.attribute,
27977
+ renderBorder = (borderStyle, key) => {
27978
+ var _a, _b;
27979
+ const doBorderStroke = !!borderStyle.stroke,
27980
+ distanceDirection = "outerBorder" === key ? 1 : -1,
27981
+ {
27982
+ distance = polygonAttribute[key].distance
27983
+ } = borderStyle,
27984
+ borderDistance = distanceDirection * (keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr)),
27985
+ normalized = normalizePolygonPoints(points, cornerRadius, closePath),
27986
+ normalizedPoints = null !== (_a = null == normalized ? void 0 : normalized.points) && void 0 !== _a ? _a : points,
27987
+ normalizedCornerRadius = null !== (_b = null == normalized ? void 0 : normalized.cornerRadius) && void 0 !== _b ? _b : cornerRadius,
27988
+ borderPoints = offsetPolygonPoints(normalizedPoints, borderDistance, closePath),
27989
+ winding = getPolygonWinding(normalizedPoints),
27990
+ borderCornerRadius = normalizedPoints.map((point, i) => {
27991
+ var _a;
27992
+ const radius = isArray$1(normalizedCornerRadius) ? null !== (_a = normalizedCornerRadius[i]) && void 0 !== _a ? _a : 0 : normalizedCornerRadius || 0;
27993
+ if (!closePath && (0 === i || i === normalizedPoints.length - 1) || normalizedPoints.length < 3) return radius;
27994
+ const prev = normalizedPoints[(i - 1 + normalizedPoints.length) % normalizedPoints.length],
27995
+ next = normalizedPoints[(i + 1) % normalizedPoints.length],
27996
+ cornerDirection = ((point.x - prev.x) * (next.y - point.y) - (point.y - prev.y) * (next.x - point.x)) * winding < 0 ? -1 : 1;
27997
+ return Math.max(0, radius + borderDistance * cornerDirection);
27998
+ }),
27999
+ noCorner = 0 === borderCornerRadius.length || borderCornerRadius.every(r => 0 === r);
28000
+ if (context.beginPath(), noCorner ? drawPolygon(context.camera ? context : context.nativeContext, borderPoints, x, y) : drawRoundedPolygon(context.camera ? context : context.nativeContext, borderPoints, x, y, borderCornerRadius, closePath), closePath && context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(polygon, polygon.attribute, polygonAttribute), strokeCb) strokeCb(context, borderStyle, polygonAttribute[key]);else if (doBorderStroke) {
28001
+ const lastOpacity = polygonAttribute[key].opacity,
28002
+ borderStyleWithStrokeScale = borderStyle,
28003
+ lastKeepStrokeScale = borderStyleWithStrokeScale.keepStrokeScale;
28004
+ polygonAttribute[key].opacity = opacity, borderStyleWithStrokeScale.keepStrokeScale = keepStrokeScale, context.setStrokeStyle(polygon, borderStyleWithStrokeScale, (originX - x) / scaleX, (originY - y) / scaleY, polygonAttribute[key]), polygonAttribute[key].opacity = lastOpacity, void 0 === lastKeepStrokeScale ? delete borderStyleWithStrokeScale.keepStrokeScale : borderStyleWithStrokeScale.keepStrokeScale = lastKeepStrokeScale, context.stroke();
28005
+ }
28006
+ };
28007
+ doOuterBorder && renderBorder(outerBorder, "outerBorder"), doInnerBorder && renderBorder(innerBorder, "innerBorder");
27759
28008
  }
27760
- closePath || path.lineTo(points[endI + 1].x + x, points[endI + 1].y + y);
27761
28009
  }
27762
- function getLength(dx, dy) {
27763
- return Math.sqrt(dx * dx + dy * dy);
27764
- }
27765
- function getProportionPoint(point, segment, length, dx, dy) {
27766
- const factor = segment / length;
27767
- return {
27768
- x: point.x - dx * factor,
27769
- y: point.y - dy * factor
27770
- };
27771
- }
27772
-
27773
- const defaultPolygonTextureRenderContribution = defaultBaseTextureRenderContribution;
27774
- const defaultPolygonBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
28010
+ const defaultPolygonRenderContribution = new DefaultPolygonRenderContribution();
27775
28011
 
27776
28012
  class DefaultCanvasPolygonRender extends BaseRender {
27777
28013
  constructor(graphicRenderContributions) {
27778
- super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(graphicRenderContributions);
28014
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonRenderContribution, defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(graphicRenderContributions);
27779
28015
  }
27780
28016
  drawShape(polygon, context, x, y, drawContext, params, fillCb, strokeCb) {
27781
28017
  const polygonAttribute = getTheme$1(polygon, null == params ? void 0 : params.theme).polygon,
@@ -43255,6 +43491,8 @@
43255
43491
  var _a, _b;
43256
43492
  return null !== (_b = null !== (_a = null == params ? void 0 : params.lynx) && void 0 !== _a ? _a : null == params ? void 0 : params.runtime) && void 0 !== _b ? _b : getGlobalLynxRuntime();
43257
43493
  }
43494
+ const requestAnimationFrameBasedSTO = callback => rafBasedSto.call(callback),
43495
+ cancelAnimationFrameBasedSTO = handle => rafBasedSto.clear(handle);
43258
43496
  function getLynxPixelRatio(params, runtime) {
43259
43497
  var _a, _b, _c, _d, _e;
43260
43498
  return null !== (_e = null !== (_d = null !== (_a = null == params ? void 0 : params.pixelRatio) && void 0 !== _a ? _a : null === (_c = null === (_b = null == runtime ? void 0 : runtime.getSystemInfoSync) || void 0 === _b ? void 0 : _b.call(runtime)) || void 0 === _c ? void 0 : _c.pixelRatio) && void 0 !== _d ? _d : getGlobalSystemPixelRatio()) && void 0 !== _e ? _e : 1;
@@ -43326,7 +43564,7 @@
43326
43564
  }
43327
43565
  class LynxEnvContribution extends BaseEnvContribution {
43328
43566
  constructor() {
43329
- super(), this.type = "lynx", this.supportEvent = !0, this.canvasMap = new Map(), this.freeCanvasList = [], this.canvasIdx = 0, this.supportsTouchEvents = !0;
43567
+ super(), this.type = "lynx", this.supportEvent = !0, this.canvasMap = new Map(), this.freeCanvasList = [], this.canvasIdx = 0, this.requestAnimationFrame = requestAnimationFrameBasedSTO, this.cancelAnimationFrame = cancelAnimationFrameBasedSTO, this.supportsTouchEvents = !0;
43330
43568
  try {
43331
43569
  this.supportsPointerEvents = !!globalThis.PointerEvent, this.supportsMouseEvents = !!globalThis.MouseEvent;
43332
43570
  } catch (err) {
@@ -43335,7 +43573,8 @@
43335
43573
  this.applyStyles = !0;
43336
43574
  }
43337
43575
  configure(service, params = {}) {
43338
- service.env === this.type && (service.setActiveEnvContribution(this), this.lynxEnvParams = params, this.lynxRuntime = getLynxRuntime(params));
43576
+ var _a, _b;
43577
+ service.env === this.type && (service.setActiveEnvContribution(this), this.lynxEnvParams = params, this.lynxRuntime = getLynxRuntime(params), "function" == typeof (null === (_a = this.lynxRuntime) || void 0 === _a ? void 0 : _a.requestAnimationFrame) && "function" == typeof (null === (_b = this.lynxRuntime) || void 0 === _b ? void 0 : _b.cancelAnimationFrame) ? (this.requestAnimationFrame = this.lynxRuntime.requestAnimationFrame.bind(this.lynxRuntime), this.cancelAnimationFrame = this.lynxRuntime.cancelAnimationFrame.bind(this.lynxRuntime)) : (this.requestAnimationFrame = requestAnimationFrameBasedSTO, this.cancelAnimationFrame = cancelAnimationFrameBasedSTO));
43339
43578
  }
43340
43579
  getDynamicCanvasCount() {
43341
43580
  return this.freeCanvasList.length;
@@ -43387,14 +43626,10 @@
43387
43626
  return getLynxPixelRatio(void 0, this.lynxRuntime);
43388
43627
  }
43389
43628
  getRequestAnimationFrame() {
43390
- return function (callback) {
43391
- return rafBasedSto.call(callback);
43392
- };
43629
+ return this.requestAnimationFrame;
43393
43630
  }
43394
43631
  getCancelAnimationFrame() {
43395
- return h => {
43396
- rafBasedSto.clear(h);
43397
- };
43632
+ return this.cancelAnimationFrame;
43398
43633
  }
43399
43634
  mapToCanvasPoint(event) {
43400
43635
  var _a;
@@ -48117,7 +48352,6 @@
48117
48352
  }
48118
48353
  _reCompile(updateResult, morphConfig) {
48119
48354
  var _a, _b, _c, _d, _e, _f, _g;
48120
- const shouldRestoreUserEvents = updateResult.reMake && !!this._chart;
48121
48355
  if (updateResult.reMake) {
48122
48356
  this._releaseData();
48123
48357
  this._initDataSet();
@@ -48137,9 +48371,6 @@
48137
48371
  if (updateResult.reMake) {
48138
48372
  const cacheGrammarForMorph = this.isAnimationEnable() && (morphConfig === null || morphConfig === void 0 ? void 0 : morphConfig.morph) !== false;
48139
48373
  (_c = this._compiler) === null || _c === void 0 ? void 0 : _c.releaseGrammar(!cacheGrammarForMorph);
48140
- if (shouldRestoreUserEvents) {
48141
- this._userEvents.forEach(e => { var _a; return (_a = this._event) === null || _a === void 0 ? void 0 : _a.on(e.eType, e.query, e.handler); });
48142
- }
48143
48374
  }
48144
48375
  else if (updateResult.reCompile) {
48145
48376
  (_d = this._compiler) === null || _d === void 0 ? void 0 : _d.clear({ chart: this._chart, vChart: this });
@@ -62854,6 +63085,7 @@
62854
63085
  m.beforeRelease();
62855
63086
  });
62856
63087
  }
63088
+ this._event.release();
62857
63089
  super.release();
62858
63090
  this.clear();
62859
63091
  [...this._components, ...this._regions, ...this._series].forEach(m => {
@@ -70395,7 +70627,7 @@
70395
70627
  loadDiscreteLegendComponent();
70396
70628
  let DiscreteLegend$1 = class DiscreteLegend extends LegendBase {
70397
70629
  constructor(attributes, options) {
70398
- super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, DiscreteLegend.defaultAttributes, attributes)), this.name = "discreteLegend", this._itemsContainer = null, this._itemHeightByUser = void 0, this._itemHeight = 0, this._itemMaxWidth = 0, this._contentMaxHeight = 0, this._stateDefinitionsCache = new WeakMap(), this._onHover = e => {
70630
+ super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, DiscreteLegend.defaultAttributes, attributes)), this.name = "discreteLegend", this._itemsContainer = null, this._itemHeightByUser = void 0, this._itemHeight = 0, this._itemMaxWidth = 0, this._contentMaxHeight = 0, this._onHover = e => {
70399
70631
  const target = e.target;
70400
70632
  if (target && target.name && target.name.startsWith(LEGEND_ELEMENT_NAME.item)) {
70401
70633
  const legendItem = target.delegate;
@@ -70443,7 +70675,7 @@
70443
70675
  };
70444
70676
  }
70445
70677
  render() {
70446
- this._stateDefinitionsCache = new WeakMap(), super.render(), this._lastActiveItem = null;
70678
+ super.render(), this._lastActiveItem = null;
70447
70679
  }
70448
70680
  setSelected(selectedData) {
70449
70681
  var _a;
@@ -70623,7 +70855,7 @@
70623
70855
  }), this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup)) : (itemGroup = graphicCreator.group(Object.assign({
70624
70856
  x: 0,
70625
70857
  y: 0
70626
- }, backgroundStyle.style)), this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup, backgroundStyle.state, backgroundStyle.reuseStateDefinitions)), itemGroup.id = `${null != id ? id : label}-${index}`, itemGroup.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);
70858
+ }, backgroundStyle.style)), this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup, backgroundStyle.state)), itemGroup.id = `${null != id ? id : label}-${index}`, itemGroup.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);
70627
70859
  const innerGroup = graphicCreator.group({
70628
70860
  x: 0,
70629
70861
  y: 0,
@@ -70646,7 +70878,7 @@
70646
70878
  Object.keys(shapeStyle.state || {}).forEach(key => {
70647
70879
  const color = shapeStyle.state[key].fill || shapeStyle.state[key].stroke;
70648
70880
  shape.fill && isNil$1(shapeStyle.state[key].fill) && color && (shapeStyle.state[key].fill = color), shape.stroke && isNil$1(shapeStyle.state[key].stroke) && color && (shapeStyle.state[key].stroke = color);
70649
- }), this._appendDataToShape(itemShape, LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state, !1), itemShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(itemShape);
70881
+ }), this._appendDataToShape(itemShape, LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state), itemShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(itemShape);
70650
70882
  }
70651
70883
  let focusSpace = 0;
70652
70884
  if (focus) {
@@ -70673,7 +70905,7 @@
70673
70905
  _originText: labelAttr.formatMethod ? label : void 0
70674
70906
  }),
70675
70907
  labelShape = createTextGraphicByType(labelAttributes);
70676
- this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state, labelStyle.reuseStateDefinitions), labelShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(labelShape);
70908
+ this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state), labelShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(labelShape);
70677
70909
  const labelSpace = get$1(labelAttr, "space", DEFAULT_LABEL_SPACE);
70678
70910
  if (isValid$1(value)) {
70679
70911
  const valueSpace = get$1(valueAttr, "space", focus ? DEFAULT_VALUE_SPACE : 0),
@@ -70689,7 +70921,7 @@
70689
70921
  _originText: valueAttr.formatMethod ? value : void 0
70690
70922
  }),
70691
70923
  valueShape = createTextGraphicByType(valueAttributes);
70692
- if (this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state, valueStyle.reuseStateDefinitions), valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), this._itemWidthByUser) {
70924
+ if (this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state), valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), this._itemWidthByUser) {
70693
70925
  const layoutWidth = this._itemWidthByUser - parsedPadding[1] - parsedPadding[3] - shapeSize - shapeSpace - labelSpace - focusSpace - valueSpace;
70694
70926
  this._autoEllipsis(autoEllipsisStrategy, layoutWidth, labelShape, valueShape), valueAttr.alignRight ? valueShape.setAttributes({
70695
70927
  textAlign: "right",
@@ -71119,17 +71351,8 @@
71119
71351
  item.hasState(LegendStateValue.selected) && selectedData.push(item.data);
71120
71352
  }), selectedData;
71121
71353
  }
71122
- _appendDataToShape(shape, name, data, delegateShape, states, reuseStateDefinitions = !0) {
71123
- if (shape.name = name, shape.data = data, shape.delegate = delegateShape, !reuseStateDefinitions) return void (shape.states = merge$1({}, DEFAULT_STATES, states));
71124
- const source = null != states ? states : DEFAULT_STATES,
71125
- cached = this._stateDefinitionsCache.get(source);
71126
- if (cached) return shape.states = cached.definitions, void shape.setStateDefinitionsWithCompiled(cached.definitions, cached.compiledDefinitions);
71127
- const definitions = states ? merge$1({}, DEFAULT_STATES, states) : DEFAULT_STATES,
71128
- entry = {
71129
- definitions: definitions,
71130
- compiledDefinitions: new StateDefinitionCompiler().compile(definitions)
71131
- };
71132
- this._stateDefinitionsCache.set(source, entry), shape.states = entry.definitions, shape.setStateDefinitionsWithCompiled(entry.definitions, entry.compiledDefinitions);
71354
+ _appendDataToShape(shape, name, data, delegateShape, states = {}) {
71355
+ shape.name = name, shape.data = data, shape.delegate = delegateShape, shape.states = merge$1({}, DEFAULT_STATES, states);
71133
71356
  }
71134
71357
  _dispatchLegendEvent(eventName, legendItem, event) {
71135
71358
  const currentSelectedItems = this._getSelectedLegends();
@@ -71146,17 +71369,12 @@
71146
71369
  }
71147
71370
  _handleStyle(config, item, isSelected, index, items) {
71148
71371
  const newConfig = {};
71149
- if (config.style && (isFunction$1(config.style) ? newConfig.style = config.style(item, isSelected, index, items) : newConfig.style = config.style), config.state) {
71150
- const stateKeys = Object.keys(config.state),
71151
- hasStateFunction = stateKeys.some(key => isFunction$1(config.state[key]));
71152
- newConfig.reuseStateDefinitions = !hasStateFunction, hasStateFunction ? (newConfig.state = {}, stateKeys.forEach(key => {
71153
- config.state[key] && (newConfig.state[key] = isFunction$1(config.state[key]) ? config.state[key](item, isSelected, index, items) : config.state[key]);
71154
- })) : newConfig.state = config.state;
71155
- }
71156
- return newConfig;
71372
+ return config.style && (isFunction$1(config.style) ? newConfig.style = config.style(item, isSelected, index, items) : newConfig.style = config.style), config.state && (newConfig.state = {}, Object.keys(config.state).forEach(key => {
71373
+ config.state[key] && (isFunction$1(config.state[key]) ? newConfig.state[key] = config.state[key](item, isSelected, index, items) : newConfig.state[key] = config.state[key]);
71374
+ })), newConfig;
71157
71375
  }
71158
71376
  release() {
71159
- this._stateDefinitionsCache = new WeakMap(), super.release(), this.removeAllEventListeners();
71377
+ super.release(), this.removeAllEventListeners();
71160
71378
  }
71161
71379
  };
71162
71380
  DiscreteLegend$1.defaultAttributes = {
@@ -96978,7 +97196,9 @@
96978
97196
  pager = cloneDeep(pager);
96979
97197
  background = cloneDeep(background);
96980
97198
  const attrs = restSpec;
96981
- if (isFunction$1(attrs.maxRow) || isFunction$1(attrs.maxCol)) {
97199
+ const pagerLayout = pager.layout;
97200
+ const pagerPosition = pager.position;
97201
+ if (isFunction$1(attrs.maxRow) || isFunction$1(attrs.maxCol) || isFunction$1(pagerLayout) || isFunction$1(pagerPosition)) {
96982
97202
  const resolvedOrient = isValidOrient(layoutOrient) ? layoutOrient : isValidOrient(orient) ? orient : 'left';
96983
97203
  if (isFunction$1(attrs.maxRow)) {
96984
97204
  attrs.maxRow = attrs.maxRow({ rect, orient: resolvedOrient, id });
@@ -96986,6 +97206,20 @@
96986
97206
  if (isFunction$1(attrs.maxCol)) {
96987
97207
  attrs.maxCol = attrs.maxCol({ rect, orient: resolvedOrient, id });
96988
97208
  }
97209
+ const isArrowPager = pager.type !== 'scrollbar';
97210
+ const pagerContext = {
97211
+ rect,
97212
+ orient: resolvedOrient,
97213
+ id,
97214
+ maxRow: attrs.maxRow,
97215
+ maxCol: attrs.maxCol
97216
+ };
97217
+ if (isArrowPager && isFunction$1(pagerLayout)) {
97218
+ pager.layout = pagerLayout(pagerContext);
97219
+ }
97220
+ if (isArrowPager && isFunction$1(pagerPosition)) {
97221
+ pager.position = pagerPosition(pagerContext);
97222
+ }
96989
97223
  }
96990
97224
  if (title.visible) {
96991
97225
  attrs.title = transformLegendTitleAttributes(title);
@@ -105672,6 +105906,50 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
105672
105906
  super(...arguments);
105673
105907
  this.specKey = 'markPoint';
105674
105908
  this.layoutZIndex = exports.LayoutZIndex.MarkPoint;
105909
+ this._handleDimensionHover = (params) => {
105910
+ var _a, _b;
105911
+ const targetSymbol = this._getTargetSymbolGraphic();
105912
+ if (!targetSymbol) {
105913
+ return;
105914
+ }
105915
+ switch (params.action) {
105916
+ case 'enter': {
105917
+ targetSymbol.removeState(exports.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER);
105918
+ targetSymbol.removeState(exports.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE);
105919
+ if (this._isDimensionHoverTarget(params)) {
105920
+ targetSymbol.addState(exports.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER, true);
105921
+ }
105922
+ else if ((_b = (_a = this._spec.targetSymbol) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.dimension_hover_reverse) {
105923
+ targetSymbol.addState(exports.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE, true);
105924
+ }
105925
+ break;
105926
+ }
105927
+ case 'leave':
105928
+ targetSymbol.removeState(exports.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER);
105929
+ targetSymbol.removeState(exports.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE);
105930
+ break;
105931
+ }
105932
+ };
105933
+ }
105934
+ initEvent() {
105935
+ var _a;
105936
+ super.initEvent();
105937
+ const targetSymbolState = (_a = this._spec.targetSymbol) === null || _a === void 0 ? void 0 : _a.state;
105938
+ if (this.coordinateType === 'cartesian' &&
105939
+ ((targetSymbolState === null || targetSymbolState === void 0 ? void 0 : targetSymbolState.dimension_hover) || (targetSymbolState === null || targetSymbolState === void 0 ? void 0 : targetSymbolState.dimension_hover_reverse))) {
105940
+ this.event.on(exports.DimensionEventEnum.dimensionHover, this._handleDimensionHover);
105941
+ }
105942
+ }
105943
+ _getTargetSymbolGraphic() {
105944
+ var _a;
105945
+ return (_a = this._markerComponent) === null || _a === void 0 ? void 0 : _a.find(node => node.name === 'mark-point-targetItem', true);
105946
+ }
105947
+ _isDimensionHoverTarget(params) {
105948
+ var _a, _b, _c, _d;
105949
+ const latestData = (_a = this._markerData) === null || _a === void 0 ? void 0 : _a.latestData;
105950
+ const markerData = (_c = (_b = latestData === null || latestData === void 0 ? void 0 : latestData[0]) === null || _b === void 0 ? void 0 : _b.latestData) !== null && _c !== void 0 ? _c : latestData;
105951
+ const markerXValues = array((_d = markerData === null || markerData === void 0 ? void 0 : markerData[0]) === null || _d === void 0 ? void 0 : _d.x).filter(isValid$1);
105952
+ return markerXValues.some(value => params.dimensionInfo.some(dimension => dimension.value === value));
105675
105953
  }
105676
105954
  static _getMarkerCoordinateType(markerSpec) {
105677
105955
  const { doPolarProcess, doGeoProcess } = getMarkPointProcessInfo(markerSpec);