@visactor/vchart-extension 2.1.5-alpha.0 → 2.1.5-alpha.2

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/build/index.js CHANGED
@@ -6451,18 +6451,21 @@
6451
6451
  }
6452
6452
  }
6453
6453
 
6454
- function getScaledStroke(context, width, dpr) {
6454
+ function getScaledStrokeWithMatrix(matrix, width, dpr) {
6455
6455
  let strokeWidth = width;
6456
6456
  const {
6457
6457
  a: a,
6458
6458
  b: b,
6459
6459
  c: c,
6460
6460
  d: d
6461
- } = context.currentMatrix,
6461
+ } = matrix,
6462
6462
  scaleX = Math.sign(a) * Math.sqrt(a * a + b * b),
6463
6463
  scaleY = Math.sign(d) * Math.sqrt(c * c + d * d);
6464
6464
  return scaleX + scaleY === 0 ? 0 : (strokeWidth = strokeWidth / Math.abs(scaleX + scaleY) * 2 * dpr, strokeWidth);
6465
6465
  }
6466
+ function getScaledStroke(context, width, dpr) {
6467
+ return getScaledStrokeWithMatrix(context.currentMatrix, width, dpr);
6468
+ }
6466
6469
  function createColor(context, c, params, offsetX = 0, offsetY = 0) {
6467
6470
  var _a, _b, _c, _d;
6468
6471
  if (!c || !0 === c) return "black";
@@ -7164,7 +7167,7 @@
7164
7167
  }
7165
7168
  class StateTransitionOrchestrator {
7166
7169
  analyzeTransition(targetAttrs, hasAnimation, options = {}) {
7167
- var _a, _b;
7170
+ var _a, _b, _c, _d;
7168
7171
  const plan = {
7169
7172
  targetAttrs: Object.assign({}, targetAttrs),
7170
7173
  animateAttrs: {},
@@ -7173,10 +7176,17 @@
7173
7176
  if (!hasAnimation) return plan;
7174
7177
  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)),
7175
7178
  isClear = !0 === options.isClear,
7176
- readDefaultAttribute = options.getDefaultAttribute,
7179
+ getDefaultAttribute = options.getDefaultAttribute,
7180
+ readDefaultAttribute = getDefaultAttribute,
7181
+ readStateTransitionDefaultAttribute = null !== (_c = options.getStateTransitionDefaultAttribute) && void 0 !== _c ? _c : getDefaultAttribute,
7177
7182
  shouldSkipDefaultAttribute = options.shouldSkipDefaultAttribute,
7178
- assignTransitionAttr = (key, value) => {
7179
- if (noWorkAnimateAttr[key]) plan.noAnimateAttrs[key] = value;else if (isClear && void 0 === value) {
7183
+ stateTransitionTargetAttrs = null !== (_d = options.stateTransitionTargetAttrs) && void 0 !== _d ? _d : targetAttrs,
7184
+ assignTransitionAttr = (key, value, isRemovedStateAttr = !1) => {
7185
+ if (noWorkAnimateAttr[key]) plan.noAnimateAttrs[key] = value;else if (isRemovedStateAttr && void 0 === value) {
7186
+ const defaultValue = null == readStateTransitionDefaultAttribute ? void 0 : readStateTransitionDefaultAttribute(key, stateTransitionTargetAttrs);
7187
+ if (void 0 === defaultValue && (null == shouldSkipDefaultAttribute ? void 0 : shouldSkipDefaultAttribute(key, stateTransitionTargetAttrs))) return;
7188
+ plan.animateAttrs[key] = defaultValue;
7189
+ } else if (isClear && void 0 === value) {
7180
7190
  if (null == shouldSkipDefaultAttribute ? void 0 : shouldSkipDefaultAttribute(key, targetAttrs)) return;
7181
7191
  plan.animateAttrs[key] = readDefaultAttribute(key);
7182
7192
  } else plan.animateAttrs[key] = value;
@@ -7188,7 +7198,7 @@
7188
7198
  const extraAnimateAttrs = options.extraAnimateAttrs;
7189
7199
  if (extraAnimateAttrs) for (const key in extraAnimateAttrs) {
7190
7200
  const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetAttrs, key);
7191
- !Object.prototype.hasOwnProperty.call(extraAnimateAttrs, key) || hasTargetAttr && void 0 !== targetAttrs[key] || assignTransitionAttr(key, extraAnimateAttrs[key]);
7201
+ !Object.prototype.hasOwnProperty.call(extraAnimateAttrs, key) || hasTargetAttr && void 0 !== targetAttrs[key] || assignTransitionAttr(key, extraAnimateAttrs[key], !0);
7192
7202
  }
7193
7203
  return plan;
7194
7204
  }
@@ -7220,9 +7230,11 @@
7220
7230
  noWorkAnimateAttr: graphic.getNoWorkAnimateAttr(),
7221
7231
  isClear: !0,
7222
7232
  getDefaultAttribute: graphic.getDefaultAttribute.bind(graphic),
7233
+ getStateTransitionDefaultAttribute: options.getStateTransitionDefaultAttribute,
7223
7234
  shouldSkipDefaultAttribute: null !== (_a = options.shouldSkipDefaultAttribute) && void 0 !== _a ? _a : graphic.shouldSkipStateTransitionDefaultAttribute.bind(graphic),
7224
7235
  animateConfig: options.animateConfig,
7225
- extraAnimateAttrs: options.extraAnimateAttrs
7236
+ extraAnimateAttrs: options.extraAnimateAttrs,
7237
+ stateTransitionTargetAttrs: options.stateTransitionTargetAttrs
7226
7238
  });
7227
7239
  return this.applyTransition(graphic, plan, hasAnimation, options);
7228
7240
  }
@@ -7510,21 +7522,20 @@
7510
7522
  }), snapshot) : snapshot;
7511
7523
  }
7512
7524
  buildRemovedStateAnimationAttrs(targetStateAttrs, previousResolvedStatePatch) {
7513
- const extraAttrs = {};
7514
- if (!previousResolvedStatePatch) return extraAttrs;
7525
+ if (!previousResolvedStatePatch) return;
7515
7526
  const snapshot = this.buildStaticAttributeSnapshot(),
7516
- staticTargetAttrs = snapshot;
7527
+ extraAttrs = {};
7517
7528
  return Object.keys(previousResolvedStatePatch).forEach(key => {
7518
7529
  const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetStateAttrs, key);
7519
7530
  if (hasTargetAttr && void 0 !== targetStateAttrs[key]) return;
7520
7531
  const assignFallbackAttr = value => {
7521
- void 0 === value && this.shouldSkipStateTransitionDefaultAttribute(key, staticTargetAttrs) || (extraAttrs[key] = void 0 === value ? value : cloneAttributeValue(value));
7532
+ extraAttrs[key] = void 0 === value ? value : cloneAttributeValue(value);
7522
7533
  };
7523
- if (hasTargetAttr) assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));else if (Object.prototype.hasOwnProperty.call(snapshot, key)) {
7524
- const snapshotValue = snapshot[key];
7525
- assignFallbackAttr(void 0 === snapshotValue ? this.getStateTransitionDefaultAttribute(key, staticTargetAttrs) : snapshotValue);
7526
- } else assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));
7527
- }), extraAttrs;
7534
+ hasTargetAttr ? assignFallbackAttr(targetStateAttrs[key]) : Object.prototype.hasOwnProperty.call(snapshot, key) ? assignFallbackAttr(snapshot[key]) : assignFallbackAttr(void 0);
7535
+ }), {
7536
+ extraAttrs: extraAttrs,
7537
+ stateTransitionTargetAttrs: snapshot
7538
+ };
7528
7539
  }
7529
7540
  syncObjectToSnapshot(target, snapshot, excludedKeys) {
7530
7541
  const delta = new Map();
@@ -8234,6 +8245,11 @@
8234
8245
  }
8235
8246
  return !0;
8236
8247
  }
8248
+ hasStatePatch(patch) {
8249
+ if (!patch) return !1;
8250
+ for (const key in patch) if (Object.prototype.hasOwnProperty.call(patch, key)) return !0;
8251
+ return !1;
8252
+ }
8237
8253
  commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = !1) {
8238
8254
  var _a;
8239
8255
  const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
@@ -8244,29 +8260,37 @@
8244
8260
  resolvedStateAttrs: resolvedStateAttrs
8245
8261
  } = this.resolveGraphicStateTransition(states, !0),
8246
8262
  patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
8247
- 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({
8263
+ 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) {
8264
+ this._syncFinalAttributeFromStaticTruth();
8265
+ const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
8266
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
8267
+ } else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
8248
8268
  type: AttributeUpdateType.STATE
8249
8269
  }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
8250
8270
  type: AttributeUpdateType.STATE
8251
- }), this.emitStateUpdateEvent())));
8271
+ }), this.emitStateUpdateEvent();
8252
8272
  }
8253
8273
  resolveStateAnimateConfig(animateConfig) {
8254
8274
  var _a, _b, _c;
8255
8275
  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;
8256
8276
  }
8257
- applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs) {
8277
+ applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs, stateTransitionTargetAttrs) {
8258
8278
  const resolvedAnimateConfig = hasAnimation ? this.resolveStateAnimateConfig(animateConfig) : void 0,
8259
8279
  transitionOptions = resolvedAnimateConfig ? {
8260
8280
  animateConfig: resolvedAnimateConfig,
8261
8281
  extraAnimateAttrs: extraAnimateAttrs,
8262
- shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
8282
+ getStateTransitionDefaultAttribute: this.getStateTransitionDefaultAttribute.bind(this),
8283
+ shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this),
8284
+ stateTransitionTargetAttrs: stateTransitionTargetAttrs
8263
8285
  } : void 0;
8264
8286
  if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, transitionOptions);
8265
8287
  const plan = this.getStateTransitionOrchestrator().analyzeTransition(attrs, hasAnimation, {
8266
8288
  noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
8267
8289
  animateConfig: resolvedAnimateConfig,
8268
8290
  extraAnimateAttrs: extraAnimateAttrs,
8269
- shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
8291
+ getStateTransitionDefaultAttribute: this.getStateTransitionDefaultAttribute.bind(this),
8292
+ shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this),
8293
+ stateTransitionTargetAttrs: stateTransitionTargetAttrs
8270
8294
  });
8271
8295
  this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
8272
8296
  }
@@ -8293,11 +8317,17 @@
8293
8317
  transition = this.resolveClearStatesTransition();
8294
8318
  if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
8295
8319
  const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
8296
- 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({
8297
- type: AttributeUpdateType.STATE
8298
- }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
8299
- type: AttributeUpdateType.STATE
8300
- }), this.emitStateUpdateEvent()));
8320
+ 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(), this.attributeMayContainTransientAttrs || this.hasStatePatch(previousResolvedStatePatch)) {
8321
+ if (hasAnimation) {
8322
+ this._syncFinalAttributeFromStaticTruth();
8323
+ const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
8324
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
8325
+ } else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
8326
+ type: AttributeUpdateType.STATE
8327
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
8328
+ type: AttributeUpdateType.STATE
8329
+ }), this.emitStateUpdateEvent();
8330
+ } else this.emitStateUpdateEvent();
8301
8331
  }
8302
8332
  removeState(stateName, hasAnimation) {
8303
8333
  const transition = this.resolveRemoveStateTransition(stateName);
@@ -8338,11 +8368,17 @@
8338
8368
  effectiveStates: effectiveStates,
8339
8369
  resolvedStateAttrs: resolvedStateAttrs
8340
8370
  } = this.resolveGraphicStateTransition(states);
8341
- !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({
8342
- type: AttributeUpdateType.STATE
8343
- }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
8344
- type: AttributeUpdateType.STATE
8345
- }), this.emitStateUpdateEvent()));
8371
+ 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(), this.attributeMayContainTransientAttrs || this.hasStatePatch(previousResolvedStatePatch) || this.hasStatePatch(resolvedStateAttrs)) {
8372
+ if (hasAnimation) {
8373
+ this._syncFinalAttributeFromStaticTruth();
8374
+ const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
8375
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
8376
+ } else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
8377
+ type: AttributeUpdateType.STATE
8378
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
8379
+ type: AttributeUpdateType.STATE
8380
+ }), this.emitStateUpdateEvent();
8381
+ } else this.emitStateUpdateEvent();
8346
8382
  }
8347
8383
  invalidateResolver() {
8348
8384
  var _a, _b;
@@ -10342,7 +10378,7 @@
10342
10378
  }
10343
10379
 
10344
10380
  var _a;
10345
- const factoryRegistryKey = Symbol.for("@visactor/vchart/factory-registry@2.1.4"),
10381
+ const factoryRegistryKey = Symbol.for("@visactor/vchart/factory-registry@2.1.5"),
10346
10382
  globalFactoryRegistry = globalThis;
10347
10383
  const factoryRegistry = null !== (_a = globalFactoryRegistry[factoryRegistryKey]) && void 0 !== _a ? _a : globalFactoryRegistry[factoryRegistryKey] = {
10348
10384
  charts: {},
@@ -10869,7 +10905,132 @@
10869
10905
  cap: 1
10870
10906
  }, NOWORK_ANIMATE_ATTR);
10871
10907
 
10872
- const POLYGON_UPDATE_TAG_KEY = ["points", "cornerRadius", ...GRAPHIC_UPDATE_TAG_KEY];
10908
+ function getPolygonWinding(points) {
10909
+ let signedArea = 0;
10910
+ for (let i = 0; i < points.length; i++) {
10911
+ const current = points[i],
10912
+ next = points[(i + 1) % points.length];
10913
+ signedArea += current.x * next.y - next.x * current.y;
10914
+ }
10915
+ return signedArea > 0 ? 1 : -1;
10916
+ }
10917
+ function offsetPolygonPoints(points, distance, closePath = !0) {
10918
+ var _a;
10919
+ const n = null !== (_a = null == points ? void 0 : points.length) && void 0 !== _a ? _a : 0;
10920
+ if (n < 2 || closePath && n < 3 || !distance) return points;
10921
+ const sign = getPolygonWinding(points),
10922
+ edgeCount = closePath ? n : n - 1,
10923
+ lines = [];
10924
+ for (let i = 0; i < edgeCount; i++) {
10925
+ const cur = points[i],
10926
+ next = points[(i + 1) % n],
10927
+ dx = next.x - cur.x,
10928
+ dy = next.y - cur.y,
10929
+ len = Math.sqrt(dx * dx + dy * dy);
10930
+ if (!len) {
10931
+ lines.push(null);
10932
+ continue;
10933
+ }
10934
+ const offsetX = sign * dy * distance / len,
10935
+ offsetY = -sign * dx * distance / len;
10936
+ lines.push({
10937
+ x: cur.x + offsetX,
10938
+ y: cur.y + offsetY,
10939
+ dx: dx,
10940
+ dy: dy,
10941
+ len: len,
10942
+ offsetX: offsetX,
10943
+ offsetY: offsetY
10944
+ });
10945
+ }
10946
+ const prevLines = new Array(n);
10947
+ let prevLine = null;
10948
+ if (closePath) for (let i = edgeCount - 1; i >= 0; i--) if (lines[i]) {
10949
+ prevLine = lines[i];
10950
+ break;
10951
+ }
10952
+ for (let i = 0; i < n; i++) prevLines[i] = prevLine, i < edgeCount && lines[i] && (prevLine = lines[i]);
10953
+ const nextLines = new Array(n);
10954
+ let nextLine = null;
10955
+ if (closePath) for (let count = 0; count < edgeCount; count++) {
10956
+ const line = lines[(n - 1 + count) % edgeCount];
10957
+ if (line) {
10958
+ nextLine = line;
10959
+ break;
10960
+ }
10961
+ }
10962
+ for (let i = n - 1; i >= 0; i--) i < edgeCount && lines[i] && (nextLine = lines[i]), nextLines[i] = nextLine;
10963
+ const offsetPointByLine = (point, line) => ({
10964
+ x: point.x + line.offsetX,
10965
+ y: point.y + line.offsetY
10966
+ }),
10967
+ result = [];
10968
+ for (let i = 0; i < n; i++) {
10969
+ const prev = prevLines[i],
10970
+ cur = nextLines[i],
10971
+ line = prev || cur;
10972
+ if (!line) {
10973
+ result.push(points[i]);
10974
+ continue;
10975
+ }
10976
+ if (!prev || !cur) {
10977
+ result.push(offsetPointByLine(points[i], line));
10978
+ continue;
10979
+ }
10980
+ const denominator = prev.dx * cur.dy - prev.dy * cur.dx;
10981
+ if (Math.abs(denominator) <= 1e-12 * prev.len * cur.len) {
10982
+ result.push(offsetPointByLine(points[i], cur));
10983
+ continue;
10984
+ }
10985
+ const t = ((cur.x - prev.x) * cur.dy - (cur.y - prev.y) * cur.dx) / denominator,
10986
+ point = {
10987
+ x: prev.x + prev.dx * t,
10988
+ y: prev.y + prev.dy * t
10989
+ };
10990
+ result.push(Number.isFinite(point.x) && Number.isFinite(point.y) ? point : offsetPointByLine(points[i], cur));
10991
+ }
10992
+ return result;
10993
+ }
10994
+
10995
+ const getBoundsScaleMatrix = polygon => {
10996
+ var _a;
10997
+ const globalMatrix = polygon.globalTransMatrix,
10998
+ viewBoxMatrix = null === (_a = polygon.stage) || void 0 === _a ? void 0 : _a.window.getViewBoxTransform();
10999
+ return viewBoxMatrix ? {
11000
+ a: viewBoxMatrix.a * globalMatrix.a + viewBoxMatrix.c * globalMatrix.b,
11001
+ b: viewBoxMatrix.b * globalMatrix.a + viewBoxMatrix.d * globalMatrix.b,
11002
+ c: viewBoxMatrix.a * globalMatrix.c + viewBoxMatrix.c * globalMatrix.d,
11003
+ d: viewBoxMatrix.b * globalMatrix.c + viewBoxMatrix.d * globalMatrix.d
11004
+ } : globalMatrix;
11005
+ };
11006
+ const getPolygonBoundsScale = polygon => getScaledStrokeWithMatrix(getBoundsScaleMatrix(polygon), 1, 1);
11007
+ const updateBoundsOfPolygonOuterBorder = (attribute, polygonTheme, aabbBounds, polygon) => {
11008
+ const {
11009
+ outerBorder: outerBorder,
11010
+ points = polygonTheme.points,
11011
+ closePath = polygonTheme.closePath,
11012
+ shadowBlur = polygonTheme.shadowBlur,
11013
+ keepStrokeScale = polygonTheme.keepStrokeScale
11014
+ } = attribute;
11015
+ if (outerBorder && !1 !== outerBorder.visible) {
11016
+ const defaultOuterBorder = polygonTheme.outerBorder,
11017
+ {
11018
+ distance = defaultOuterBorder.distance,
11019
+ lineWidth = defaultOuterBorder.lineWidth,
11020
+ lineJoin = defaultOuterBorder.lineJoin,
11021
+ strokeBoundsBuffer = defaultOuterBorder.strokeBoundsBuffer
11022
+ } = outerBorder,
11023
+ boundsScale = getPolygonBoundsScale(polygon);
11024
+ let scaledDistance = distance;
11025
+ keepStrokeScale || (scaledDistance *= boundsScale), offsetPolygonPoints(points, scaledDistance, closePath).forEach(point => {
11026
+ aabbBounds.add(point.x, point.y);
11027
+ });
11028
+ boundStroke(aabbBounds, (shadowBlur * boundsScale + lineWidth * (keepStrokeScale ? 1 : boundsScale)) / 2, "miter" === lineJoin, strokeBoundsBuffer);
11029
+ }
11030
+ return aabbBounds;
11031
+ };
11032
+
11033
+ const POLYGON_UPDATE_TAG_KEY = ["points", "cornerRadius", "outerBorder", "keepStrokeScale", ...GRAPHIC_UPDATE_TAG_KEY];
10873
11034
  class Polygon extends Graphic {
10874
11035
  constructor(params) {
10875
11036
  super(params), this.type = "polygon", this.numberType = POLYGON_NUMBER_TYPE;
@@ -10886,6 +11047,16 @@
10886
11047
  getGraphicTheme() {
10887
11048
  return getTheme(this).polygon;
10888
11049
  }
11050
+ tryUpdateAABBBounds() {
11051
+ const {
11052
+ outerBorder: outerBorder
11053
+ } = this.attribute;
11054
+ if (outerBorder && !1 !== outerBorder.visible) {
11055
+ const boundsScale = getPolygonBoundsScale(this);
11056
+ boundsScale !== this._outerBorderBoundsScale && (this._outerBorderBoundsScale = boundsScale, this.addUpdateBoundTag());
11057
+ } else this._outerBorderBoundsScale = void 0;
11058
+ return super.tryUpdateAABBBounds();
11059
+ }
10889
11060
  updateAABBBounds(attribute, polygonTheme, aabbBounds) {
10890
11061
  this.updatePathProxyAABBBounds(aabbBounds) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds), application.graphicService.updateTempAABBBounds(aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
10891
11062
  const {
@@ -10899,7 +11070,7 @@
10899
11070
  } = attribute;
10900
11071
  return points.forEach(p => {
10901
11072
  aabbBounds.add(p.x, p.y);
10902
- }), aabbBounds;
11073
+ }), updateBoundsOfPolygonOuterBorder(attribute, polygonTheme, aabbBounds, this), aabbBounds;
10903
11074
  }
10904
11075
  _interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes) {
10905
11076
  "points" === key && (nextAttributes.points = pointsInterpolation(lastStepVal, nextStepVal, ratio));
@@ -13144,7 +13315,8 @@
13144
13315
  const DrawContribution = Symbol.for("DrawContribution");
13145
13316
 
13146
13317
  const DrawItemInterceptor = Symbol.for("DrawItemInterceptor");
13147
- const tempDirtyBounds = new vutils.AABBBounds(),
13318
+ const INTERACTIVE_POST_MATRIX = "_interactivePostMatrix",
13319
+ tempDirtyBounds = new vutils.AABBBounds(),
13148
13320
  tempBackupDirtyBounds = new vutils.AABBBounds();
13149
13321
  class ShadowRootDrawItemInterceptorContribution {
13150
13322
  constructor() {
@@ -13208,12 +13380,23 @@
13208
13380
  beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
13209
13381
  return !this.processing && (graphic.baseGraphic ? this.beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) : this.beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params));
13210
13382
  }
13383
+ resolveInteractivePostMatrix(graphic, interactiveGraphic) {
13384
+ const parent = graphic.parent;
13385
+ if (!parent) return graphic.attribute.postMatrix;
13386
+ let matrix = interactiveGraphic[INTERACTIVE_POST_MATRIX];
13387
+ matrix || (matrix = new vutils.Matrix(), interactiveGraphic[INTERACTIVE_POST_MATRIX] = matrix);
13388
+ const ancestorMatrix = parent.globalTransMatrix;
13389
+ matrix.setValue(ancestorMatrix.a, ancestorMatrix.b, ancestorMatrix.c, ancestorMatrix.d, ancestorMatrix.e, ancestorMatrix.f);
13390
+ const ownPostMatrix = graphic.attribute.postMatrix;
13391
+ return ownPostMatrix && matrix.multiply(ownPostMatrix.a, ownPostMatrix.b, ownPostMatrix.c, ownPostMatrix.d, ownPostMatrix.e, ownPostMatrix.f), matrix;
13392
+ }
13211
13393
  beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params) {
13212
13394
  let interactiveGraphic = graphic.interactiveGraphic;
13213
13395
  if (graphic.attribute.globalZIndex) {
13214
13396
  interactiveGraphic || (interactiveGraphic = graphic.clone(), graphic.interactiveGraphic = interactiveGraphic, interactiveGraphic.baseGraphic = graphic), interactiveGraphic.setAttributes({
13215
13397
  globalZIndex: 0,
13216
- zIndex: graphic.attribute.globalZIndex
13398
+ zIndex: graphic.attribute.globalZIndex,
13399
+ postMatrix: this.resolveInteractivePostMatrix(graphic, interactiveGraphic)
13217
13400
  }, !1, {
13218
13401
  skipUpdateCallback: !0
13219
13402
  }), drawContext.stage.tryInitInteractiveLayer();
@@ -22808,7 +22991,7 @@
22808
22991
  release(forceReleaseVRenderComponents = !0) {
22809
22992
  forceReleaseVRenderComponents && [...this._components, ...this._regions, ...this._series].forEach(m => {
22810
22993
  m.beforeRelease();
22811
- }), super.release(), this.clear(), [...this._components, ...this._regions, ...this._series].forEach(m => {
22994
+ }), this._event.release(), super.release(), this.clear(), [...this._components, ...this._regions, ...this._series].forEach(m => {
22812
22995
  m.release();
22813
22996
  }), this._components = this._regions = this._series = [], this._spec = {}, this._dataSet = this._globalScale = this._layoutFunc = null, this._layoutTag = !1, this._idMap.clear();
22814
22997
  }