@visactor/vchart 2.1.5 → 2.1.6-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -13375,18 +13375,21 @@
13375
13375
  }
13376
13376
  }
13377
13377
 
13378
- function getScaledStroke(context, width, dpr) {
13378
+ function getScaledStrokeWithMatrix(matrix, width, dpr) {
13379
13379
  let strokeWidth = width;
13380
13380
  const {
13381
13381
  a: a,
13382
13382
  b: b,
13383
13383
  c: c,
13384
13384
  d: d
13385
- } = context.currentMatrix,
13385
+ } = matrix,
13386
13386
  scaleX = Math.sign(a) * Math.sqrt(a * a + b * b),
13387
13387
  scaleY = Math.sign(d) * Math.sqrt(c * c + d * d);
13388
13388
  return scaleX + scaleY === 0 ? 0 : (strokeWidth = strokeWidth / Math.abs(scaleX + scaleY) * 2 * dpr, strokeWidth);
13389
13389
  }
13390
+ function getScaledStroke(context, width, dpr) {
13391
+ return getScaledStrokeWithMatrix(context.currentMatrix, width, dpr);
13392
+ }
13390
13393
  function createColor(context, c, params, offsetX = 0, offsetY = 0) {
13391
13394
  var _a, _b, _c, _d;
13392
13395
  if (!c || !0 === c) return "black";
@@ -14446,7 +14449,7 @@
14446
14449
  }
14447
14450
  class StateTransitionOrchestrator {
14448
14451
  analyzeTransition(targetAttrs, hasAnimation, options = {}) {
14449
- var _a, _b;
14452
+ var _a, _b, _c, _d;
14450
14453
  const plan = {
14451
14454
  targetAttrs: Object.assign({}, targetAttrs),
14452
14455
  animateAttrs: {},
@@ -14455,10 +14458,17 @@
14455
14458
  if (!hasAnimation) return plan;
14456
14459
  const noWorkAnimateAttr = Object.assign(Object.assign({}, null !== (_a = options.noWorkAnimateAttr) && void 0 !== _a ? _a : {}), normalizeNoAnimateAttrConfig(null === (_b = options.animateConfig) || void 0 === _b ? void 0 : _b.noAnimateAttrs)),
14457
14460
  isClear = !0 === options.isClear,
14458
- readDefaultAttribute = options.getDefaultAttribute,
14461
+ getDefaultAttribute = options.getDefaultAttribute,
14462
+ readDefaultAttribute = getDefaultAttribute,
14463
+ readStateTransitionDefaultAttribute = null !== (_c = options.getStateTransitionDefaultAttribute) && void 0 !== _c ? _c : getDefaultAttribute,
14459
14464
  shouldSkipDefaultAttribute = options.shouldSkipDefaultAttribute,
14460
- assignTransitionAttr = (key, value) => {
14461
- if (noWorkAnimateAttr[key]) plan.noAnimateAttrs[key] = value;else if (isClear && void 0 === value) {
14465
+ stateTransitionTargetAttrs = null !== (_d = options.stateTransitionTargetAttrs) && void 0 !== _d ? _d : targetAttrs,
14466
+ assignTransitionAttr = (key, value, isRemovedStateAttr = !1) => {
14467
+ if (noWorkAnimateAttr[key]) plan.noAnimateAttrs[key] = value;else if (isRemovedStateAttr && void 0 === value) {
14468
+ const defaultValue = null == readStateTransitionDefaultAttribute ? void 0 : readStateTransitionDefaultAttribute(key, stateTransitionTargetAttrs);
14469
+ if (void 0 === defaultValue && (null == shouldSkipDefaultAttribute ? void 0 : shouldSkipDefaultAttribute(key, stateTransitionTargetAttrs))) return;
14470
+ plan.animateAttrs[key] = defaultValue;
14471
+ } else if (isClear && void 0 === value) {
14462
14472
  if (null == shouldSkipDefaultAttribute ? void 0 : shouldSkipDefaultAttribute(key, targetAttrs)) return;
14463
14473
  plan.animateAttrs[key] = readDefaultAttribute(key);
14464
14474
  } else plan.animateAttrs[key] = value;
@@ -14470,7 +14480,7 @@
14470
14480
  const extraAnimateAttrs = options.extraAnimateAttrs;
14471
14481
  if (extraAnimateAttrs) for (const key in extraAnimateAttrs) {
14472
14482
  const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetAttrs, key);
14473
- !Object.prototype.hasOwnProperty.call(extraAnimateAttrs, key) || hasTargetAttr && void 0 !== targetAttrs[key] || assignTransitionAttr(key, extraAnimateAttrs[key]);
14483
+ !Object.prototype.hasOwnProperty.call(extraAnimateAttrs, key) || hasTargetAttr && void 0 !== targetAttrs[key] || assignTransitionAttr(key, extraAnimateAttrs[key], !0);
14474
14484
  }
14475
14485
  return plan;
14476
14486
  }
@@ -14502,9 +14512,11 @@
14502
14512
  noWorkAnimateAttr: graphic.getNoWorkAnimateAttr(),
14503
14513
  isClear: !0,
14504
14514
  getDefaultAttribute: graphic.getDefaultAttribute.bind(graphic),
14515
+ getStateTransitionDefaultAttribute: options.getStateTransitionDefaultAttribute,
14505
14516
  shouldSkipDefaultAttribute: null !== (_a = options.shouldSkipDefaultAttribute) && void 0 !== _a ? _a : graphic.shouldSkipStateTransitionDefaultAttribute.bind(graphic),
14506
14517
  animateConfig: options.animateConfig,
14507
- extraAnimateAttrs: options.extraAnimateAttrs
14518
+ extraAnimateAttrs: options.extraAnimateAttrs,
14519
+ stateTransitionTargetAttrs: options.stateTransitionTargetAttrs
14508
14520
  });
14509
14521
  return this.applyTransition(graphic, plan, hasAnimation, options);
14510
14522
  }
@@ -14801,21 +14813,20 @@
14801
14813
  }), snapshot) : snapshot;
14802
14814
  }
14803
14815
  buildRemovedStateAnimationAttrs(targetStateAttrs, previousResolvedStatePatch) {
14804
- const extraAttrs = {};
14805
- if (!previousResolvedStatePatch) return extraAttrs;
14816
+ if (!previousResolvedStatePatch) return;
14806
14817
  const snapshot = this.buildStaticAttributeSnapshot(),
14807
- staticTargetAttrs = snapshot;
14818
+ extraAttrs = {};
14808
14819
  return Object.keys(previousResolvedStatePatch).forEach(key => {
14809
14820
  const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetStateAttrs, key);
14810
14821
  if (hasTargetAttr && void 0 !== targetStateAttrs[key]) return;
14811
14822
  const assignFallbackAttr = value => {
14812
- void 0 === value && this.shouldSkipStateTransitionDefaultAttribute(key, staticTargetAttrs) || (extraAttrs[key] = void 0 === value ? value : cloneAttributeValue(value));
14823
+ extraAttrs[key] = void 0 === value ? value : cloneAttributeValue(value);
14813
14824
  };
14814
- if (hasTargetAttr) assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));else if (Object.prototype.hasOwnProperty.call(snapshot, key)) {
14815
- const snapshotValue = snapshot[key];
14816
- assignFallbackAttr(void 0 === snapshotValue ? this.getStateTransitionDefaultAttribute(key, staticTargetAttrs) : snapshotValue);
14817
- } else assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));
14818
- }), extraAttrs;
14825
+ hasTargetAttr ? assignFallbackAttr(targetStateAttrs[key]) : Object.prototype.hasOwnProperty.call(snapshot, key) ? assignFallbackAttr(snapshot[key]) : assignFallbackAttr(void 0);
14826
+ }), {
14827
+ extraAttrs: extraAttrs,
14828
+ stateTransitionTargetAttrs: snapshot
14829
+ };
14819
14830
  }
14820
14831
  syncObjectToSnapshot(target, snapshot, excludedKeys) {
14821
14832
  const delta = new Map();
@@ -15531,29 +15542,37 @@
15531
15542
  resolvedStateAttrs: resolvedStateAttrs
15532
15543
  } = this.resolveGraphicStateTransition(states, !0),
15533
15544
  patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
15534
- patchChanged && !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1) || (this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), patchChanged && (hasAnimation && animateSameStatePatchChange ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
15545
+ if ((!patchChanged || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) && (this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), patchChanged)) if (hasAnimation && animateSameStatePatchChange) {
15546
+ this._syncFinalAttributeFromStaticTruth();
15547
+ const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
15548
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
15549
+ } else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
15535
15550
  type: AttributeUpdateType.STATE
15536
15551
  }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
15537
15552
  type: AttributeUpdateType.STATE
15538
- }), this.emitStateUpdateEvent())));
15553
+ }), this.emitStateUpdateEvent();
15539
15554
  }
15540
15555
  resolveStateAnimateConfig(animateConfig) {
15541
15556
  var _a, _b, _c;
15542
15557
  return null !== (_c = null !== (_a = null != animateConfig ? animateConfig : this.stateAnimateConfig) && void 0 !== _a ? _a : null === (_b = this.context) || void 0 === _b ? void 0 : _b.stateAnimateConfig) && void 0 !== _c ? _c : DefaultStateAnimateConfig;
15543
15558
  }
15544
- applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs) {
15559
+ applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs, stateTransitionTargetAttrs) {
15545
15560
  const resolvedAnimateConfig = hasAnimation ? this.resolveStateAnimateConfig(animateConfig) : void 0,
15546
15561
  transitionOptions = resolvedAnimateConfig ? {
15547
15562
  animateConfig: resolvedAnimateConfig,
15548
15563
  extraAnimateAttrs: extraAnimateAttrs,
15549
- shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
15564
+ getStateTransitionDefaultAttribute: this.getStateTransitionDefaultAttribute.bind(this),
15565
+ shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this),
15566
+ stateTransitionTargetAttrs: stateTransitionTargetAttrs
15550
15567
  } : void 0;
15551
15568
  if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, transitionOptions);
15552
15569
  const plan = this.getStateTransitionOrchestrator().analyzeTransition(attrs, hasAnimation, {
15553
15570
  noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
15554
15571
  animateConfig: resolvedAnimateConfig,
15555
15572
  extraAnimateAttrs: extraAnimateAttrs,
15556
- shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
15573
+ getStateTransitionDefaultAttribute: this.getStateTransitionDefaultAttribute.bind(this),
15574
+ shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this),
15575
+ stateTransitionTargetAttrs: stateTransitionTargetAttrs
15557
15576
  });
15558
15577
  this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
15559
15578
  }
@@ -15580,11 +15599,15 @@
15580
15599
  transition = this.resolveClearStatesTransition();
15581
15600
  if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
15582
15601
  const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
15583
- transition.changed && !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0) || (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
15602
+ if (!transition.changed || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0)) if (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(), hasAnimation) {
15603
+ this._syncFinalAttributeFromStaticTruth();
15604
+ const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
15605
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
15606
+ } else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
15584
15607
  type: AttributeUpdateType.STATE
15585
15608
  }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
15586
15609
  type: AttributeUpdateType.STATE
15587
- }), this.emitStateUpdateEvent()));
15610
+ }), this.emitStateUpdateEvent();
15588
15611
  }
15589
15612
  removeState(stateName, hasAnimation) {
15590
15613
  const transition = this.resolveRemoveStateTransition(stateName);
@@ -15625,11 +15648,15 @@
15625
15648
  effectiveStates: effectiveStates,
15626
15649
  resolvedStateAttrs: resolvedStateAttrs
15627
15650
  } = this.resolveGraphicStateTransition(states);
15628
- !transition.changed && this.sameStateNames(previousStates, transition.states) || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1) && (this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
15651
+ if ((transition.changed || !this.sameStateNames(previousStates, transition.states)) && this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) if (this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), hasAnimation) {
15652
+ this._syncFinalAttributeFromStaticTruth();
15653
+ const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
15654
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
15655
+ } else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
15629
15656
  type: AttributeUpdateType.STATE
15630
15657
  }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
15631
15658
  type: AttributeUpdateType.STATE
15632
- }), this.emitStateUpdateEvent()));
15659
+ }), this.emitStateUpdateEvent();
15633
15660
  }
15634
15661
  invalidateResolver() {
15635
15662
  var _a, _b;
@@ -17070,7 +17097,204 @@
17070
17097
  return new Path(attributes);
17071
17098
  }
17072
17099
 
17073
- const POLYGON_UPDATE_TAG_KEY = ["points", "cornerRadius", ...GRAPHIC_UPDATE_TAG_KEY];
17100
+ function drawPolygon(path, points, x, y) {
17101
+ if (points && points.length) {
17102
+ path.moveTo(points[0].x + x, points[0].y + y);
17103
+ for (let i = 1; i < points.length; i++) path.lineTo(points[i].x + x, points[i].y + y);
17104
+ }
17105
+ }
17106
+ function drawRoundedPolygon(path, points, x, y, cornerRadius, closePath = !0) {
17107
+ var _a;
17108
+ const normalized = normalizePolygonPoints(points, cornerRadius, closePath);
17109
+ if (normalized) return void drawRoundedPolygon(path, normalized.points, x, y, normalized.cornerRadius, closePath);
17110
+ if (points.length < 3) return void drawPolygon(path, points, x, y);
17111
+ let startI = 0,
17112
+ endI = points.length - 1;
17113
+ closePath || (startI += 1, endI -= 1, path.moveTo(points[0].x + x, points[0].y + y));
17114
+ for (let i = startI; i <= endI; i++) {
17115
+ const p1 = points[0 === i ? endI : (i - 1) % points.length],
17116
+ angularPoint = points[i % points.length],
17117
+ p2 = points[(i + 1) % points.length],
17118
+ dx1 = angularPoint.x - p1.x,
17119
+ dy1 = angularPoint.y - p1.y,
17120
+ dx2 = angularPoint.x - p2.x,
17121
+ dy2 = angularPoint.y - p2.y,
17122
+ angle = (Math.atan2(dy1, dx1) - Math.atan2(dy2, dx2)) / 2,
17123
+ tan = Math.abs(Math.tan(angle));
17124
+ let radius = Array.isArray(cornerRadius) ? null !== (_a = cornerRadius[i % points.length]) && void 0 !== _a ? _a : 0 : cornerRadius,
17125
+ segment = radius / tan;
17126
+ const length1 = getLength(dx1, dy1),
17127
+ length2 = getLength(dx2, dy2),
17128
+ length = Math.min(length1, length2);
17129
+ segment > length && (segment = length, radius = length * tan);
17130
+ const p1Cross = getProportionPoint(angularPoint, segment, length1, dx1, dy1),
17131
+ p2Cross = getProportionPoint(angularPoint, segment, length2, dx2, dy2),
17132
+ dx = 2 * angularPoint.x - p1Cross.x - p2Cross.x,
17133
+ dy = 2 * angularPoint.y - p1Cross.y - p2Cross.y,
17134
+ L = getLength(dx, dy),
17135
+ circlePoint = getProportionPoint(angularPoint, getLength(segment, radius), L, dx, dy);
17136
+ let startAngle = Math.atan2(p1Cross.y - circlePoint.y, p1Cross.x - circlePoint.x);
17137
+ const endAngle = Math.atan2(p2Cross.y - circlePoint.y, p2Cross.x - circlePoint.x);
17138
+ let sweepAngle = endAngle - startAngle;
17139
+ sweepAngle < 0 && (startAngle = endAngle, sweepAngle = -sweepAngle), sweepAngle > Math.PI && (sweepAngle -= Math.PI), 0 === i ? path.moveTo(p1Cross.x + x, p1Cross.y + y) : path.lineTo(p1Cross.x + x, p1Cross.y + y), sweepAngle && path.arcTo(angularPoint.x + x, angularPoint.y + y, p2Cross.x + x, p2Cross.y + y, radius), path.lineTo(p2Cross.x + x, p2Cross.y + y);
17140
+ }
17141
+ closePath || path.lineTo(points[endI + 1].x + x, points[endI + 1].y + y);
17142
+ }
17143
+ function getLength(dx, dy) {
17144
+ return Math.sqrt(dx * dx + dy * dy);
17145
+ }
17146
+ function getProportionPoint(point, segment, length, dx, dy) {
17147
+ const factor = segment / length;
17148
+ return {
17149
+ x: point.x - dx * factor,
17150
+ y: point.y - dy * factor
17151
+ };
17152
+ }
17153
+ function normalizePolygonPoints(points, cornerRadius, closePath = !0) {
17154
+ var _a;
17155
+ let hasDuplicate = !1;
17156
+ for (let i = 1; i < points.length; i++) if (isSamePoint(points[i - 1], points[i])) {
17157
+ hasDuplicate = !0;
17158
+ break;
17159
+ }
17160
+ if (!hasDuplicate && closePath && points.length > 1 && isSamePoint(points[0], points[points.length - 1]) && (hasDuplicate = !0), !hasDuplicate) return null;
17161
+ const normalizedPoints = [],
17162
+ normalizedCornerRadius = Array.isArray(cornerRadius) ? [] : null;
17163
+ for (let i = 0; i < points.length; i++) normalizedPoints.length && isSamePoint(normalizedPoints[normalizedPoints.length - 1], points[i]) || (normalizedPoints.push(points[i]), null == normalizedCornerRadius || normalizedCornerRadius.push(null !== (_a = cornerRadius[i]) && void 0 !== _a ? _a : 0));
17164
+ return closePath && normalizedPoints.length > 1 && isSamePoint(normalizedPoints[0], normalizedPoints[normalizedPoints.length - 1]) && (normalizedPoints.pop(), null == normalizedCornerRadius || normalizedCornerRadius.pop()), {
17165
+ points: normalizedPoints,
17166
+ cornerRadius: null != normalizedCornerRadius ? normalizedCornerRadius : cornerRadius
17167
+ };
17168
+ }
17169
+ function isSamePoint(a, b) {
17170
+ return a.x === b.x && a.y === b.y;
17171
+ }
17172
+ function getPolygonWinding(points) {
17173
+ let signedArea = 0;
17174
+ for (let i = 0; i < points.length; i++) {
17175
+ const current = points[i],
17176
+ next = points[(i + 1) % points.length];
17177
+ signedArea += current.x * next.y - next.x * current.y;
17178
+ }
17179
+ return signedArea > 0 ? 1 : -1;
17180
+ }
17181
+ function offsetPolygonPoints(points, distance, closePath = !0) {
17182
+ var _a;
17183
+ const n = null !== (_a = null == points ? void 0 : points.length) && void 0 !== _a ? _a : 0;
17184
+ if (n < 2 || closePath && n < 3 || !distance) return points;
17185
+ const sign = getPolygonWinding(points),
17186
+ edgeCount = closePath ? n : n - 1,
17187
+ lines = [];
17188
+ for (let i = 0; i < edgeCount; i++) {
17189
+ const cur = points[i],
17190
+ next = points[(i + 1) % n],
17191
+ dx = next.x - cur.x,
17192
+ dy = next.y - cur.y,
17193
+ len = Math.sqrt(dx * dx + dy * dy);
17194
+ if (!len) {
17195
+ lines.push(null);
17196
+ continue;
17197
+ }
17198
+ const offsetX = sign * dy * distance / len,
17199
+ offsetY = -sign * dx * distance / len;
17200
+ lines.push({
17201
+ x: cur.x + offsetX,
17202
+ y: cur.y + offsetY,
17203
+ dx: dx,
17204
+ dy: dy,
17205
+ len: len,
17206
+ offsetX: offsetX,
17207
+ offsetY: offsetY
17208
+ });
17209
+ }
17210
+ const prevLines = new Array(n);
17211
+ let prevLine = null;
17212
+ if (closePath) for (let i = edgeCount - 1; i >= 0; i--) if (lines[i]) {
17213
+ prevLine = lines[i];
17214
+ break;
17215
+ }
17216
+ for (let i = 0; i < n; i++) prevLines[i] = prevLine, i < edgeCount && lines[i] && (prevLine = lines[i]);
17217
+ const nextLines = new Array(n);
17218
+ let nextLine = null;
17219
+ if (closePath) for (let count = 0; count < edgeCount; count++) {
17220
+ const line = lines[(n - 1 + count) % edgeCount];
17221
+ if (line) {
17222
+ nextLine = line;
17223
+ break;
17224
+ }
17225
+ }
17226
+ for (let i = n - 1; i >= 0; i--) i < edgeCount && lines[i] && (nextLine = lines[i]), nextLines[i] = nextLine;
17227
+ const offsetPointByLine = (point, line) => ({
17228
+ x: point.x + line.offsetX,
17229
+ y: point.y + line.offsetY
17230
+ }),
17231
+ result = [];
17232
+ for (let i = 0; i < n; i++) {
17233
+ const prev = prevLines[i],
17234
+ cur = nextLines[i],
17235
+ line = prev || cur;
17236
+ if (!line) {
17237
+ result.push(points[i]);
17238
+ continue;
17239
+ }
17240
+ if (!prev || !cur) {
17241
+ result.push(offsetPointByLine(points[i], line));
17242
+ continue;
17243
+ }
17244
+ const denominator = prev.dx * cur.dy - prev.dy * cur.dx;
17245
+ if (Math.abs(denominator) <= 1e-12 * prev.len * cur.len) {
17246
+ result.push(offsetPointByLine(points[i], cur));
17247
+ continue;
17248
+ }
17249
+ const t = ((cur.x - prev.x) * cur.dy - (cur.y - prev.y) * cur.dx) / denominator,
17250
+ point = {
17251
+ x: prev.x + prev.dx * t,
17252
+ y: prev.y + prev.dy * t
17253
+ };
17254
+ result.push(Number.isFinite(point.x) && Number.isFinite(point.y) ? point : offsetPointByLine(points[i], cur));
17255
+ }
17256
+ return result;
17257
+ }
17258
+
17259
+ const getBoundsScaleMatrix = polygon => {
17260
+ var _a;
17261
+ const globalMatrix = polygon.globalTransMatrix,
17262
+ viewBoxMatrix = null === (_a = polygon.stage) || void 0 === _a ? void 0 : _a.window.getViewBoxTransform();
17263
+ return viewBoxMatrix ? {
17264
+ a: viewBoxMatrix.a * globalMatrix.a + viewBoxMatrix.c * globalMatrix.b,
17265
+ b: viewBoxMatrix.b * globalMatrix.a + viewBoxMatrix.d * globalMatrix.b,
17266
+ c: viewBoxMatrix.a * globalMatrix.c + viewBoxMatrix.c * globalMatrix.d,
17267
+ d: viewBoxMatrix.b * globalMatrix.c + viewBoxMatrix.d * globalMatrix.d
17268
+ } : globalMatrix;
17269
+ };
17270
+ const getPolygonBoundsScale = polygon => getScaledStrokeWithMatrix(getBoundsScaleMatrix(polygon), 1, 1);
17271
+ const updateBoundsOfPolygonOuterBorder = (attribute, polygonTheme, aabbBounds, polygon) => {
17272
+ const {
17273
+ outerBorder: outerBorder,
17274
+ points = polygonTheme.points,
17275
+ closePath = polygonTheme.closePath,
17276
+ shadowBlur = polygonTheme.shadowBlur,
17277
+ keepStrokeScale = polygonTheme.keepStrokeScale
17278
+ } = attribute;
17279
+ if (outerBorder && !1 !== outerBorder.visible) {
17280
+ const defaultOuterBorder = polygonTheme.outerBorder,
17281
+ {
17282
+ distance = defaultOuterBorder.distance,
17283
+ lineWidth = defaultOuterBorder.lineWidth,
17284
+ lineJoin = defaultOuterBorder.lineJoin,
17285
+ strokeBoundsBuffer = defaultOuterBorder.strokeBoundsBuffer
17286
+ } = outerBorder,
17287
+ boundsScale = getPolygonBoundsScale(polygon);
17288
+ let scaledDistance = distance;
17289
+ keepStrokeScale || (scaledDistance *= boundsScale), offsetPolygonPoints(points, scaledDistance, closePath).forEach(point => {
17290
+ aabbBounds.add(point.x, point.y);
17291
+ });
17292
+ boundStroke(aabbBounds, (shadowBlur * boundsScale + lineWidth * (keepStrokeScale ? 1 : boundsScale)) / 2, "miter" === lineJoin, strokeBoundsBuffer);
17293
+ }
17294
+ return aabbBounds;
17295
+ };
17296
+
17297
+ const POLYGON_UPDATE_TAG_KEY = ["points", "cornerRadius", "outerBorder", "keepStrokeScale", ...GRAPHIC_UPDATE_TAG_KEY];
17074
17298
  class Polygon extends Graphic {
17075
17299
  constructor(params) {
17076
17300
  super(params), this.type = "polygon", this.numberType = POLYGON_NUMBER_TYPE;
@@ -17087,6 +17311,16 @@
17087
17311
  getGraphicTheme() {
17088
17312
  return getTheme$1(this).polygon;
17089
17313
  }
17314
+ tryUpdateAABBBounds() {
17315
+ const {
17316
+ outerBorder: outerBorder
17317
+ } = this.attribute;
17318
+ if (outerBorder && !1 !== outerBorder.visible) {
17319
+ const boundsScale = getPolygonBoundsScale(this);
17320
+ boundsScale !== this._outerBorderBoundsScale && (this._outerBorderBoundsScale = boundsScale, this.addUpdateBoundTag());
17321
+ } else this._outerBorderBoundsScale = void 0;
17322
+ return super.tryUpdateAABBBounds();
17323
+ }
17090
17324
  updateAABBBounds(attribute, polygonTheme, aabbBounds) {
17091
17325
  this.updatePathProxyAABBBounds(aabbBounds) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds), application.graphicService.updateTempAABBBounds(aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
17092
17326
  const {
@@ -17100,7 +17334,7 @@
17100
17334
  } = attribute;
17101
17335
  return points.forEach(p => {
17102
17336
  aabbBounds.add(p.x, p.y);
17103
- }), aabbBounds;
17337
+ }), updateBoundsOfPolygonOuterBorder(attribute, polygonTheme, aabbBounds, this), aabbBounds;
17104
17338
  }
17105
17339
  _interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes) {
17106
17340
  "points" === key && (nextAttributes.points = pointsInterpolation(lastStepVal, nextStepVal, ratio));
@@ -17327,13 +17561,14 @@
17327
17561
  }) : fillStyle, setTextStyle(ctx, character);
17328
17562
  }
17329
17563
  function applyStrokeStyle(ctx, character) {
17564
+ var _a, _b;
17330
17565
  const strokeStyle = character && character.stroke || defaultFormatting.stroke;
17331
17566
  if (!strokeStyle) return void (ctx.globalAlpha = 0);
17332
17567
  const {
17333
17568
  strokeOpacity = 1,
17334
17569
  opacity = 1
17335
17570
  } = character;
17336
- ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle, setTextStyle(ctx, character);
17571
+ ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.setLineDash(null !== (_a = character.lineDash) && void 0 !== _a ? _a : []), ctx.lineDashOffset = null !== (_b = character.lineDashOffset) && void 0 !== _b ? _b : 0, ctx.strokeStyle = strokeStyle, setTextStyle(ctx, character);
17337
17572
  }
17338
17573
  function getStrByWithCanvas(desc, width, character, guessIndex, needTestLetter) {
17339
17574
  if (desc.length <= 1) return 0;
@@ -18542,8 +18777,15 @@
18542
18777
  const b = this.AABBBounds;
18543
18778
  return this._OBBBounds.setValue(b.x1, b.y1, b.x2, b.y2), this._OBBBounds;
18544
18779
  }
18545
- this.obbText || (this.obbText = new Text({})), this.obbText.setAttributes(Object.assign(Object.assign({}, attribute), {
18546
- angle: 0
18780
+ this.obbText || (this.obbText = new Text({}));
18781
+ const {
18782
+ dx = 0,
18783
+ dy = 0
18784
+ } = attribute;
18785
+ this.obbText.setAttributes(Object.assign(Object.assign({}, attribute), {
18786
+ angle: 0,
18787
+ dx: 0,
18788
+ dy: 0
18547
18789
  }));
18548
18790
  const bounds1 = this.obbText.AABBBounds,
18549
18791
  {
@@ -18558,7 +18800,7 @@
18558
18800
  x: x,
18559
18801
  y: y
18560
18802
  });
18561
- return this._OBBBounds.copy(bounds1), this._OBBBounds.translate(center.x - boundsCenter.x, center.y - boundsCenter.y), this._OBBBounds.angle = angle, this._OBBBounds;
18803
+ return this._OBBBounds.copy(bounds1), this._OBBBounds.translate(center.x - boundsCenter.x + dx, center.y - boundsCenter.y + dy), this._OBBBounds.angle = angle, this._OBBBounds;
18562
18804
  }
18563
18805
  updateAABBBounds(attribute, textTheme, aabbBounds) {
18564
18806
  const {
@@ -23426,22 +23668,26 @@
23426
23668
  width: width,
23427
23669
  height: height
23428
23670
  } = rect.attribute;
23429
- width = (null != width ? width : x1 - x) || 0, height = (null != height ? height : y1 - y) || 0;
23430
- const renderBorder = (borderStyle, key) => {
23431
- const doStroke = !(!borderStyle || !borderStyle.stroke),
23432
- sign = "outerBorder" === key ? -1 : 1,
23433
- {
23434
- distance = rectAttribute[key].distance
23435
- } = borderStyle,
23436
- d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
23437
- nextX = x + sign * d,
23438
- nextY = y + sign * d,
23439
- dw = 2 * d;
23440
- 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) {
23441
- const lastOpacity = rectAttribute[key].opacity;
23442
- rectAttribute[key].opacity = opacity, context.setStrokeStyle(rect, borderStyle, (originX - x) / scaleX, (originY - y) / scaleY, rectAttribute[key]), rectAttribute[key].opacity = lastOpacity, context.stroke();
23443
- }
23444
- };
23671
+ width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
23672
+ const borderX = width < 0 ? x + width : x,
23673
+ borderY = height < 0 ? y + height : y,
23674
+ borderWidth = width < 0 ? -width : width,
23675
+ borderHeight = height < 0 ? -height : height,
23676
+ renderBorder = (borderStyle, key) => {
23677
+ const doStroke = !(!borderStyle || !borderStyle.stroke),
23678
+ sign = "outerBorder" === key ? -1 : 1,
23679
+ {
23680
+ distance = rectAttribute[key].distance
23681
+ } = borderStyle,
23682
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
23683
+ nextX = borderX + sign * d,
23684
+ nextY = borderY + sign * d,
23685
+ dw = 2 * d;
23686
+ if (0 === cornerRadius || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) ? (context.beginPath(), context.rect(nextX, nextY, borderWidth - sign * dw, borderHeight - sign * dw)) : (context.beginPath(), createRectPath(context, nextX, nextY, borderWidth - sign * dw, borderHeight - sign * dw, cornerRadius, "bevel" !== cornerType)), context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), strokeCb) strokeCb(context, borderStyle, rectAttribute[key]);else if (doStroke) {
23687
+ const lastOpacity = rectAttribute[key].opacity;
23688
+ rectAttribute[key].opacity = opacity, context.setStrokeStyle(rect, borderStyle, (originX - x) / scaleX, (originY - y) / scaleY, rectAttribute[key]), rectAttribute[key].opacity = lastOpacity, context.stroke();
23689
+ }
23690
+ };
23445
23691
  doOuterBorder && renderBorder(outerBorder, "outerBorder"), doInnerBorder && renderBorder(innerBorder, "innerBorder");
23446
23692
  }
23447
23693
  }
@@ -23879,7 +24125,8 @@
23879
24125
  const StarRender = Symbol.for("StarRender");
23880
24126
 
23881
24127
  const DrawItemInterceptor = Symbol.for("DrawItemInterceptor");
23882
- const tempDirtyBounds = new AABBBounds(),
24128
+ const INTERACTIVE_POST_MATRIX = "_interactivePostMatrix",
24129
+ tempDirtyBounds = new AABBBounds(),
23883
24130
  tempBackupDirtyBounds = new AABBBounds();
23884
24131
  class ShadowRootDrawItemInterceptorContribution {
23885
24132
  constructor() {
@@ -23943,12 +24190,23 @@
23943
24190
  beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
23944
24191
  return !this.processing && (graphic.baseGraphic ? this.beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) : this.beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params));
23945
24192
  }
24193
+ resolveInteractivePostMatrix(graphic, interactiveGraphic) {
24194
+ const parent = graphic.parent;
24195
+ if (!parent) return graphic.attribute.postMatrix;
24196
+ let matrix = interactiveGraphic[INTERACTIVE_POST_MATRIX];
24197
+ matrix || (matrix = new Matrix(), interactiveGraphic[INTERACTIVE_POST_MATRIX] = matrix);
24198
+ const ancestorMatrix = parent.globalTransMatrix;
24199
+ matrix.setValue(ancestorMatrix.a, ancestorMatrix.b, ancestorMatrix.c, ancestorMatrix.d, ancestorMatrix.e, ancestorMatrix.f);
24200
+ const ownPostMatrix = graphic.attribute.postMatrix;
24201
+ return ownPostMatrix && matrix.multiply(ownPostMatrix.a, ownPostMatrix.b, ownPostMatrix.c, ownPostMatrix.d, ownPostMatrix.e, ownPostMatrix.f), matrix;
24202
+ }
23946
24203
  beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params) {
23947
24204
  let interactiveGraphic = graphic.interactiveGraphic;
23948
24205
  if (graphic.attribute.globalZIndex) {
23949
24206
  interactiveGraphic || (interactiveGraphic = graphic.clone(), graphic.interactiveGraphic = interactiveGraphic, interactiveGraphic.baseGraphic = graphic), interactiveGraphic.setAttributes({
23950
24207
  globalZIndex: 0,
23951
- zIndex: graphic.attribute.globalZIndex
24208
+ zIndex: graphic.attribute.globalZIndex,
24209
+ postMatrix: this.resolveInteractivePostMatrix(graphic, interactiveGraphic)
23952
24210
  }, !1, {
23953
24211
  skipUpdateCallback: !0
23954
24212
  }), drawContext.stage.tryInitInteractiveLayer();
@@ -27691,64 +27949,69 @@
27691
27949
  }
27692
27950
  const pathModule = bindPathRenderModule;
27693
27951
 
27694
- function drawPolygon(path, points, x, y) {
27695
- if (points && points.length) {
27696
- path.moveTo(points[0].x + x, points[0].y + y);
27697
- for (let i = 1; i < points.length; i++) path.lineTo(points[i].x + x, points[i].y + y);
27952
+ const defaultPolygonTextureRenderContribution = defaultBaseTextureRenderContribution;
27953
+ const defaultPolygonBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
27954
+ class DefaultPolygonRenderContribution {
27955
+ constructor() {
27956
+ this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
27698
27957
  }
27699
- }
27700
- function drawRoundedPolygon(path, points, x, y, cornerRadius, closePath = !0) {
27701
- var _a;
27702
- if (points.length < 3) return void drawPolygon(path, points, x, y);
27703
- let startI = 0,
27704
- endI = points.length - 1;
27705
- closePath || (startI += 1, endI -= 1, path.moveTo(points[0].x + x, points[0].y + y));
27706
- for (let i = startI; i <= endI; i++) {
27707
- const p1 = points[0 === i ? endI : (i - 1) % points.length],
27708
- angularPoint = points[i % points.length],
27709
- p2 = points[(i + 1) % points.length],
27710
- dx1 = angularPoint.x - p1.x,
27711
- dy1 = angularPoint.y - p1.y,
27712
- dx2 = angularPoint.x - p2.x,
27713
- dy2 = angularPoint.y - p2.y,
27714
- angle = (Math.atan2(dy1, dx1) - Math.atan2(dy2, dx2)) / 2,
27715
- tan = Math.abs(Math.tan(angle));
27716
- let radius = Array.isArray(cornerRadius) ? null !== (_a = cornerRadius[i % points.length]) && void 0 !== _a ? _a : 0 : cornerRadius,
27717
- segment = radius / tan;
27718
- const length1 = getLength(dx1, dy1),
27719
- length2 = getLength(dx2, dy2),
27720
- length = Math.min(length1, length2);
27721
- segment > length && (segment = length, radius = length * tan);
27722
- const p1Cross = getProportionPoint(angularPoint, segment, length1, dx1, dy1),
27723
- p2Cross = getProportionPoint(angularPoint, segment, length2, dx2, dy2),
27724
- dx = 2 * angularPoint.x - p1Cross.x - p2Cross.x,
27725
- dy = 2 * angularPoint.y - p1Cross.y - p2Cross.y,
27726
- L = getLength(dx, dy),
27727
- circlePoint = getProportionPoint(angularPoint, getLength(segment, radius), L, dx, dy);
27728
- let startAngle = Math.atan2(p1Cross.y - circlePoint.y, p1Cross.x - circlePoint.x);
27729
- const endAngle = Math.atan2(p2Cross.y - circlePoint.y, p2Cross.x - circlePoint.x);
27730
- let sweepAngle = endAngle - startAngle;
27731
- sweepAngle < 0 && (startAngle = endAngle, sweepAngle = -sweepAngle), sweepAngle > Math.PI && (sweepAngle -= Math.PI), 0 === i ? path.moveTo(p1Cross.x + x, p1Cross.y + y) : path.lineTo(p1Cross.x + x, p1Cross.y + y), sweepAngle && path.arcTo(angularPoint.x + x, angularPoint.y + y, p2Cross.x + x, p2Cross.y + y, radius), path.lineTo(p2Cross.x + x, p2Cross.y + y);
27958
+ drawShape(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb) {
27959
+ const {
27960
+ outerBorder: outerBorder,
27961
+ innerBorder: innerBorder
27962
+ } = polygon.attribute,
27963
+ doOuterBorder = outerBorder && !1 !== outerBorder.visible,
27964
+ doInnerBorder = innerBorder && !1 !== innerBorder.visible;
27965
+ if (!doOuterBorder && !doInnerBorder) return;
27966
+ const {
27967
+ points = polygonAttribute.points,
27968
+ cornerRadius = polygonAttribute.cornerRadius,
27969
+ opacity = polygonAttribute.opacity,
27970
+ x: originX = polygonAttribute.x,
27971
+ y: originY = polygonAttribute.y,
27972
+ scaleX = polygonAttribute.scaleX,
27973
+ scaleY = polygonAttribute.scaleY,
27974
+ keepStrokeScale = polygonAttribute.keepStrokeScale,
27975
+ closePath = polygonAttribute.closePath
27976
+ } = polygon.attribute,
27977
+ renderBorder = (borderStyle, key) => {
27978
+ var _a, _b;
27979
+ const doBorderStroke = !!borderStyle.stroke,
27980
+ distanceDirection = "outerBorder" === key ? 1 : -1,
27981
+ {
27982
+ distance = polygonAttribute[key].distance
27983
+ } = borderStyle,
27984
+ borderDistance = distanceDirection * (keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr)),
27985
+ normalized = normalizePolygonPoints(points, cornerRadius, closePath),
27986
+ normalizedPoints = null !== (_a = null == normalized ? void 0 : normalized.points) && void 0 !== _a ? _a : points,
27987
+ normalizedCornerRadius = null !== (_b = null == normalized ? void 0 : normalized.cornerRadius) && void 0 !== _b ? _b : cornerRadius,
27988
+ borderPoints = offsetPolygonPoints(normalizedPoints, borderDistance, closePath),
27989
+ winding = getPolygonWinding(normalizedPoints),
27990
+ borderCornerRadius = normalizedPoints.map((point, i) => {
27991
+ var _a;
27992
+ const radius = isArray$1(normalizedCornerRadius) ? null !== (_a = normalizedCornerRadius[i]) && void 0 !== _a ? _a : 0 : normalizedCornerRadius || 0;
27993
+ if (!closePath && (0 === i || i === normalizedPoints.length - 1) || normalizedPoints.length < 3) return radius;
27994
+ const prev = normalizedPoints[(i - 1 + normalizedPoints.length) % normalizedPoints.length],
27995
+ next = normalizedPoints[(i + 1) % normalizedPoints.length],
27996
+ cornerDirection = ((point.x - prev.x) * (next.y - point.y) - (point.y - prev.y) * (next.x - point.x)) * winding < 0 ? -1 : 1;
27997
+ return Math.max(0, radius + borderDistance * cornerDirection);
27998
+ }),
27999
+ noCorner = 0 === borderCornerRadius.length || borderCornerRadius.every(r => 0 === r);
28000
+ if (context.beginPath(), noCorner ? drawPolygon(context.camera ? context : context.nativeContext, borderPoints, x, y) : drawRoundedPolygon(context.camera ? context : context.nativeContext, borderPoints, x, y, borderCornerRadius, closePath), closePath && context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(polygon, polygon.attribute, polygonAttribute), strokeCb) strokeCb(context, borderStyle, polygonAttribute[key]);else if (doBorderStroke) {
28001
+ const lastOpacity = polygonAttribute[key].opacity,
28002
+ borderStyleWithStrokeScale = borderStyle,
28003
+ lastKeepStrokeScale = borderStyleWithStrokeScale.keepStrokeScale;
28004
+ polygonAttribute[key].opacity = opacity, borderStyleWithStrokeScale.keepStrokeScale = keepStrokeScale, context.setStrokeStyle(polygon, borderStyleWithStrokeScale, (originX - x) / scaleX, (originY - y) / scaleY, polygonAttribute[key]), polygonAttribute[key].opacity = lastOpacity, void 0 === lastKeepStrokeScale ? delete borderStyleWithStrokeScale.keepStrokeScale : borderStyleWithStrokeScale.keepStrokeScale = lastKeepStrokeScale, context.stroke();
28005
+ }
28006
+ };
28007
+ doOuterBorder && renderBorder(outerBorder, "outerBorder"), doInnerBorder && renderBorder(innerBorder, "innerBorder");
27732
28008
  }
27733
- closePath || path.lineTo(points[endI + 1].x + x, points[endI + 1].y + y);
27734
- }
27735
- function getLength(dx, dy) {
27736
- return Math.sqrt(dx * dx + dy * dy);
27737
- }
27738
- function getProportionPoint(point, segment, length, dx, dy) {
27739
- const factor = segment / length;
27740
- return {
27741
- x: point.x - dx * factor,
27742
- y: point.y - dy * factor
27743
- };
27744
28009
  }
27745
-
27746
- const defaultPolygonTextureRenderContribution = defaultBaseTextureRenderContribution;
27747
- const defaultPolygonBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
28010
+ const defaultPolygonRenderContribution = new DefaultPolygonRenderContribution();
27748
28011
 
27749
28012
  class DefaultCanvasPolygonRender extends BaseRender {
27750
28013
  constructor(graphicRenderContributions) {
27751
- super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(graphicRenderContributions);
28014
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonRenderContribution, defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(graphicRenderContributions);
27752
28015
  }
27753
28016
  drawShape(polygon, context, x, y, drawContext, params, fillCb, strokeCb) {
27754
28017
  const polygonAttribute = getTheme$1(polygon, null == params ? void 0 : params.theme).polygon,
@@ -33415,7 +33678,7 @@
33415
33678
  runtimePluginInstallers: {},
33416
33679
  formatter: undefined
33417
33680
  });
33418
- const factoryRegistryVersion = "2.1.5";
33681
+ const factoryRegistryVersion = "2.1.4";
33419
33682
  const factoryRegistryKey = Symbol.for(`@visactor/vchart/factory-registry@${factoryRegistryVersion}`);
33420
33683
  const globalFactoryRegistry = globalThis;
33421
33684
  const factoryRegistry = (_a = globalFactoryRegistry[factoryRegistryKey]) !== null && _a !== void 0 ? _a : (globalFactoryRegistry[factoryRegistryKey] = createFactoryRegistry());
@@ -43228,6 +43491,8 @@
43228
43491
  var _a, _b;
43229
43492
  return null !== (_b = null !== (_a = null == params ? void 0 : params.lynx) && void 0 !== _a ? _a : null == params ? void 0 : params.runtime) && void 0 !== _b ? _b : getGlobalLynxRuntime();
43230
43493
  }
43494
+ const requestAnimationFrameBasedSTO = callback => rafBasedSto.call(callback),
43495
+ cancelAnimationFrameBasedSTO = handle => rafBasedSto.clear(handle);
43231
43496
  function getLynxPixelRatio(params, runtime) {
43232
43497
  var _a, _b, _c, _d, _e;
43233
43498
  return null !== (_e = null !== (_d = null !== (_a = null == params ? void 0 : params.pixelRatio) && void 0 !== _a ? _a : null === (_c = null === (_b = null == runtime ? void 0 : runtime.getSystemInfoSync) || void 0 === _b ? void 0 : _b.call(runtime)) || void 0 === _c ? void 0 : _c.pixelRatio) && void 0 !== _d ? _d : getGlobalSystemPixelRatio()) && void 0 !== _e ? _e : 1;
@@ -43299,7 +43564,7 @@
43299
43564
  }
43300
43565
  class LynxEnvContribution extends BaseEnvContribution {
43301
43566
  constructor() {
43302
- super(), this.type = "lynx", this.supportEvent = !0, this.canvasMap = new Map(), this.freeCanvasList = [], this.canvasIdx = 0, this.supportsTouchEvents = !0;
43567
+ super(), this.type = "lynx", this.supportEvent = !0, this.canvasMap = new Map(), this.freeCanvasList = [], this.canvasIdx = 0, this.requestAnimationFrame = requestAnimationFrameBasedSTO, this.cancelAnimationFrame = cancelAnimationFrameBasedSTO, this.supportsTouchEvents = !0;
43303
43568
  try {
43304
43569
  this.supportsPointerEvents = !!globalThis.PointerEvent, this.supportsMouseEvents = !!globalThis.MouseEvent;
43305
43570
  } catch (err) {
@@ -43308,7 +43573,8 @@
43308
43573
  this.applyStyles = !0;
43309
43574
  }
43310
43575
  configure(service, params = {}) {
43311
- service.env === this.type && (service.setActiveEnvContribution(this), this.lynxEnvParams = params, this.lynxRuntime = getLynxRuntime(params));
43576
+ var _a, _b;
43577
+ service.env === this.type && (service.setActiveEnvContribution(this), this.lynxEnvParams = params, this.lynxRuntime = getLynxRuntime(params), "function" == typeof (null === (_a = this.lynxRuntime) || void 0 === _a ? void 0 : _a.requestAnimationFrame) && "function" == typeof (null === (_b = this.lynxRuntime) || void 0 === _b ? void 0 : _b.cancelAnimationFrame) ? (this.requestAnimationFrame = this.lynxRuntime.requestAnimationFrame.bind(this.lynxRuntime), this.cancelAnimationFrame = this.lynxRuntime.cancelAnimationFrame.bind(this.lynxRuntime)) : (this.requestAnimationFrame = requestAnimationFrameBasedSTO, this.cancelAnimationFrame = cancelAnimationFrameBasedSTO));
43312
43578
  }
43313
43579
  getDynamicCanvasCount() {
43314
43580
  return this.freeCanvasList.length;
@@ -43360,14 +43626,10 @@
43360
43626
  return getLynxPixelRatio(void 0, this.lynxRuntime);
43361
43627
  }
43362
43628
  getRequestAnimationFrame() {
43363
- return function (callback) {
43364
- return rafBasedSto.call(callback);
43365
- };
43629
+ return this.requestAnimationFrame;
43366
43630
  }
43367
43631
  getCancelAnimationFrame() {
43368
- return h => {
43369
- rafBasedSto.clear(h);
43370
- };
43632
+ return this.cancelAnimationFrame;
43371
43633
  }
43372
43634
  mapToCanvasPoint(event) {
43373
43635
  var _a;
@@ -49424,7 +49686,7 @@
49424
49686
  });
49425
49687
  };
49426
49688
 
49427
- const version = "2.1.5";
49689
+ const version = "2.1.4";
49428
49690
 
49429
49691
  const addVChartProperty = (data, op) => {
49430
49692
  const context = op.beforeCall();
@@ -70735,6 +70997,7 @@
70735
70997
  }));
70736
70998
  }
70737
70999
  _updatePositionOfPager(renderStartY, compWidth, compHeight) {
71000
+ var _a;
70738
71001
  const {
70739
71002
  pager: pager
70740
71003
  } = this.attribute,
@@ -70742,18 +71005,24 @@
70742
71005
  totalPage: totalPage,
70743
71006
  isHorizontal: isHorizontal
70744
71007
  } = this._itemContext,
70745
- position = pager && pager.position || "middle";
71008
+ position = pager && pager.position || "middle",
71009
+ hugContent = !(!pager || !pager.hugContent),
71010
+ pagerSpace = null !== (_a = pager && pager.space) && void 0 !== _a ? _a : DEFAULT_PAGER_SPACE;
70746
71011
  if (this._pagerComponent.setTotal(totalPage), isHorizontal) {
70747
71012
  let y;
70748
- y = "start" === position ? renderStartY : "end" === position ? renderStartY + compHeight - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compHeight / 2 - this._pagerComponent.AABBBounds.height() / 2, this._pagerComponent.setAttributes({
70749
- x: compWidth - this._pagerComponent.AABBBounds.width(),
71013
+ y = "start" === position ? renderStartY : "end" === position ? renderStartY + compHeight - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compHeight / 2 - this._pagerComponent.AABBBounds.height() / 2;
71014
+ let x = compWidth - this._pagerComponent.AABBBounds.width();
71015
+ hugContent && (x = Math.max(0, Math.min(this._itemsContainer.AABBBounds.width() + pagerSpace, x))), this._pagerComponent.setAttributes({
71016
+ x: x,
70750
71017
  y: y
70751
71018
  });
70752
71019
  } else {
70753
71020
  let x;
70754
- x = "start" === position ? 0 : "end" === position ? compWidth - this._pagerComponent.AABBBounds.width() : (compWidth - this._pagerComponent.AABBBounds.width()) / 2, this._pagerComponent.setAttributes({
71021
+ x = "start" === position ? 0 : "end" === position ? compWidth - this._pagerComponent.AABBBounds.width() : (compWidth - this._pagerComponent.AABBBounds.width()) / 2;
71022
+ let y = compHeight - this._pagerComponent.AABBBounds.height();
71023
+ hugContent && (y = Math.max(0, Math.min(renderStartY + this._itemsContainer.AABBBounds.height() + pagerSpace, y))), this._pagerComponent.setAttributes({
70755
71024
  x: x,
70756
- y: compHeight - this._pagerComponent.AABBBounds.height()
71025
+ y: y
70757
71026
  });
70758
71027
  }
70759
71028
  }
@@ -70908,11 +71177,15 @@
70908
71177
  this._itemContext.totalPage = total, this._updatePositionOfPager(renderStartY, compWidth, compHeight);
70909
71178
  }
70910
71179
  defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("y", -(defaultCurrent - 1) * (compHeight + spaceRow)) : itemsContainer.setAttribute("x", -(defaultCurrent - 1) * (compWidth + spaceCol)));
71180
+ const hugContent = !!pager.hugContent;
71181
+ let clipWidth = isHorizontal ? contentWidth : compWidth,
71182
+ clipHeight = isHorizontal ? compHeight : contentHeight;
71183
+ hugContent && (isHorizontal ? clipWidth = Math.max(0, Math.min(clipWidth, itemsContainer.AABBBounds.width())) : clipHeight = Math.max(0, Math.min(clipHeight, itemsContainer.AABBBounds.height())));
70911
71184
  const clipGroup = graphicCreator.group({
70912
71185
  x: 0,
70913
71186
  y: renderStartY,
70914
- width: isHorizontal ? contentWidth : compWidth,
70915
- height: isHorizontal ? compHeight : contentHeight,
71187
+ width: clipWidth,
71188
+ height: clipHeight,
70916
71189
  clip: !0,
70917
71190
  pickable: !1
70918
71191
  });