@visactor/vrender 1.1.6-alpha.0 → 1.1.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/dist/index.js CHANGED
@@ -2728,7 +2728,7 @@
2728
2728
  constructor() {
2729
2729
  super(), this._uid = Generator.GenAutoIncrementId(), this._firstChild = null, this._lastChild = null, this.parent = null, this._count = 1;
2730
2730
  }
2731
- onParentSharedStateTreeChanged(_stage, _layer, _inheritedSharedStateScope) {}
2731
+ onParentSharedStateTreeChanged(_stage, _layer) {}
2732
2732
  forEachChildren(cb, reverse = !1) {
2733
2733
  if (reverse) {
2734
2734
  let child = this._lastChild,
@@ -7112,18 +7112,21 @@
7112
7112
  }
7113
7113
  }
7114
7114
 
7115
- function getScaledStroke(context, width, dpr) {
7115
+ function getScaledStrokeWithMatrix(matrix, width, dpr) {
7116
7116
  let strokeWidth = width;
7117
7117
  const {
7118
7118
  a: a,
7119
7119
  b: b,
7120
7120
  c: c,
7121
7121
  d: d
7122
- } = context.currentMatrix,
7122
+ } = matrix,
7123
7123
  scaleX = Math.sign(a) * Math.sqrt(a * a + b * b),
7124
7124
  scaleY = Math.sign(d) * Math.sqrt(c * c + d * d);
7125
7125
  return scaleX + scaleY === 0 ? 0 : (strokeWidth = strokeWidth / Math.abs(scaleX + scaleY) * 2 * dpr, strokeWidth);
7126
7126
  }
7127
+ function getScaledStroke(context, width, dpr) {
7128
+ return getScaledStrokeWithMatrix(context.currentMatrix, width, dpr);
7129
+ }
7127
7130
  function createColor(context, c, params, offsetX = 0, offsetY = 0) {
7128
7131
  var _a, _b, _c, _d;
7129
7132
  if (!c || !0 === c) return "black";
@@ -8213,7 +8216,7 @@
8213
8216
  }
8214
8217
  class StateTransitionOrchestrator {
8215
8218
  analyzeTransition(targetAttrs, hasAnimation, options = {}) {
8216
- var _a, _b;
8219
+ var _a, _b, _c, _d;
8217
8220
  const plan = {
8218
8221
  targetAttrs: Object.assign({}, targetAttrs),
8219
8222
  animateAttrs: {},
@@ -8222,10 +8225,17 @@
8222
8225
  if (!hasAnimation) return plan;
8223
8226
  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)),
8224
8227
  isClear = !0 === options.isClear,
8225
- readDefaultAttribute = options.getDefaultAttribute,
8228
+ getDefaultAttribute = options.getDefaultAttribute,
8229
+ readDefaultAttribute = getDefaultAttribute,
8230
+ readStateTransitionDefaultAttribute = null !== (_c = options.getStateTransitionDefaultAttribute) && void 0 !== _c ? _c : getDefaultAttribute,
8226
8231
  shouldSkipDefaultAttribute = options.shouldSkipDefaultAttribute,
8227
- assignTransitionAttr = (key, value) => {
8228
- if (noWorkAnimateAttr[key]) plan.noAnimateAttrs[key] = value;else if (isClear && void 0 === value) {
8232
+ stateTransitionTargetAttrs = null !== (_d = options.stateTransitionTargetAttrs) && void 0 !== _d ? _d : targetAttrs,
8233
+ assignTransitionAttr = (key, value, isRemovedStateAttr = !1) => {
8234
+ if (noWorkAnimateAttr[key]) plan.noAnimateAttrs[key] = value;else if (isRemovedStateAttr && void 0 === value) {
8235
+ const defaultValue = null == readStateTransitionDefaultAttribute ? void 0 : readStateTransitionDefaultAttribute(key, stateTransitionTargetAttrs);
8236
+ if (void 0 === defaultValue && (null == shouldSkipDefaultAttribute ? void 0 : shouldSkipDefaultAttribute(key, stateTransitionTargetAttrs))) return;
8237
+ plan.animateAttrs[key] = defaultValue;
8238
+ } else if (isClear && void 0 === value) {
8229
8239
  if (null == shouldSkipDefaultAttribute ? void 0 : shouldSkipDefaultAttribute(key, targetAttrs)) return;
8230
8240
  plan.animateAttrs[key] = readDefaultAttribute(key);
8231
8241
  } else plan.animateAttrs[key] = value;
@@ -8237,7 +8247,7 @@
8237
8247
  const extraAnimateAttrs = options.extraAnimateAttrs;
8238
8248
  if (extraAnimateAttrs) for (const key in extraAnimateAttrs) {
8239
8249
  const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetAttrs, key);
8240
- !Object.prototype.hasOwnProperty.call(extraAnimateAttrs, key) || hasTargetAttr && void 0 !== targetAttrs[key] || assignTransitionAttr(key, extraAnimateAttrs[key]);
8250
+ !Object.prototype.hasOwnProperty.call(extraAnimateAttrs, key) || hasTargetAttr && void 0 !== targetAttrs[key] || assignTransitionAttr(key, extraAnimateAttrs[key], !0);
8241
8251
  }
8242
8252
  return plan;
8243
8253
  }
@@ -8269,9 +8279,11 @@
8269
8279
  noWorkAnimateAttr: graphic.getNoWorkAnimateAttr(),
8270
8280
  isClear: !0,
8271
8281
  getDefaultAttribute: graphic.getDefaultAttribute.bind(graphic),
8282
+ getStateTransitionDefaultAttribute: options.getStateTransitionDefaultAttribute,
8272
8283
  shouldSkipDefaultAttribute: null !== (_a = options.shouldSkipDefaultAttribute) && void 0 !== _a ? _a : graphic.shouldSkipStateTransitionDefaultAttribute.bind(graphic),
8273
8284
  animateConfig: options.animateConfig,
8274
- extraAnimateAttrs: options.extraAnimateAttrs
8285
+ extraAnimateAttrs: options.extraAnimateAttrs,
8286
+ stateTransitionTargetAttrs: options.stateTransitionTargetAttrs
8275
8287
  });
8276
8288
  return this.applyTransition(graphic, plan, hasAnimation, options);
8277
8289
  }
@@ -8487,17 +8499,14 @@
8487
8499
  }
8488
8500
  return null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope;
8489
8501
  }
8490
- syncSharedStateScopeBinding(nextScope, markDirty = !0) {
8502
+ syncSharedStateScopeBindingFromTree(markDirty = !0) {
8491
8503
  var _a;
8504
+ const nextScope = this.resolveBoundSharedStateScope();
8492
8505
  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);
8493
8506
  }
8494
- syncSharedStateScopeBindingFromTree(markDirty = !0, inheritedSharedStateScope) {
8495
- const nextScope = void 0 === inheritedSharedStateScope ? this.resolveBoundSharedStateScope() : null != inheritedSharedStateScope ? inheritedSharedStateScope : void 0;
8496
- return this.syncSharedStateScopeBinding(nextScope, markDirty);
8497
- }
8498
- syncSharedStateScopeBindingOnTreeChange(markDirty = !0, inheritedSharedStateScope) {
8507
+ syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
8499
8508
  var _a, _b;
8500
- 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);
8509
+ 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);
8501
8510
  }
8502
8511
  syncSharedStateActiveRegistrations() {
8503
8512
  var _a;
@@ -8505,7 +8514,6 @@
8505
8514
  if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
8506
8515
  scope.subtreeActiveDescendants.delete(this);
8507
8516
  }), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
8508
- if ((null == previousScopes ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) return;
8509
8517
  const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
8510
8518
  null == previousScopes || previousScopes.forEach(scope => {
8511
8519
  nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
@@ -8513,15 +8521,6 @@
8513
8521
  scope.subtreeActiveDescendants.add(this);
8514
8522
  }), this.registeredActiveScopes = nextScopes;
8515
8523
  }
8516
- isSharedStateScopeChainRegistered(previousScopes) {
8517
- let scope = this.boundSharedStateScope,
8518
- scopeCount = 0;
8519
- for (; scope;) {
8520
- if (!previousScopes.has(scope)) return !1;
8521
- scopeCount += 1, scope = scope.parentScope;
8522
- }
8523
- return scopeCount === previousScopes.size;
8524
- }
8525
8524
  clearSharedStateActiveRegistrations() {
8526
8525
  const previousScopes = this.registeredActiveScopes;
8527
8526
  previousScopes && (previousScopes.forEach(scope => {
@@ -8531,8 +8530,8 @@
8531
8530
  markSharedStateDirty() {
8532
8531
  this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
8533
8532
  }
8534
- onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
8535
- this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope) : this.setStage(stage, layer, inheritedSharedStateScope);
8533
+ onParentSharedStateTreeChanged(stage, layer) {
8534
+ this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
8536
8535
  }
8537
8536
  refreshSharedStateBeforeRender() {
8538
8537
  var _a;
@@ -8582,21 +8581,20 @@
8582
8581
  }), snapshot) : snapshot;
8583
8582
  }
8584
8583
  buildRemovedStateAnimationAttrs(targetStateAttrs, previousResolvedStatePatch) {
8585
- const extraAttrs = {};
8586
- if (!previousResolvedStatePatch) return extraAttrs;
8584
+ if (!previousResolvedStatePatch) return;
8587
8585
  const snapshot = this.buildStaticAttributeSnapshot(),
8588
- staticTargetAttrs = snapshot;
8586
+ extraAttrs = {};
8589
8587
  return Object.keys(previousResolvedStatePatch).forEach(key => {
8590
8588
  const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetStateAttrs, key);
8591
8589
  if (hasTargetAttr && void 0 !== targetStateAttrs[key]) return;
8592
8590
  const assignFallbackAttr = value => {
8593
- void 0 === value && this.shouldSkipStateTransitionDefaultAttribute(key, staticTargetAttrs) || (extraAttrs[key] = void 0 === value ? value : cloneAttributeValue(value));
8591
+ extraAttrs[key] = void 0 === value ? value : cloneAttributeValue(value);
8594
8592
  };
8595
- if (hasTargetAttr) assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));else if (Object.prototype.hasOwnProperty.call(snapshot, key)) {
8596
- const snapshotValue = snapshot[key];
8597
- assignFallbackAttr(void 0 === snapshotValue ? this.getStateTransitionDefaultAttribute(key, staticTargetAttrs) : snapshotValue);
8598
- } else assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));
8599
- }), extraAttrs;
8593
+ hasTargetAttr ? assignFallbackAttr(targetStateAttrs[key]) : Object.prototype.hasOwnProperty.call(snapshot, key) ? assignFallbackAttr(snapshot[key]) : assignFallbackAttr(void 0);
8594
+ }), {
8595
+ extraAttrs: extraAttrs,
8596
+ stateTransitionTargetAttrs: snapshot
8597
+ };
8600
8598
  }
8601
8599
  syncObjectToSnapshot(target, snapshot, excludedKeys) {
8602
8600
  const delta = new Map();
@@ -9183,10 +9181,6 @@
9183
9181
  var _a;
9184
9182
  return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
9185
9183
  }
9186
- setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
9187
- var _a;
9188
- 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}`;
9189
- }
9190
9184
  getStateResolveBaseAttrs() {
9191
9185
  var _a;
9192
9186
  return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
@@ -9316,29 +9310,37 @@
9316
9310
  resolvedStateAttrs: resolvedStateAttrs
9317
9311
  } = this.resolveGraphicStateTransition(states, !0),
9318
9312
  patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
9319
- 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({
9313
+ 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) {
9314
+ this._syncFinalAttributeFromStaticTruth();
9315
+ const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
9316
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
9317
+ } else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
9320
9318
  type: exports.AttributeUpdateType.STATE
9321
9319
  }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
9322
9320
  type: exports.AttributeUpdateType.STATE
9323
- }), this.emitStateUpdateEvent())));
9321
+ }), this.emitStateUpdateEvent();
9324
9322
  }
9325
9323
  resolveStateAnimateConfig(animateConfig) {
9326
9324
  var _a, _b, _c;
9327
9325
  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;
9328
9326
  }
9329
- applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs) {
9327
+ applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs, stateTransitionTargetAttrs) {
9330
9328
  const resolvedAnimateConfig = hasAnimation ? this.resolveStateAnimateConfig(animateConfig) : void 0,
9331
9329
  transitionOptions = resolvedAnimateConfig ? {
9332
9330
  animateConfig: resolvedAnimateConfig,
9333
9331
  extraAnimateAttrs: extraAnimateAttrs,
9334
- shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
9332
+ getStateTransitionDefaultAttribute: this.getStateTransitionDefaultAttribute.bind(this),
9333
+ shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this),
9334
+ stateTransitionTargetAttrs: stateTransitionTargetAttrs
9335
9335
  } : void 0;
9336
9336
  if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, transitionOptions);
9337
9337
  const plan = this.getStateTransitionOrchestrator().analyzeTransition(attrs, hasAnimation, {
9338
9338
  noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
9339
9339
  animateConfig: resolvedAnimateConfig,
9340
9340
  extraAnimateAttrs: extraAnimateAttrs,
9341
- shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
9341
+ getStateTransitionDefaultAttribute: this.getStateTransitionDefaultAttribute.bind(this),
9342
+ shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this),
9343
+ stateTransitionTargetAttrs: stateTransitionTargetAttrs
9342
9344
  });
9343
9345
  this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
9344
9346
  }
@@ -9365,11 +9367,15 @@
9365
9367
  transition = this.resolveClearStatesTransition();
9366
9368
  if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
9367
9369
  const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
9368
- 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({
9370
+ 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) {
9371
+ this._syncFinalAttributeFromStaticTruth();
9372
+ const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
9373
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
9374
+ } else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
9369
9375
  type: exports.AttributeUpdateType.STATE
9370
9376
  }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
9371
9377
  type: exports.AttributeUpdateType.STATE
9372
- }), this.emitStateUpdateEvent()));
9378
+ }), this.emitStateUpdateEvent();
9373
9379
  }
9374
9380
  removeState(stateName, hasAnimation) {
9375
9381
  const transition = this.resolveRemoveStateTransition(stateName);
@@ -9410,11 +9416,15 @@
9410
9416
  effectiveStates: effectiveStates,
9411
9417
  resolvedStateAttrs: resolvedStateAttrs
9412
9418
  } = this.resolveGraphicStateTransition(states);
9413
- !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({
9419
+ 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) {
9420
+ this._syncFinalAttributeFromStaticTruth();
9421
+ const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
9422
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
9423
+ } else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
9414
9424
  type: exports.AttributeUpdateType.STATE
9415
9425
  }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
9416
9426
  type: exports.AttributeUpdateType.STATE
9417
- }), this.emitStateUpdateEvent()));
9427
+ }), this.emitStateUpdateEvent();
9418
9428
  }
9419
9429
  invalidateResolver() {
9420
9430
  var _a, _b;
@@ -9534,12 +9544,12 @@
9534
9544
  this._globalTransMatrix.translate(scrollX, scrollY);
9535
9545
  }
9536
9546
  }
9537
- setStage(stage, layer, inheritedSharedStateScope) {
9547
+ setStage(stage, layer) {
9538
9548
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
9539
9549
  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,
9540
9550
  previousStage = this.stage;
9541
9551
  if (this.stage !== stage || this.layer !== layer) {
9542
- 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()) {
9552
+ 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()) {
9543
9553
  const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
9544
9554
  nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
9545
9555
  detachedStageAnimates = [];
@@ -9556,7 +9566,7 @@
9556
9566
  }
9557
9567
  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));
9558
9568
  }
9559
- ((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);
9569
+ ((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);
9560
9570
  }
9561
9571
  detachStageForRelease() {
9562
9572
  var _a, _b, _c;
@@ -10106,8 +10116,15 @@
10106
10116
  const b = this.AABBBounds;
10107
10117
  return this._OBBBounds.setValue(b.x1, b.y1, b.x2, b.y2), this._OBBBounds;
10108
10118
  }
10109
- this.obbText || (this.obbText = new Text({})), this.obbText.setAttributes(Object.assign(Object.assign({}, attribute), {
10110
- angle: 0
10119
+ this.obbText || (this.obbText = new Text({}));
10120
+ const {
10121
+ dx = 0,
10122
+ dy = 0
10123
+ } = attribute;
10124
+ this.obbText.setAttributes(Object.assign(Object.assign({}, attribute), {
10125
+ angle: 0,
10126
+ dx: 0,
10127
+ dy: 0
10111
10128
  }));
10112
10129
  const bounds1 = this.obbText.AABBBounds,
10113
10130
  {
@@ -10122,7 +10139,7 @@
10122
10139
  x: x,
10123
10140
  y: y
10124
10141
  });
10125
- return this._OBBBounds.copy(bounds1), this._OBBBounds.translate(center.x - boundsCenter.x, center.y - boundsCenter.y), this._OBBBounds.angle = angle, this._OBBBounds;
10142
+ return this._OBBBounds.copy(bounds1), this._OBBBounds.translate(center.x - boundsCenter.x + dx, center.y - boundsCenter.y + dy), this._OBBBounds.angle = angle, this._OBBBounds;
10126
10143
  }
10127
10144
  updateAABBBounds(attribute, textTheme, aabbBounds) {
10128
10145
  const {
@@ -12130,8 +12147,8 @@
12130
12147
  clone() {
12131
12148
  return new RichText(Object.assign({}, this.attribute));
12132
12149
  }
12133
- setStage(stage, layer, inheritedSharedStateScope) {
12134
- super.setStage(stage, layer, inheritedSharedStateScope);
12150
+ setStage(stage, layer) {
12151
+ super.setStage(stage, layer);
12135
12152
  this.getFrameCache().icons.forEach(icon => {
12136
12153
  icon.setStage(stage, layer);
12137
12154
  });
@@ -12835,13 +12852,13 @@
12835
12852
  child.setStage(null, null);
12836
12853
  }), this.addUpdateBoundTag();
12837
12854
  }
12838
- setStage(stage, layer, inheritedSharedStateScope) {
12855
+ setStage(stage, layer) {
12839
12856
  var _a, _b, _c, _d, _e, _f;
12840
12857
  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,
12841
12858
  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;
12842
- 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);
12859
+ 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();
12843
12860
  const layerChanged = this.layer !== layer;
12844
- layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0, inheritedSharedStateScope), this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope)) : layerChanged && this.notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope);
12861
+ layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.notifyChildrenSharedStateTreeChanged();
12845
12862
  }
12846
12863
  addUpdatePositionTag() {
12847
12864
  super.addUpdatePositionTag(), this.forEachChildren(g => {
@@ -12900,26 +12917,17 @@
12900
12917
  hasSharedStateDefinitions() {
12901
12918
  return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
12902
12919
  }
12903
- resolveChildSharedStateScope(inheritedSharedStateScope) {
12904
- var _a;
12905
- return this.sharedStateScope ? this.sharedStateScope : void 0 !== inheritedSharedStateScope ? inheritedSharedStateScope : null !== (_a = this.resolveBoundSharedStateScope()) && void 0 !== _a ? _a : null;
12906
- }
12907
- notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope) {
12908
- const childSharedStateScope = this.resolveChildSharedStateScope(inheritedSharedStateScope);
12920
+ notifyChildrenSharedStateTreeChanged() {
12909
12921
  this.forEachChildren(item => {
12910
- this.setStageToChild(item, childSharedStateScope);
12922
+ this.syncChildSharedStateTreeBinding(item);
12911
12923
  });
12912
12924
  }
12913
- setStageToChild(child, inheritedSharedStateScope) {
12914
- const graphic = child;
12915
- "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);
12916
- }
12917
- syncChildSharedStateTreeBinding(child, inheritedSharedStateScope) {
12918
- void 0 === inheritedSharedStateScope && (inheritedSharedStateScope = this.resolveChildSharedStateScope()), this.setStageToChild(child, inheritedSharedStateScope);
12925
+ syncChildSharedStateTreeBinding(child) {
12926
+ child.onParentSharedStateTreeChanged(this.stage, this.layer);
12919
12927
  }
12920
- onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
12928
+ onParentSharedStateTreeChanged(stage, layer) {
12921
12929
  var _a;
12922
- 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);
12930
+ 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);
12923
12931
  }
12924
12932
  }
12925
12933
  Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
@@ -12927,7 +12935,204 @@
12927
12935
  return new Group(attributes);
12928
12936
  }
12929
12937
 
12930
- const POLYGON_UPDATE_TAG_KEY = ["points", "cornerRadius", ...GRAPHIC_UPDATE_TAG_KEY];
12938
+ function drawPolygon(path, points, x, y) {
12939
+ if (points && points.length) {
12940
+ path.moveTo(points[0].x + x, points[0].y + y);
12941
+ for (let i = 1; i < points.length; i++) path.lineTo(points[i].x + x, points[i].y + y);
12942
+ }
12943
+ }
12944
+ function drawRoundedPolygon(path, points, x, y, cornerRadius, closePath = !0) {
12945
+ var _a;
12946
+ const normalized = normalizePolygonPoints(points, cornerRadius, closePath);
12947
+ if (normalized) return void drawRoundedPolygon(path, normalized.points, x, y, normalized.cornerRadius, closePath);
12948
+ if (points.length < 3) return void drawPolygon(path, points, x, y);
12949
+ let startI = 0,
12950
+ endI = points.length - 1;
12951
+ closePath || (startI += 1, endI -= 1, path.moveTo(points[0].x + x, points[0].y + y));
12952
+ for (let i = startI; i <= endI; i++) {
12953
+ const p1 = points[0 === i ? endI : (i - 1) % points.length],
12954
+ angularPoint = points[i % points.length],
12955
+ p2 = points[(i + 1) % points.length],
12956
+ dx1 = angularPoint.x - p1.x,
12957
+ dy1 = angularPoint.y - p1.y,
12958
+ dx2 = angularPoint.x - p2.x,
12959
+ dy2 = angularPoint.y - p2.y,
12960
+ angle = (Math.atan2(dy1, dx1) - Math.atan2(dy2, dx2)) / 2,
12961
+ tan = Math.abs(Math.tan(angle));
12962
+ let radius = Array.isArray(cornerRadius) ? null !== (_a = cornerRadius[i % points.length]) && void 0 !== _a ? _a : 0 : cornerRadius,
12963
+ segment = radius / tan;
12964
+ const length1 = getLength(dx1, dy1),
12965
+ length2 = getLength(dx2, dy2),
12966
+ length = Math.min(length1, length2);
12967
+ segment > length && (segment = length, radius = length * tan);
12968
+ const p1Cross = getProportionPoint(angularPoint, segment, length1, dx1, dy1),
12969
+ p2Cross = getProportionPoint(angularPoint, segment, length2, dx2, dy2),
12970
+ dx = 2 * angularPoint.x - p1Cross.x - p2Cross.x,
12971
+ dy = 2 * angularPoint.y - p1Cross.y - p2Cross.y,
12972
+ L = getLength(dx, dy),
12973
+ circlePoint = getProportionPoint(angularPoint, getLength(segment, radius), L, dx, dy);
12974
+ let startAngle = Math.atan2(p1Cross.y - circlePoint.y, p1Cross.x - circlePoint.x);
12975
+ const endAngle = Math.atan2(p2Cross.y - circlePoint.y, p2Cross.x - circlePoint.x);
12976
+ let sweepAngle = endAngle - startAngle;
12977
+ 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);
12978
+ }
12979
+ closePath || path.lineTo(points[endI + 1].x + x, points[endI + 1].y + y);
12980
+ }
12981
+ function getLength(dx, dy) {
12982
+ return Math.sqrt(dx * dx + dy * dy);
12983
+ }
12984
+ function getProportionPoint(point, segment, length, dx, dy) {
12985
+ const factor = segment / length;
12986
+ return {
12987
+ x: point.x - dx * factor,
12988
+ y: point.y - dy * factor
12989
+ };
12990
+ }
12991
+ function normalizePolygonPoints(points, cornerRadius, closePath = !0) {
12992
+ var _a;
12993
+ let hasDuplicate = !1;
12994
+ for (let i = 1; i < points.length; i++) if (isSamePoint(points[i - 1], points[i])) {
12995
+ hasDuplicate = !0;
12996
+ break;
12997
+ }
12998
+ if (!hasDuplicate && closePath && points.length > 1 && isSamePoint(points[0], points[points.length - 1]) && (hasDuplicate = !0), !hasDuplicate) return null;
12999
+ const normalizedPoints = [],
13000
+ normalizedCornerRadius = Array.isArray(cornerRadius) ? [] : null;
13001
+ 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));
13002
+ return closePath && normalizedPoints.length > 1 && isSamePoint(normalizedPoints[0], normalizedPoints[normalizedPoints.length - 1]) && (normalizedPoints.pop(), null == normalizedCornerRadius || normalizedCornerRadius.pop()), {
13003
+ points: normalizedPoints,
13004
+ cornerRadius: null != normalizedCornerRadius ? normalizedCornerRadius : cornerRadius
13005
+ };
13006
+ }
13007
+ function isSamePoint(a, b) {
13008
+ return a.x === b.x && a.y === b.y;
13009
+ }
13010
+ function getPolygonWinding(points) {
13011
+ let signedArea = 0;
13012
+ for (let i = 0; i < points.length; i++) {
13013
+ const current = points[i],
13014
+ next = points[(i + 1) % points.length];
13015
+ signedArea += current.x * next.y - next.x * current.y;
13016
+ }
13017
+ return signedArea > 0 ? 1 : -1;
13018
+ }
13019
+ function offsetPolygonPoints(points, distance, closePath = !0) {
13020
+ var _a;
13021
+ const n = null !== (_a = null == points ? void 0 : points.length) && void 0 !== _a ? _a : 0;
13022
+ if (n < 2 || closePath && n < 3 || !distance) return points;
13023
+ const sign = getPolygonWinding(points),
13024
+ edgeCount = closePath ? n : n - 1,
13025
+ lines = [];
13026
+ for (let i = 0; i < edgeCount; i++) {
13027
+ const cur = points[i],
13028
+ next = points[(i + 1) % n],
13029
+ dx = next.x - cur.x,
13030
+ dy = next.y - cur.y,
13031
+ len = Math.sqrt(dx * dx + dy * dy);
13032
+ if (!len) {
13033
+ lines.push(null);
13034
+ continue;
13035
+ }
13036
+ const offsetX = sign * dy * distance / len,
13037
+ offsetY = -sign * dx * distance / len;
13038
+ lines.push({
13039
+ x: cur.x + offsetX,
13040
+ y: cur.y + offsetY,
13041
+ dx: dx,
13042
+ dy: dy,
13043
+ len: len,
13044
+ offsetX: offsetX,
13045
+ offsetY: offsetY
13046
+ });
13047
+ }
13048
+ const prevLines = new Array(n);
13049
+ let prevLine = null;
13050
+ if (closePath) for (let i = edgeCount - 1; i >= 0; i--) if (lines[i]) {
13051
+ prevLine = lines[i];
13052
+ break;
13053
+ }
13054
+ for (let i = 0; i < n; i++) prevLines[i] = prevLine, i < edgeCount && lines[i] && (prevLine = lines[i]);
13055
+ const nextLines = new Array(n);
13056
+ let nextLine = null;
13057
+ if (closePath) for (let count = 0; count < edgeCount; count++) {
13058
+ const line = lines[(n - 1 + count) % edgeCount];
13059
+ if (line) {
13060
+ nextLine = line;
13061
+ break;
13062
+ }
13063
+ }
13064
+ for (let i = n - 1; i >= 0; i--) i < edgeCount && lines[i] && (nextLine = lines[i]), nextLines[i] = nextLine;
13065
+ const offsetPointByLine = (point, line) => ({
13066
+ x: point.x + line.offsetX,
13067
+ y: point.y + line.offsetY
13068
+ }),
13069
+ result = [];
13070
+ for (let i = 0; i < n; i++) {
13071
+ const prev = prevLines[i],
13072
+ cur = nextLines[i],
13073
+ line = prev || cur;
13074
+ if (!line) {
13075
+ result.push(points[i]);
13076
+ continue;
13077
+ }
13078
+ if (!prev || !cur) {
13079
+ result.push(offsetPointByLine(points[i], line));
13080
+ continue;
13081
+ }
13082
+ const denominator = prev.dx * cur.dy - prev.dy * cur.dx;
13083
+ if (Math.abs(denominator) <= 1e-12 * prev.len * cur.len) {
13084
+ result.push(offsetPointByLine(points[i], cur));
13085
+ continue;
13086
+ }
13087
+ const t = ((cur.x - prev.x) * cur.dy - (cur.y - prev.y) * cur.dx) / denominator,
13088
+ point = {
13089
+ x: prev.x + prev.dx * t,
13090
+ y: prev.y + prev.dy * t
13091
+ };
13092
+ result.push(Number.isFinite(point.x) && Number.isFinite(point.y) ? point : offsetPointByLine(points[i], cur));
13093
+ }
13094
+ return result;
13095
+ }
13096
+
13097
+ const getBoundsScaleMatrix = polygon => {
13098
+ var _a;
13099
+ const globalMatrix = polygon.globalTransMatrix,
13100
+ viewBoxMatrix = null === (_a = polygon.stage) || void 0 === _a ? void 0 : _a.window.getViewBoxTransform();
13101
+ return viewBoxMatrix ? {
13102
+ a: viewBoxMatrix.a * globalMatrix.a + viewBoxMatrix.c * globalMatrix.b,
13103
+ b: viewBoxMatrix.b * globalMatrix.a + viewBoxMatrix.d * globalMatrix.b,
13104
+ c: viewBoxMatrix.a * globalMatrix.c + viewBoxMatrix.c * globalMatrix.d,
13105
+ d: viewBoxMatrix.b * globalMatrix.c + viewBoxMatrix.d * globalMatrix.d
13106
+ } : globalMatrix;
13107
+ };
13108
+ const getPolygonBoundsScale = polygon => getScaledStrokeWithMatrix(getBoundsScaleMatrix(polygon), 1, 1);
13109
+ const updateBoundsOfPolygonOuterBorder = (attribute, polygonTheme, aabbBounds, polygon) => {
13110
+ const {
13111
+ outerBorder: outerBorder,
13112
+ points = polygonTheme.points,
13113
+ closePath = polygonTheme.closePath,
13114
+ shadowBlur = polygonTheme.shadowBlur,
13115
+ keepStrokeScale = polygonTheme.keepStrokeScale
13116
+ } = attribute;
13117
+ if (outerBorder && !1 !== outerBorder.visible) {
13118
+ const defaultOuterBorder = polygonTheme.outerBorder,
13119
+ {
13120
+ distance = defaultOuterBorder.distance,
13121
+ lineWidth = defaultOuterBorder.lineWidth,
13122
+ lineJoin = defaultOuterBorder.lineJoin,
13123
+ strokeBoundsBuffer = defaultOuterBorder.strokeBoundsBuffer
13124
+ } = outerBorder,
13125
+ boundsScale = getPolygonBoundsScale(polygon);
13126
+ let scaledDistance = distance;
13127
+ keepStrokeScale || (scaledDistance *= boundsScale), offsetPolygonPoints(points, scaledDistance, closePath).forEach(point => {
13128
+ aabbBounds.add(point.x, point.y);
13129
+ });
13130
+ boundStroke(aabbBounds, (shadowBlur * boundsScale + lineWidth * (keepStrokeScale ? 1 : boundsScale)) / 2, "miter" === lineJoin, strokeBoundsBuffer);
13131
+ }
13132
+ return aabbBounds;
13133
+ };
13134
+
13135
+ const POLYGON_UPDATE_TAG_KEY = ["points", "cornerRadius", "outerBorder", "keepStrokeScale", ...GRAPHIC_UPDATE_TAG_KEY];
12931
13136
  class Polygon extends Graphic {
12932
13137
  constructor(params) {
12933
13138
  super(params), this.type = "polygon", this.numberType = POLYGON_NUMBER_TYPE;
@@ -12944,6 +13149,16 @@
12944
13149
  getGraphicTheme() {
12945
13150
  return getTheme(this).polygon;
12946
13151
  }
13152
+ tryUpdateAABBBounds() {
13153
+ const {
13154
+ outerBorder: outerBorder
13155
+ } = this.attribute;
13156
+ if (outerBorder && !1 !== outerBorder.visible) {
13157
+ const boundsScale = getPolygonBoundsScale(this);
13158
+ boundsScale !== this._outerBorderBoundsScale && (this._outerBorderBoundsScale = boundsScale, this.addUpdateBoundTag());
13159
+ } else this._outerBorderBoundsScale = void 0;
13160
+ return super.tryUpdateAABBBounds();
13161
+ }
12947
13162
  updateAABBBounds(attribute, polygonTheme, aabbBounds) {
12948
13163
  this.updatePathProxyAABBBounds(aabbBounds) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds), application.graphicService.updateTempAABBBounds(aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
12949
13164
  const {
@@ -12957,7 +13172,7 @@
12957
13172
  } = attribute;
12958
13173
  return points.forEach(p => {
12959
13174
  aabbBounds.add(p.x, p.y);
12960
- }), aabbBounds;
13175
+ }), updateBoundsOfPolygonOuterBorder(attribute, polygonTheme, aabbBounds, this), aabbBounds;
12961
13176
  }
12962
13177
  _interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes) {
12963
13178
  "points" === key && (nextAttributes.points = pointsInterpolation(lastStepVal, nextStepVal, ratio));
@@ -16939,22 +17154,26 @@
16939
17154
  width: width,
16940
17155
  height: height
16941
17156
  } = rect.attribute;
16942
- width = (null != width ? width : x1 - x) || 0, height = (null != height ? height : y1 - y) || 0;
16943
- const renderBorder = (borderStyle, key) => {
16944
- const doStroke = !(!borderStyle || !borderStyle.stroke),
16945
- sign = "outerBorder" === key ? -1 : 1,
16946
- {
16947
- distance = rectAttribute[key].distance
16948
- } = borderStyle,
16949
- d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
16950
- nextX = x + sign * d,
16951
- nextY = y + sign * d,
16952
- dw = 2 * d;
16953
- 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) {
16954
- const lastOpacity = rectAttribute[key].opacity;
16955
- rectAttribute[key].opacity = opacity, context.setStrokeStyle(rect, borderStyle, (originX - x) / scaleX, (originY - y) / scaleY, rectAttribute[key]), rectAttribute[key].opacity = lastOpacity, context.stroke();
16956
- }
16957
- };
17157
+ width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
17158
+ const borderX = width < 0 ? x + width : x,
17159
+ borderY = height < 0 ? y + height : y,
17160
+ borderWidth = width < 0 ? -width : width,
17161
+ borderHeight = height < 0 ? -height : height,
17162
+ renderBorder = (borderStyle, key) => {
17163
+ const doStroke = !(!borderStyle || !borderStyle.stroke),
17164
+ sign = "outerBorder" === key ? -1 : 1,
17165
+ {
17166
+ distance = rectAttribute[key].distance
17167
+ } = borderStyle,
17168
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
17169
+ nextX = borderX + sign * d,
17170
+ nextY = borderY + sign * d,
17171
+ dw = 2 * d;
17172
+ 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) {
17173
+ const lastOpacity = rectAttribute[key].opacity;
17174
+ rectAttribute[key].opacity = opacity, context.setStrokeStyle(rect, borderStyle, (originX - x) / scaleX, (originY - y) / scaleY, rectAttribute[key]), rectAttribute[key].opacity = lastOpacity, context.stroke();
17175
+ }
17176
+ };
16958
17177
  doOuterBorder && renderBorder(outerBorder, "outerBorder"), doInnerBorder && renderBorder(innerBorder, "innerBorder");
16959
17178
  }
16960
17179
  }
@@ -19236,64 +19455,69 @@
19236
19455
 
19237
19456
  class AbstractGraphicRender {}
19238
19457
 
19239
- function drawPolygon(path, points, x, y) {
19240
- if (points && points.length) {
19241
- path.moveTo(points[0].x + x, points[0].y + y);
19242
- for (let i = 1; i < points.length; i++) path.lineTo(points[i].x + x, points[i].y + y);
19458
+ const defaultPolygonTextureRenderContribution = defaultBaseTextureRenderContribution;
19459
+ const defaultPolygonBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
19460
+ class DefaultPolygonRenderContribution {
19461
+ constructor() {
19462
+ this.time = exports.BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
19243
19463
  }
19244
- }
19245
- function drawRoundedPolygon(path, points, x, y, cornerRadius, closePath = !0) {
19246
- var _a;
19247
- if (points.length < 3) return void drawPolygon(path, points, x, y);
19248
- let startI = 0,
19249
- endI = points.length - 1;
19250
- closePath || (startI += 1, endI -= 1, path.moveTo(points[0].x + x, points[0].y + y));
19251
- for (let i = startI; i <= endI; i++) {
19252
- const p1 = points[0 === i ? endI : (i - 1) % points.length],
19253
- angularPoint = points[i % points.length],
19254
- p2 = points[(i + 1) % points.length],
19255
- dx1 = angularPoint.x - p1.x,
19256
- dy1 = angularPoint.y - p1.y,
19257
- dx2 = angularPoint.x - p2.x,
19258
- dy2 = angularPoint.y - p2.y,
19259
- angle = (Math.atan2(dy1, dx1) - Math.atan2(dy2, dx2)) / 2,
19260
- tan = Math.abs(Math.tan(angle));
19261
- let radius = Array.isArray(cornerRadius) ? null !== (_a = cornerRadius[i % points.length]) && void 0 !== _a ? _a : 0 : cornerRadius,
19262
- segment = radius / tan;
19263
- const length1 = getLength(dx1, dy1),
19264
- length2 = getLength(dx2, dy2),
19265
- length = Math.min(length1, length2);
19266
- segment > length && (segment = length, radius = length * tan);
19267
- const p1Cross = getProportionPoint(angularPoint, segment, length1, dx1, dy1),
19268
- p2Cross = getProportionPoint(angularPoint, segment, length2, dx2, dy2),
19269
- dx = 2 * angularPoint.x - p1Cross.x - p2Cross.x,
19270
- dy = 2 * angularPoint.y - p1Cross.y - p2Cross.y,
19271
- L = getLength(dx, dy),
19272
- circlePoint = getProportionPoint(angularPoint, getLength(segment, radius), L, dx, dy);
19273
- let startAngle = Math.atan2(p1Cross.y - circlePoint.y, p1Cross.x - circlePoint.x);
19274
- const endAngle = Math.atan2(p2Cross.y - circlePoint.y, p2Cross.x - circlePoint.x);
19275
- let sweepAngle = endAngle - startAngle;
19276
- 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);
19464
+ drawShape(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb) {
19465
+ const {
19466
+ outerBorder: outerBorder,
19467
+ innerBorder: innerBorder
19468
+ } = polygon.attribute,
19469
+ doOuterBorder = outerBorder && !1 !== outerBorder.visible,
19470
+ doInnerBorder = innerBorder && !1 !== innerBorder.visible;
19471
+ if (!doOuterBorder && !doInnerBorder) return;
19472
+ const {
19473
+ points = polygonAttribute.points,
19474
+ cornerRadius = polygonAttribute.cornerRadius,
19475
+ opacity = polygonAttribute.opacity,
19476
+ x: originX = polygonAttribute.x,
19477
+ y: originY = polygonAttribute.y,
19478
+ scaleX = polygonAttribute.scaleX,
19479
+ scaleY = polygonAttribute.scaleY,
19480
+ keepStrokeScale = polygonAttribute.keepStrokeScale,
19481
+ closePath = polygonAttribute.closePath
19482
+ } = polygon.attribute,
19483
+ renderBorder = (borderStyle, key) => {
19484
+ var _a, _b;
19485
+ const doBorderStroke = !!borderStyle.stroke,
19486
+ distanceDirection = "outerBorder" === key ? 1 : -1,
19487
+ {
19488
+ distance = polygonAttribute[key].distance
19489
+ } = borderStyle,
19490
+ borderDistance = distanceDirection * (keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr)),
19491
+ normalized = normalizePolygonPoints(points, cornerRadius, closePath),
19492
+ normalizedPoints = null !== (_a = null == normalized ? void 0 : normalized.points) && void 0 !== _a ? _a : points,
19493
+ normalizedCornerRadius = null !== (_b = null == normalized ? void 0 : normalized.cornerRadius) && void 0 !== _b ? _b : cornerRadius,
19494
+ borderPoints = offsetPolygonPoints(normalizedPoints, borderDistance, closePath),
19495
+ winding = getPolygonWinding(normalizedPoints),
19496
+ borderCornerRadius = normalizedPoints.map((point, i) => {
19497
+ var _a;
19498
+ const radius = isArray$1(normalizedCornerRadius) ? null !== (_a = normalizedCornerRadius[i]) && void 0 !== _a ? _a : 0 : normalizedCornerRadius || 0;
19499
+ if (!closePath && (0 === i || i === normalizedPoints.length - 1) || normalizedPoints.length < 3) return radius;
19500
+ const prev = normalizedPoints[(i - 1 + normalizedPoints.length) % normalizedPoints.length],
19501
+ next = normalizedPoints[(i + 1) % normalizedPoints.length],
19502
+ cornerDirection = ((point.x - prev.x) * (next.y - point.y) - (point.y - prev.y) * (next.x - point.x)) * winding < 0 ? -1 : 1;
19503
+ return Math.max(0, radius + borderDistance * cornerDirection);
19504
+ }),
19505
+ noCorner = 0 === borderCornerRadius.length || borderCornerRadius.every(r => 0 === r);
19506
+ 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) {
19507
+ const lastOpacity = polygonAttribute[key].opacity,
19508
+ borderStyleWithStrokeScale = borderStyle,
19509
+ lastKeepStrokeScale = borderStyleWithStrokeScale.keepStrokeScale;
19510
+ 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();
19511
+ }
19512
+ };
19513
+ doOuterBorder && renderBorder(outerBorder, "outerBorder"), doInnerBorder && renderBorder(innerBorder, "innerBorder");
19277
19514
  }
19278
- closePath || path.lineTo(points[endI + 1].x + x, points[endI + 1].y + y);
19279
- }
19280
- function getLength(dx, dy) {
19281
- return Math.sqrt(dx * dx + dy * dy);
19282
- }
19283
- function getProportionPoint(point, segment, length, dx, dy) {
19284
- const factor = segment / length;
19285
- return {
19286
- x: point.x - dx * factor,
19287
- y: point.y - dy * factor
19288
- };
19289
19515
  }
19290
-
19291
- const defaultPolygonTextureRenderContribution = defaultBaseTextureRenderContribution;
19292
- const defaultPolygonBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
19516
+ const defaultPolygonRenderContribution = new DefaultPolygonRenderContribution();
19293
19517
 
19294
19518
  class DefaultCanvasPolygonRender extends BaseRender {
19295
19519
  constructor(graphicRenderContributions) {
19296
- super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(graphicRenderContributions);
19520
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonRenderContribution, defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(graphicRenderContributions);
19297
19521
  }
19298
19522
  drawShape(polygon, context, x, y, drawContext, params, fillCb, strokeCb) {
19299
19523
  const polygonAttribute = getTheme(polygon, null == params ? void 0 : params.theme).polygon,
@@ -23334,6 +23558,7 @@
23334
23558
  getRuntimeInstallerGlobal: getRuntimeInstallerGlobal,
23335
23559
  getRuntimeInstallerState: getRuntimeInstallerState,
23336
23560
  getScaledStroke: getScaledStroke,
23561
+ getScaledStrokeWithMatrix: getScaledStrokeWithMatrix,
23337
23562
  getTextBounds: getTextBounds,
23338
23563
  getTheme: getTheme,
23339
23564
  getThemeFromGroup: getThemeFromGroup,
@@ -28843,6 +29068,8 @@
28843
29068
  var _a, _b;
28844
29069
  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();
28845
29070
  }
29071
+ const requestAnimationFrameBasedSTO = callback => rafBasedSto.call(callback),
29072
+ cancelAnimationFrameBasedSTO = handle => rafBasedSto.clear(handle);
28846
29073
  function getLynxPixelRatio(params, runtime) {
28847
29074
  var _a, _b, _c, _d, _e;
28848
29075
  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;
@@ -28914,7 +29141,7 @@
28914
29141
  }
28915
29142
  class LynxEnvContribution extends BaseEnvContribution {
28916
29143
  constructor() {
28917
- super(), this.type = "lynx", this.supportEvent = !0, this.canvasMap = new Map(), this.freeCanvasList = [], this.canvasIdx = 0, this.supportsTouchEvents = !0;
29144
+ 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;
28918
29145
  try {
28919
29146
  this.supportsPointerEvents = !!globalThis.PointerEvent, this.supportsMouseEvents = !!globalThis.MouseEvent;
28920
29147
  } catch (err) {
@@ -28923,7 +29150,8 @@
28923
29150
  this.applyStyles = !0;
28924
29151
  }
28925
29152
  configure(service, params = {}) {
28926
- service.env === this.type && (service.setActiveEnvContribution(this), this.lynxEnvParams = params, this.lynxRuntime = getLynxRuntime(params));
29153
+ var _a, _b;
29154
+ 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));
28927
29155
  }
28928
29156
  getDynamicCanvasCount() {
28929
29157
  return this.freeCanvasList.length;
@@ -28975,14 +29203,10 @@
28975
29203
  return getLynxPixelRatio(void 0, this.lynxRuntime);
28976
29204
  }
28977
29205
  getRequestAnimationFrame() {
28978
- return function (callback) {
28979
- return rafBasedSto.call(callback);
28980
- };
29206
+ return this.requestAnimationFrame;
28981
29207
  }
28982
29208
  getCancelAnimationFrame() {
28983
- return h => {
28984
- rafBasedSto.clear(h);
28985
- };
29209
+ return this.cancelAnimationFrame;
28986
29210
  }
28987
29211
  mapToCanvasPoint(event) {
28988
29212
  var _a;
@@ -49971,7 +50195,7 @@
49971
50195
  loadDiscreteLegendComponent();
49972
50196
  class DiscreteLegend extends LegendBase {
49973
50197
  constructor(attributes, options) {
49974
- super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, 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 => {
50198
+ super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, 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 => {
49975
50199
  const target = e.target;
49976
50200
  if (target && target.name && target.name.startsWith(exports.LEGEND_ELEMENT_NAME.item)) {
49977
50201
  const legendItem = target.delegate;
@@ -50019,7 +50243,7 @@
50019
50243
  };
50020
50244
  }
50021
50245
  render() {
50022
- this._stateDefinitionsCache = new WeakMap(), super.render(), this._lastActiveItem = null;
50246
+ super.render(), this._lastActiveItem = null;
50023
50247
  }
50024
50248
  setSelected(selectedData) {
50025
50249
  var _a;
@@ -50199,7 +50423,7 @@
50199
50423
  }), this._appendDataToShape(itemGroup, exports.LEGEND_ELEMENT_NAME.item, item, itemGroup)) : (itemGroup = graphicCreator.group(Object.assign({
50200
50424
  x: 0,
50201
50425
  y: 0
50202
- }, backgroundStyle.style)), this._appendDataToShape(itemGroup, exports.LEGEND_ELEMENT_NAME.item, item, itemGroup, backgroundStyle.state, backgroundStyle.reuseStateDefinitions)), itemGroup.id = `${null != id ? id : label}-${index}`, itemGroup.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected);
50426
+ }, backgroundStyle.style)), this._appendDataToShape(itemGroup, exports.LEGEND_ELEMENT_NAME.item, item, itemGroup, backgroundStyle.state)), itemGroup.id = `${null != id ? id : label}-${index}`, itemGroup.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected);
50203
50427
  const innerGroup = graphicCreator.group({
50204
50428
  x: 0,
50205
50429
  y: 0,
@@ -50222,7 +50446,7 @@
50222
50446
  Object.keys(shapeStyle.state || {}).forEach(key => {
50223
50447
  const color = shapeStyle.state[key].fill || shapeStyle.state[key].stroke;
50224
50448
  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);
50225
- }), this._appendDataToShape(itemShape, exports.LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state, !1), itemShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), innerGroup.add(itemShape);
50449
+ }), this._appendDataToShape(itemShape, exports.LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state), itemShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), innerGroup.add(itemShape);
50226
50450
  }
50227
50451
  let focusSpace = 0;
50228
50452
  if (focus) {
@@ -50249,7 +50473,7 @@
50249
50473
  _originText: labelAttr.formatMethod ? label : void 0
50250
50474
  }),
50251
50475
  labelShape = createTextGraphicByType(labelAttributes);
50252
- this._appendDataToShape(labelShape, exports.LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state, labelStyle.reuseStateDefinitions), labelShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), innerGroup.add(labelShape);
50476
+ this._appendDataToShape(labelShape, exports.LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state), labelShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), innerGroup.add(labelShape);
50253
50477
  const labelSpace = get$1(labelAttr, "space", DEFAULT_LABEL_SPACE);
50254
50478
  if (isValid$1(value)) {
50255
50479
  const valueSpace = get$1(valueAttr, "space", focus ? DEFAULT_VALUE_SPACE : 0),
@@ -50265,7 +50489,7 @@
50265
50489
  _originText: valueAttr.formatMethod ? value : void 0
50266
50490
  }),
50267
50491
  valueShape = createTextGraphicByType(valueAttributes);
50268
- if (this._appendDataToShape(valueShape, exports.LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state, valueStyle.reuseStateDefinitions), valueShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), this._itemWidthByUser) {
50492
+ if (this._appendDataToShape(valueShape, exports.LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state), valueShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected), this._itemWidthByUser) {
50269
50493
  const layoutWidth = this._itemWidthByUser - parsedPadding[1] - parsedPadding[3] - shapeSize - shapeSpace - labelSpace - focusSpace - valueSpace;
50270
50494
  this._autoEllipsis(autoEllipsisStrategy, layoutWidth, labelShape, valueShape), valueAttr.alignRight ? valueShape.setAttributes({
50271
50495
  textAlign: "right",
@@ -50695,17 +50919,8 @@
50695
50919
  item.hasState(exports.LegendStateValue.selected) && selectedData.push(item.data);
50696
50920
  }), selectedData;
50697
50921
  }
50698
- _appendDataToShape(shape, name, data, delegateShape, states, reuseStateDefinitions = !0) {
50699
- if (shape.name = name, shape.data = data, shape.delegate = delegateShape, !reuseStateDefinitions) return void (shape.states = merge({}, DEFAULT_STATES, states));
50700
- const source = null != states ? states : DEFAULT_STATES,
50701
- cached = this._stateDefinitionsCache.get(source);
50702
- if (cached) return shape.states = cached.definitions, void shape.setStateDefinitionsWithCompiled(cached.definitions, cached.compiledDefinitions);
50703
- const definitions = states ? merge({}, DEFAULT_STATES, states) : DEFAULT_STATES,
50704
- entry = {
50705
- definitions: definitions,
50706
- compiledDefinitions: new StateDefinitionCompiler().compile(definitions)
50707
- };
50708
- this._stateDefinitionsCache.set(source, entry), shape.states = entry.definitions, shape.setStateDefinitionsWithCompiled(entry.definitions, entry.compiledDefinitions);
50922
+ _appendDataToShape(shape, name, data, delegateShape, states = {}) {
50923
+ shape.name = name, shape.data = data, shape.delegate = delegateShape, shape.states = merge({}, DEFAULT_STATES, states);
50709
50924
  }
50710
50925
  _dispatchLegendEvent(eventName, legendItem, event) {
50711
50926
  const currentSelectedItems = this._getSelectedLegends();
@@ -50722,17 +50937,12 @@
50722
50937
  }
50723
50938
  _handleStyle(config, item, isSelected, index, items) {
50724
50939
  const newConfig = {};
50725
- if (config.style && (isFunction$1(config.style) ? newConfig.style = config.style(item, isSelected, index, items) : newConfig.style = config.style), config.state) {
50726
- const stateKeys = Object.keys(config.state),
50727
- hasStateFunction = stateKeys.some(key => isFunction$1(config.state[key]));
50728
- newConfig.reuseStateDefinitions = !hasStateFunction, hasStateFunction ? (newConfig.state = {}, stateKeys.forEach(key => {
50729
- config.state[key] && (newConfig.state[key] = isFunction$1(config.state[key]) ? config.state[key](item, isSelected, index, items) : config.state[key]);
50730
- })) : newConfig.state = config.state;
50731
- }
50732
- return newConfig;
50940
+ 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 => {
50941
+ config.state[key] && (isFunction$1(config.state[key]) ? newConfig.state[key] = config.state[key](item, isSelected, index, items) : newConfig.state[key] = config.state[key]);
50942
+ })), newConfig;
50733
50943
  }
50734
50944
  release() {
50735
- this._stateDefinitionsCache = new WeakMap(), super.release(), this.removeAllEventListeners();
50945
+ super.release(), this.removeAllEventListeners();
50736
50946
  }
50737
50947
  }
50738
50948
  DiscreteLegend.defaultAttributes = {
@@ -55614,7 +55824,7 @@
55614
55824
  return resolveLegacyApp().createStage(params);
55615
55825
  }
55616
55826
 
55617
- const version = "1.1.6-alpha.0";
55827
+ const version = "1.1.6";
55618
55828
 
55619
55829
  exports.AComponentAnimate = AComponentAnimate;
55620
55830
  exports.ACustomAnimate = ACustomAnimate;
@@ -56354,6 +56564,7 @@
56354
56564
  exports.getRuntimeInstallerGlobal = getRuntimeInstallerGlobal;
56355
56565
  exports.getRuntimeInstallerState = getRuntimeInstallerState;
56356
56566
  exports.getScaledStroke = getScaledStroke;
56567
+ exports.getScaledStrokeWithMatrix = getScaledStrokeWithMatrix;
56357
56568
  exports.getSharedVRenderApp = getSharedVRenderApp;
56358
56569
  exports.getSizeHandlerPath = getSizeHandlerPath;
56359
56570
  exports.getTextAlignAttrOfVerticalDir = getTextAlignAttrOfVerticalDir;