@visactor/vchart-extension 2.1.5-alpha.0 → 2.1.6-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +224 -76
- package/build/index.min.js +1 -1
- package/cjs/charts/axis-3d/band-axis.js +2 -1
- package/cjs/charts/axis-3d/log-axis.js +1 -2
- package/cjs/charts/bar-3d/animation.js +1 -1
- package/cjs/charts/bar-3d/chart-spec-transformer.js +1 -1
- package/cjs/charts/bar-3d/chart.js +1 -1
- package/cjs/charts/bar-3d/constant.js +1 -1
- package/cjs/charts/bar-3d/index.js +1 -1
- package/cjs/charts/bar-3d/interface.js +1 -1
- package/cjs/charts/bar-3d/series-spec-transformer.js +1 -2
- package/cjs/charts/bar-3d/series.js +1 -1
- package/cjs/charts/bar-3d/theme.js +1 -1
- package/cjs/charts/candlestick/candlestick-transformer.js +1 -1
- package/cjs/charts/candlestick/candlestick.js +1 -1
- package/cjs/charts/candlestick/index.js +1 -1
- package/cjs/charts/candlestick/interface.js +1 -1
- package/cjs/charts/candlestick/util.js +1 -1
- package/cjs/charts/combination-candlestick/combination-candlestick-transformer.js +1 -1
- package/cjs/charts/combination-candlestick/combination-candlestick.js +1 -1
- package/cjs/charts/combination-candlestick/constant.js +1 -1
- package/cjs/charts/combination-candlestick/index.js +1 -1
- package/cjs/charts/combination-candlestick/interface.js +1 -2
- package/cjs/charts/conversion-funnel/arrow-data-transform.js +1 -1
- package/cjs/charts/conversion-funnel/constants.js +1 -1
- package/cjs/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
- package/cjs/charts/conversion-funnel/conversion-funnel.js +1 -1
- package/cjs/charts/conversion-funnel/index.js +1 -1
- package/cjs/charts/conversion-funnel/interface.js +1 -1
- package/cjs/charts/conversion-funnel/util.js +1 -1
- package/cjs/charts/funnel-3d/chart.js +1 -1
- package/cjs/charts/funnel-3d/constant.js +1 -1
- package/cjs/charts/funnel-3d/index.js +1 -1
- package/cjs/charts/funnel-3d/interface.js +1 -1
- package/cjs/charts/funnel-3d/series-spec-transformer.js +1 -1
- package/cjs/charts/funnel-3d/series.js +1 -1
- package/cjs/charts/funnel-3d/theme.js +1 -1
- package/cjs/components/bar-link/bar-link.js +1 -1
- package/cjs/components/bar-link/constant.js +1 -1
- package/cjs/components/bar-link/index.js +1 -1
- package/cjs/components/bar-link/type.js +1 -1
- package/cjs/components/bar-link/util.js +1 -1
- package/cjs/components/bar-regression-line/index.js +1 -1
- package/cjs/components/bar-regression-line/type.js +1 -1
- package/cjs/components/extension-mark-sync-state/extension-mark-sync-state.js +1 -1
- package/cjs/components/extension-mark-sync-state/index.js +1 -1
- package/cjs/components/extension-mark-sync-state/type.js +1 -1
- package/cjs/components/histogram-regression-line/index.js +1 -1
- package/cjs/components/histogram-regression-line/type.js +2 -1
- package/cjs/components/map-label/index.js +1 -1
- package/cjs/components/map-label/layout.js +1 -1
- package/cjs/components/map-label/map-label-transformer.js +1 -1
- package/cjs/components/map-label/map-label.js +1 -1
- package/cjs/components/map-label/theme.js +1 -1
- package/cjs/components/map-label/type.js +1 -1
- package/cjs/components/regression-line/index.js +1 -1
- package/cjs/components/regression-line/regression-line.js +1 -1
- package/cjs/components/regression-line/type.js +1 -1
- package/cjs/components/scatter-regression-line/index.js +1 -1
- package/cjs/components/scatter-regression-line/type.js +1 -1
- package/cjs/components/series-break/constant.js +1 -1
- package/cjs/components/series-break/index.js +1 -1
- package/cjs/components/series-break/series-break.js +1 -1
- package/cjs/components/series-break/type.js +1 -1
- package/cjs/components/series-break/util.js +2 -1
- package/cjs/components/series-label/constant.js +1 -1
- package/cjs/components/series-label/index.js +1 -1
- package/cjs/components/series-label/series-label.js +1 -1
- package/cjs/components/series-label/type.js +1 -1
- package/cjs/components/series-label/util.js +1 -1
- package/esm/charts/axis-3d/band-axis.js +2 -1
- package/esm/charts/axis-3d/log-axis.js +1 -2
- package/esm/charts/bar-3d/animation.js +1 -1
- package/esm/charts/bar-3d/chart-spec-transformer.js +1 -1
- package/esm/charts/bar-3d/chart.js +1 -1
- package/esm/charts/bar-3d/constant.js +1 -1
- package/esm/charts/bar-3d/index.js +1 -1
- package/esm/charts/bar-3d/interface.js +1 -1
- package/esm/charts/bar-3d/series-spec-transformer.js +1 -2
- package/esm/charts/bar-3d/series.js +1 -1
- package/esm/charts/bar-3d/theme.js +1 -1
- package/esm/charts/candlestick/candlestick-transformer.js +1 -1
- package/esm/charts/candlestick/candlestick.js +1 -1
- package/esm/charts/candlestick/index.js +1 -1
- package/esm/charts/candlestick/interface.js +1 -1
- package/esm/charts/candlestick/util.js +1 -1
- package/esm/charts/combination-candlestick/combination-candlestick-transformer.js +1 -1
- package/esm/charts/combination-candlestick/combination-candlestick.js +1 -1
- package/esm/charts/combination-candlestick/constant.js +1 -1
- package/esm/charts/combination-candlestick/index.js +1 -1
- package/esm/charts/combination-candlestick/interface.js +1 -2
- package/esm/charts/conversion-funnel/arrow-data-transform.js +1 -1
- package/esm/charts/conversion-funnel/constants.js +1 -1
- package/esm/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
- package/esm/charts/conversion-funnel/conversion-funnel.js +1 -1
- package/esm/charts/conversion-funnel/index.js +1 -1
- package/esm/charts/conversion-funnel/interface.js +1 -1
- package/esm/charts/conversion-funnel/util.js +1 -1
- package/esm/charts/funnel-3d/chart.js +1 -1
- package/esm/charts/funnel-3d/constant.js +1 -1
- package/esm/charts/funnel-3d/index.js +1 -1
- package/esm/charts/funnel-3d/interface.js +1 -1
- package/esm/charts/funnel-3d/series-spec-transformer.js +1 -1
- package/esm/charts/funnel-3d/series.js +1 -1
- package/esm/charts/funnel-3d/theme.js +1 -1
- package/esm/components/bar-link/bar-link.js +1 -1
- package/esm/components/bar-link/constant.js +1 -1
- package/esm/components/bar-link/index.js +1 -1
- package/esm/components/bar-link/type.js +1 -1
- package/esm/components/bar-link/util.js +1 -1
- package/esm/components/bar-regression-line/index.js +1 -1
- package/esm/components/bar-regression-line/type.js +1 -1
- package/esm/components/extension-mark-sync-state/extension-mark-sync-state.js +1 -1
- package/esm/components/extension-mark-sync-state/index.js +1 -1
- package/esm/components/extension-mark-sync-state/type.js +1 -1
- package/esm/components/histogram-regression-line/index.js +1 -1
- package/esm/components/histogram-regression-line/type.js +2 -1
- package/esm/components/map-label/index.js +1 -1
- package/esm/components/map-label/layout.js +1 -1
- package/esm/components/map-label/map-label-transformer.js +1 -1
- package/esm/components/map-label/map-label.js +1 -1
- package/esm/components/map-label/theme.js +1 -1
- package/esm/components/map-label/type.js +1 -1
- package/esm/components/regression-line/index.js +1 -1
- package/esm/components/regression-line/regression-line.js +1 -1
- package/esm/components/regression-line/type.js +1 -1
- package/esm/components/scatter-regression-line/index.js +1 -1
- package/esm/components/scatter-regression-line/type.js +1 -1
- package/esm/components/series-break/constant.js +1 -1
- package/esm/components/series-break/index.js +1 -1
- package/esm/components/series-break/series-break.js +1 -1
- package/esm/components/series-break/type.js +1 -1
- package/esm/components/series-break/util.js +2 -1
- package/esm/components/series-label/constant.js +1 -1
- package/esm/components/series-label/index.js +1 -1
- package/esm/components/series-label/series-label.js +1 -1
- package/esm/components/series-label/type.js +1 -1
- package/esm/components/series-label/util.js +1 -1
- package/package.json +8 -8
package/build/index.js
CHANGED
|
@@ -2914,7 +2914,7 @@
|
|
|
2914
2914
|
constructor() {
|
|
2915
2915
|
super(), this._uid = Generator.GenAutoIncrementId(), this._firstChild = null, this._lastChild = null, this.parent = null, this._count = 1;
|
|
2916
2916
|
}
|
|
2917
|
-
onParentSharedStateTreeChanged(_stage, _layer
|
|
2917
|
+
onParentSharedStateTreeChanged(_stage, _layer) {}
|
|
2918
2918
|
forEachChildren(cb, reverse = !1) {
|
|
2919
2919
|
if (reverse) {
|
|
2920
2920
|
let child = this._lastChild,
|
|
@@ -6451,18 +6451,21 @@
|
|
|
6451
6451
|
}
|
|
6452
6452
|
}
|
|
6453
6453
|
|
|
6454
|
-
function
|
|
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
|
-
} =
|
|
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
|
-
|
|
7179
|
+
getDefaultAttribute = options.getDefaultAttribute,
|
|
7180
|
+
readDefaultAttribute = getDefaultAttribute,
|
|
7181
|
+
readStateTransitionDefaultAttribute = null !== (_c = options.getStateTransitionDefaultAttribute) && void 0 !== _c ? _c : getDefaultAttribute,
|
|
7177
7182
|
shouldSkipDefaultAttribute = options.shouldSkipDefaultAttribute,
|
|
7178
|
-
|
|
7179
|
-
|
|
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
|
}
|
|
@@ -7415,17 +7427,14 @@
|
|
|
7415
7427
|
}
|
|
7416
7428
|
return null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope;
|
|
7417
7429
|
}
|
|
7418
|
-
|
|
7430
|
+
syncSharedStateScopeBindingFromTree(markDirty = !0) {
|
|
7419
7431
|
var _a;
|
|
7432
|
+
const nextScope = this.resolveBoundSharedStateScope();
|
|
7420
7433
|
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);
|
|
7421
7434
|
}
|
|
7422
|
-
|
|
7423
|
-
const nextScope = void 0 === inheritedSharedStateScope ? this.resolveBoundSharedStateScope() : null != inheritedSharedStateScope ? inheritedSharedStateScope : void 0;
|
|
7424
|
-
return this.syncSharedStateScopeBinding(nextScope, markDirty);
|
|
7425
|
-
}
|
|
7426
|
-
syncSharedStateScopeBindingOnTreeChange(markDirty = !0, inheritedSharedStateScope) {
|
|
7435
|
+
syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
|
|
7427
7436
|
var _a, _b;
|
|
7428
|
-
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
|
|
7437
|
+
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);
|
|
7429
7438
|
}
|
|
7430
7439
|
syncSharedStateActiveRegistrations() {
|
|
7431
7440
|
var _a;
|
|
@@ -7433,7 +7442,6 @@
|
|
|
7433
7442
|
if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
|
|
7434
7443
|
scope.subtreeActiveDescendants.delete(this);
|
|
7435
7444
|
}), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
|
|
7436
|
-
if ((null == previousScopes ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) return;
|
|
7437
7445
|
const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
|
|
7438
7446
|
null == previousScopes || previousScopes.forEach(scope => {
|
|
7439
7447
|
nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
|
|
@@ -7441,15 +7449,6 @@
|
|
|
7441
7449
|
scope.subtreeActiveDescendants.add(this);
|
|
7442
7450
|
}), this.registeredActiveScopes = nextScopes;
|
|
7443
7451
|
}
|
|
7444
|
-
isSharedStateScopeChainRegistered(previousScopes) {
|
|
7445
|
-
let scope = this.boundSharedStateScope,
|
|
7446
|
-
scopeCount = 0;
|
|
7447
|
-
for (; scope;) {
|
|
7448
|
-
if (!previousScopes.has(scope)) return !1;
|
|
7449
|
-
scopeCount += 1, scope = scope.parentScope;
|
|
7450
|
-
}
|
|
7451
|
-
return scopeCount === previousScopes.size;
|
|
7452
|
-
}
|
|
7453
7452
|
clearSharedStateActiveRegistrations() {
|
|
7454
7453
|
const previousScopes = this.registeredActiveScopes;
|
|
7455
7454
|
previousScopes && (previousScopes.forEach(scope => {
|
|
@@ -7459,8 +7458,8 @@
|
|
|
7459
7458
|
markSharedStateDirty() {
|
|
7460
7459
|
this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
|
|
7461
7460
|
}
|
|
7462
|
-
onParentSharedStateTreeChanged(stage, layer
|
|
7463
|
-
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange(
|
|
7461
|
+
onParentSharedStateTreeChanged(stage, layer) {
|
|
7462
|
+
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
|
|
7464
7463
|
}
|
|
7465
7464
|
refreshSharedStateBeforeRender() {
|
|
7466
7465
|
var _a;
|
|
@@ -7510,21 +7509,20 @@
|
|
|
7510
7509
|
}), snapshot) : snapshot;
|
|
7511
7510
|
}
|
|
7512
7511
|
buildRemovedStateAnimationAttrs(targetStateAttrs, previousResolvedStatePatch) {
|
|
7513
|
-
|
|
7514
|
-
if (!previousResolvedStatePatch) return extraAttrs;
|
|
7512
|
+
if (!previousResolvedStatePatch) return;
|
|
7515
7513
|
const snapshot = this.buildStaticAttributeSnapshot(),
|
|
7516
|
-
|
|
7514
|
+
extraAttrs = {};
|
|
7517
7515
|
return Object.keys(previousResolvedStatePatch).forEach(key => {
|
|
7518
7516
|
const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetStateAttrs, key);
|
|
7519
7517
|
if (hasTargetAttr && void 0 !== targetStateAttrs[key]) return;
|
|
7520
7518
|
const assignFallbackAttr = value => {
|
|
7521
|
-
|
|
7519
|
+
extraAttrs[key] = void 0 === value ? value : cloneAttributeValue(value);
|
|
7522
7520
|
};
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
}
|
|
7521
|
+
hasTargetAttr ? assignFallbackAttr(targetStateAttrs[key]) : Object.prototype.hasOwnProperty.call(snapshot, key) ? assignFallbackAttr(snapshot[key]) : assignFallbackAttr(void 0);
|
|
7522
|
+
}), {
|
|
7523
|
+
extraAttrs: extraAttrs,
|
|
7524
|
+
stateTransitionTargetAttrs: snapshot
|
|
7525
|
+
};
|
|
7528
7526
|
}
|
|
7529
7527
|
syncObjectToSnapshot(target, snapshot, excludedKeys) {
|
|
7530
7528
|
const delta = new Map();
|
|
@@ -8111,10 +8109,6 @@
|
|
|
8111
8109
|
var _a;
|
|
8112
8110
|
return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
|
|
8113
8111
|
}
|
|
8114
|
-
setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
|
|
8115
|
-
var _a;
|
|
8116
|
-
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}`;
|
|
8117
|
-
}
|
|
8118
8112
|
getStateResolveBaseAttrs() {
|
|
8119
8113
|
var _a;
|
|
8120
8114
|
return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
|
|
@@ -8244,29 +8238,37 @@
|
|
|
8244
8238
|
resolvedStateAttrs: resolvedStateAttrs
|
|
8245
8239
|
} = this.resolveGraphicStateTransition(states, !0),
|
|
8246
8240
|
patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
|
|
8247
|
-
patchChanged
|
|
8241
|
+
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) {
|
|
8242
|
+
this._syncFinalAttributeFromStaticTruth();
|
|
8243
|
+
const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
|
|
8244
|
+
this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
|
|
8245
|
+
} else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
8248
8246
|
type: AttributeUpdateType.STATE
|
|
8249
8247
|
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
8250
8248
|
type: AttributeUpdateType.STATE
|
|
8251
|
-
}), this.emitStateUpdateEvent()
|
|
8249
|
+
}), this.emitStateUpdateEvent();
|
|
8252
8250
|
}
|
|
8253
8251
|
resolveStateAnimateConfig(animateConfig) {
|
|
8254
8252
|
var _a, _b, _c;
|
|
8255
8253
|
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
8254
|
}
|
|
8257
|
-
applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs) {
|
|
8255
|
+
applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs, stateTransitionTargetAttrs) {
|
|
8258
8256
|
const resolvedAnimateConfig = hasAnimation ? this.resolveStateAnimateConfig(animateConfig) : void 0,
|
|
8259
8257
|
transitionOptions = resolvedAnimateConfig ? {
|
|
8260
8258
|
animateConfig: resolvedAnimateConfig,
|
|
8261
8259
|
extraAnimateAttrs: extraAnimateAttrs,
|
|
8262
|
-
|
|
8260
|
+
getStateTransitionDefaultAttribute: this.getStateTransitionDefaultAttribute.bind(this),
|
|
8261
|
+
shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this),
|
|
8262
|
+
stateTransitionTargetAttrs: stateTransitionTargetAttrs
|
|
8263
8263
|
} : void 0;
|
|
8264
8264
|
if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, transitionOptions);
|
|
8265
8265
|
const plan = this.getStateTransitionOrchestrator().analyzeTransition(attrs, hasAnimation, {
|
|
8266
8266
|
noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
|
|
8267
8267
|
animateConfig: resolvedAnimateConfig,
|
|
8268
8268
|
extraAnimateAttrs: extraAnimateAttrs,
|
|
8269
|
-
|
|
8269
|
+
getStateTransitionDefaultAttribute: this.getStateTransitionDefaultAttribute.bind(this),
|
|
8270
|
+
shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this),
|
|
8271
|
+
stateTransitionTargetAttrs: stateTransitionTargetAttrs
|
|
8270
8272
|
});
|
|
8271
8273
|
this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
|
|
8272
8274
|
}
|
|
@@ -8293,11 +8295,15 @@
|
|
|
8293
8295
|
transition = this.resolveClearStatesTransition();
|
|
8294
8296
|
if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
|
|
8295
8297
|
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
|
|
8298
|
+
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) {
|
|
8299
|
+
this._syncFinalAttributeFromStaticTruth();
|
|
8300
|
+
const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
|
|
8301
|
+
this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
|
|
8302
|
+
} else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
8297
8303
|
type: AttributeUpdateType.STATE
|
|
8298
8304
|
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
|
|
8299
8305
|
type: AttributeUpdateType.STATE
|
|
8300
|
-
}), this.emitStateUpdateEvent()
|
|
8306
|
+
}), this.emitStateUpdateEvent();
|
|
8301
8307
|
}
|
|
8302
8308
|
removeState(stateName, hasAnimation) {
|
|
8303
8309
|
const transition = this.resolveRemoveStateTransition(stateName);
|
|
@@ -8338,11 +8344,15 @@
|
|
|
8338
8344
|
effectiveStates: effectiveStates,
|
|
8339
8345
|
resolvedStateAttrs: resolvedStateAttrs
|
|
8340
8346
|
} = this.resolveGraphicStateTransition(states);
|
|
8341
|
-
|
|
8347
|
+
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) {
|
|
8348
|
+
this._syncFinalAttributeFromStaticTruth();
|
|
8349
|
+
const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
|
|
8350
|
+
this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
|
|
8351
|
+
} else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
8342
8352
|
type: AttributeUpdateType.STATE
|
|
8343
8353
|
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
8344
8354
|
type: AttributeUpdateType.STATE
|
|
8345
|
-
}), this.emitStateUpdateEvent()
|
|
8355
|
+
}), this.emitStateUpdateEvent();
|
|
8346
8356
|
}
|
|
8347
8357
|
invalidateResolver() {
|
|
8348
8358
|
var _a, _b;
|
|
@@ -8462,12 +8472,12 @@
|
|
|
8462
8472
|
this._globalTransMatrix.translate(scrollX, scrollY);
|
|
8463
8473
|
}
|
|
8464
8474
|
}
|
|
8465
|
-
setStage(stage, layer
|
|
8475
|
+
setStage(stage, layer) {
|
|
8466
8476
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
8467
8477
|
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,
|
|
8468
8478
|
previousStage = this.stage;
|
|
8469
8479
|
if (this.stage !== stage || this.layer !== layer) {
|
|
8470
|
-
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
|
|
8480
|
+
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()) {
|
|
8471
8481
|
const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
|
|
8472
8482
|
nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
|
|
8473
8483
|
detachedStageAnimates = [];
|
|
@@ -8484,7 +8494,7 @@
|
|
|
8484
8494
|
}
|
|
8485
8495
|
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));
|
|
8486
8496
|
}
|
|
8487
|
-
((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
|
|
8497
|
+
((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);
|
|
8488
8498
|
}
|
|
8489
8499
|
detachStageForRelease() {
|
|
8490
8500
|
var _a, _b, _c;
|
|
@@ -8906,13 +8916,13 @@
|
|
|
8906
8916
|
child.setStage(null, null);
|
|
8907
8917
|
}), this.addUpdateBoundTag();
|
|
8908
8918
|
}
|
|
8909
|
-
setStage(stage, layer
|
|
8919
|
+
setStage(stage, layer) {
|
|
8910
8920
|
var _a, _b, _c, _d, _e, _f;
|
|
8911
8921
|
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,
|
|
8912
8922
|
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;
|
|
8913
|
-
if (this.stage !== stage) return this.stage = stage, this.layer = layer, needsSharedStateTreeSync && (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0
|
|
8923
|
+
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();
|
|
8914
8924
|
const layerChanged = this.layer !== layer;
|
|
8915
|
-
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0
|
|
8925
|
+
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.notifyChildrenSharedStateTreeChanged();
|
|
8916
8926
|
}
|
|
8917
8927
|
addUpdatePositionTag() {
|
|
8918
8928
|
super.addUpdatePositionTag(), this.forEachChildren(g => {
|
|
@@ -8971,26 +8981,17 @@
|
|
|
8971
8981
|
hasSharedStateDefinitions() {
|
|
8972
8982
|
return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
|
|
8973
8983
|
}
|
|
8974
|
-
|
|
8975
|
-
var _a;
|
|
8976
|
-
return this.sharedStateScope ? this.sharedStateScope : void 0 !== inheritedSharedStateScope ? inheritedSharedStateScope : null !== (_a = this.resolveBoundSharedStateScope()) && void 0 !== _a ? _a : null;
|
|
8977
|
-
}
|
|
8978
|
-
notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope) {
|
|
8979
|
-
const childSharedStateScope = this.resolveChildSharedStateScope(inheritedSharedStateScope);
|
|
8984
|
+
notifyChildrenSharedStateTreeChanged() {
|
|
8980
8985
|
this.forEachChildren(item => {
|
|
8981
|
-
this.
|
|
8986
|
+
this.syncChildSharedStateTreeBinding(item);
|
|
8982
8987
|
});
|
|
8983
8988
|
}
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
"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);
|
|
8987
|
-
}
|
|
8988
|
-
syncChildSharedStateTreeBinding(child, inheritedSharedStateScope) {
|
|
8989
|
-
void 0 === inheritedSharedStateScope && (inheritedSharedStateScope = this.resolveChildSharedStateScope()), this.setStageToChild(child, inheritedSharedStateScope);
|
|
8989
|
+
syncChildSharedStateTreeBinding(child) {
|
|
8990
|
+
child.onParentSharedStateTreeChanged(this.stage, this.layer);
|
|
8990
8991
|
}
|
|
8991
|
-
onParentSharedStateTreeChanged(stage, layer
|
|
8992
|
+
onParentSharedStateTreeChanged(stage, layer) {
|
|
8992
8993
|
var _a;
|
|
8993
|
-
this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length)
|
|
8994
|
+
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);
|
|
8994
8995
|
}
|
|
8995
8996
|
}
|
|
8996
8997
|
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
@@ -10869,7 +10870,132 @@
|
|
|
10869
10870
|
cap: 1
|
|
10870
10871
|
}, NOWORK_ANIMATE_ATTR);
|
|
10871
10872
|
|
|
10872
|
-
|
|
10873
|
+
function getPolygonWinding(points) {
|
|
10874
|
+
let signedArea = 0;
|
|
10875
|
+
for (let i = 0; i < points.length; i++) {
|
|
10876
|
+
const current = points[i],
|
|
10877
|
+
next = points[(i + 1) % points.length];
|
|
10878
|
+
signedArea += current.x * next.y - next.x * current.y;
|
|
10879
|
+
}
|
|
10880
|
+
return signedArea > 0 ? 1 : -1;
|
|
10881
|
+
}
|
|
10882
|
+
function offsetPolygonPoints(points, distance, closePath = !0) {
|
|
10883
|
+
var _a;
|
|
10884
|
+
const n = null !== (_a = null == points ? void 0 : points.length) && void 0 !== _a ? _a : 0;
|
|
10885
|
+
if (n < 2 || closePath && n < 3 || !distance) return points;
|
|
10886
|
+
const sign = getPolygonWinding(points),
|
|
10887
|
+
edgeCount = closePath ? n : n - 1,
|
|
10888
|
+
lines = [];
|
|
10889
|
+
for (let i = 0; i < edgeCount; i++) {
|
|
10890
|
+
const cur = points[i],
|
|
10891
|
+
next = points[(i + 1) % n],
|
|
10892
|
+
dx = next.x - cur.x,
|
|
10893
|
+
dy = next.y - cur.y,
|
|
10894
|
+
len = Math.sqrt(dx * dx + dy * dy);
|
|
10895
|
+
if (!len) {
|
|
10896
|
+
lines.push(null);
|
|
10897
|
+
continue;
|
|
10898
|
+
}
|
|
10899
|
+
const offsetX = sign * dy * distance / len,
|
|
10900
|
+
offsetY = -sign * dx * distance / len;
|
|
10901
|
+
lines.push({
|
|
10902
|
+
x: cur.x + offsetX,
|
|
10903
|
+
y: cur.y + offsetY,
|
|
10904
|
+
dx: dx,
|
|
10905
|
+
dy: dy,
|
|
10906
|
+
len: len,
|
|
10907
|
+
offsetX: offsetX,
|
|
10908
|
+
offsetY: offsetY
|
|
10909
|
+
});
|
|
10910
|
+
}
|
|
10911
|
+
const prevLines = new Array(n);
|
|
10912
|
+
let prevLine = null;
|
|
10913
|
+
if (closePath) for (let i = edgeCount - 1; i >= 0; i--) if (lines[i]) {
|
|
10914
|
+
prevLine = lines[i];
|
|
10915
|
+
break;
|
|
10916
|
+
}
|
|
10917
|
+
for (let i = 0; i < n; i++) prevLines[i] = prevLine, i < edgeCount && lines[i] && (prevLine = lines[i]);
|
|
10918
|
+
const nextLines = new Array(n);
|
|
10919
|
+
let nextLine = null;
|
|
10920
|
+
if (closePath) for (let count = 0; count < edgeCount; count++) {
|
|
10921
|
+
const line = lines[(n - 1 + count) % edgeCount];
|
|
10922
|
+
if (line) {
|
|
10923
|
+
nextLine = line;
|
|
10924
|
+
break;
|
|
10925
|
+
}
|
|
10926
|
+
}
|
|
10927
|
+
for (let i = n - 1; i >= 0; i--) i < edgeCount && lines[i] && (nextLine = lines[i]), nextLines[i] = nextLine;
|
|
10928
|
+
const offsetPointByLine = (point, line) => ({
|
|
10929
|
+
x: point.x + line.offsetX,
|
|
10930
|
+
y: point.y + line.offsetY
|
|
10931
|
+
}),
|
|
10932
|
+
result = [];
|
|
10933
|
+
for (let i = 0; i < n; i++) {
|
|
10934
|
+
const prev = prevLines[i],
|
|
10935
|
+
cur = nextLines[i],
|
|
10936
|
+
line = prev || cur;
|
|
10937
|
+
if (!line) {
|
|
10938
|
+
result.push(points[i]);
|
|
10939
|
+
continue;
|
|
10940
|
+
}
|
|
10941
|
+
if (!prev || !cur) {
|
|
10942
|
+
result.push(offsetPointByLine(points[i], line));
|
|
10943
|
+
continue;
|
|
10944
|
+
}
|
|
10945
|
+
const denominator = prev.dx * cur.dy - prev.dy * cur.dx;
|
|
10946
|
+
if (Math.abs(denominator) <= 1e-12 * prev.len * cur.len) {
|
|
10947
|
+
result.push(offsetPointByLine(points[i], cur));
|
|
10948
|
+
continue;
|
|
10949
|
+
}
|
|
10950
|
+
const t = ((cur.x - prev.x) * cur.dy - (cur.y - prev.y) * cur.dx) / denominator,
|
|
10951
|
+
point = {
|
|
10952
|
+
x: prev.x + prev.dx * t,
|
|
10953
|
+
y: prev.y + prev.dy * t
|
|
10954
|
+
};
|
|
10955
|
+
result.push(Number.isFinite(point.x) && Number.isFinite(point.y) ? point : offsetPointByLine(points[i], cur));
|
|
10956
|
+
}
|
|
10957
|
+
return result;
|
|
10958
|
+
}
|
|
10959
|
+
|
|
10960
|
+
const getBoundsScaleMatrix = polygon => {
|
|
10961
|
+
var _a;
|
|
10962
|
+
const globalMatrix = polygon.globalTransMatrix,
|
|
10963
|
+
viewBoxMatrix = null === (_a = polygon.stage) || void 0 === _a ? void 0 : _a.window.getViewBoxTransform();
|
|
10964
|
+
return viewBoxMatrix ? {
|
|
10965
|
+
a: viewBoxMatrix.a * globalMatrix.a + viewBoxMatrix.c * globalMatrix.b,
|
|
10966
|
+
b: viewBoxMatrix.b * globalMatrix.a + viewBoxMatrix.d * globalMatrix.b,
|
|
10967
|
+
c: viewBoxMatrix.a * globalMatrix.c + viewBoxMatrix.c * globalMatrix.d,
|
|
10968
|
+
d: viewBoxMatrix.b * globalMatrix.c + viewBoxMatrix.d * globalMatrix.d
|
|
10969
|
+
} : globalMatrix;
|
|
10970
|
+
};
|
|
10971
|
+
const getPolygonBoundsScale = polygon => getScaledStrokeWithMatrix(getBoundsScaleMatrix(polygon), 1, 1);
|
|
10972
|
+
const updateBoundsOfPolygonOuterBorder = (attribute, polygonTheme, aabbBounds, polygon) => {
|
|
10973
|
+
const {
|
|
10974
|
+
outerBorder: outerBorder,
|
|
10975
|
+
points = polygonTheme.points,
|
|
10976
|
+
closePath = polygonTheme.closePath,
|
|
10977
|
+
shadowBlur = polygonTheme.shadowBlur,
|
|
10978
|
+
keepStrokeScale = polygonTheme.keepStrokeScale
|
|
10979
|
+
} = attribute;
|
|
10980
|
+
if (outerBorder && !1 !== outerBorder.visible) {
|
|
10981
|
+
const defaultOuterBorder = polygonTheme.outerBorder,
|
|
10982
|
+
{
|
|
10983
|
+
distance = defaultOuterBorder.distance,
|
|
10984
|
+
lineWidth = defaultOuterBorder.lineWidth,
|
|
10985
|
+
lineJoin = defaultOuterBorder.lineJoin,
|
|
10986
|
+
strokeBoundsBuffer = defaultOuterBorder.strokeBoundsBuffer
|
|
10987
|
+
} = outerBorder,
|
|
10988
|
+
boundsScale = getPolygonBoundsScale(polygon);
|
|
10989
|
+
let scaledDistance = distance;
|
|
10990
|
+
keepStrokeScale || (scaledDistance *= boundsScale), offsetPolygonPoints(points, scaledDistance, closePath).forEach(point => {
|
|
10991
|
+
aabbBounds.add(point.x, point.y);
|
|
10992
|
+
});
|
|
10993
|
+
boundStroke(aabbBounds, (shadowBlur * boundsScale + lineWidth * (keepStrokeScale ? 1 : boundsScale)) / 2, "miter" === lineJoin, strokeBoundsBuffer);
|
|
10994
|
+
}
|
|
10995
|
+
return aabbBounds;
|
|
10996
|
+
};
|
|
10997
|
+
|
|
10998
|
+
const POLYGON_UPDATE_TAG_KEY = ["points", "cornerRadius", "outerBorder", "keepStrokeScale", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
10873
10999
|
class Polygon extends Graphic {
|
|
10874
11000
|
constructor(params) {
|
|
10875
11001
|
super(params), this.type = "polygon", this.numberType = POLYGON_NUMBER_TYPE;
|
|
@@ -10886,6 +11012,16 @@
|
|
|
10886
11012
|
getGraphicTheme() {
|
|
10887
11013
|
return getTheme(this).polygon;
|
|
10888
11014
|
}
|
|
11015
|
+
tryUpdateAABBBounds() {
|
|
11016
|
+
const {
|
|
11017
|
+
outerBorder: outerBorder
|
|
11018
|
+
} = this.attribute;
|
|
11019
|
+
if (outerBorder && !1 !== outerBorder.visible) {
|
|
11020
|
+
const boundsScale = getPolygonBoundsScale(this);
|
|
11021
|
+
boundsScale !== this._outerBorderBoundsScale && (this._outerBorderBoundsScale = boundsScale, this.addUpdateBoundTag());
|
|
11022
|
+
} else this._outerBorderBoundsScale = void 0;
|
|
11023
|
+
return super.tryUpdateAABBBounds();
|
|
11024
|
+
}
|
|
10889
11025
|
updateAABBBounds(attribute, polygonTheme, aabbBounds) {
|
|
10890
11026
|
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
11027
|
const {
|
|
@@ -10899,7 +11035,7 @@
|
|
|
10899
11035
|
} = attribute;
|
|
10900
11036
|
return points.forEach(p => {
|
|
10901
11037
|
aabbBounds.add(p.x, p.y);
|
|
10902
|
-
}), aabbBounds;
|
|
11038
|
+
}), updateBoundsOfPolygonOuterBorder(attribute, polygonTheme, aabbBounds, this), aabbBounds;
|
|
10903
11039
|
}
|
|
10904
11040
|
_interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes) {
|
|
10905
11041
|
"points" === key && (nextAttributes.points = pointsInterpolation(lastStepVal, nextStepVal, ratio));
|
|
@@ -13144,7 +13280,8 @@
|
|
|
13144
13280
|
const DrawContribution = Symbol.for("DrawContribution");
|
|
13145
13281
|
|
|
13146
13282
|
const DrawItemInterceptor = Symbol.for("DrawItemInterceptor");
|
|
13147
|
-
const
|
|
13283
|
+
const INTERACTIVE_POST_MATRIX = "_interactivePostMatrix",
|
|
13284
|
+
tempDirtyBounds = new vutils.AABBBounds(),
|
|
13148
13285
|
tempBackupDirtyBounds = new vutils.AABBBounds();
|
|
13149
13286
|
class ShadowRootDrawItemInterceptorContribution {
|
|
13150
13287
|
constructor() {
|
|
@@ -13208,12 +13345,23 @@
|
|
|
13208
13345
|
beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
13209
13346
|
return !this.processing && (graphic.baseGraphic ? this.beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) : this.beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params));
|
|
13210
13347
|
}
|
|
13348
|
+
resolveInteractivePostMatrix(graphic, interactiveGraphic) {
|
|
13349
|
+
const parent = graphic.parent;
|
|
13350
|
+
if (!parent) return graphic.attribute.postMatrix;
|
|
13351
|
+
let matrix = interactiveGraphic[INTERACTIVE_POST_MATRIX];
|
|
13352
|
+
matrix || (matrix = new vutils.Matrix(), interactiveGraphic[INTERACTIVE_POST_MATRIX] = matrix);
|
|
13353
|
+
const ancestorMatrix = parent.globalTransMatrix;
|
|
13354
|
+
matrix.setValue(ancestorMatrix.a, ancestorMatrix.b, ancestorMatrix.c, ancestorMatrix.d, ancestorMatrix.e, ancestorMatrix.f);
|
|
13355
|
+
const ownPostMatrix = graphic.attribute.postMatrix;
|
|
13356
|
+
return ownPostMatrix && matrix.multiply(ownPostMatrix.a, ownPostMatrix.b, ownPostMatrix.c, ownPostMatrix.d, ownPostMatrix.e, ownPostMatrix.f), matrix;
|
|
13357
|
+
}
|
|
13211
13358
|
beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params) {
|
|
13212
13359
|
let interactiveGraphic = graphic.interactiveGraphic;
|
|
13213
13360
|
if (graphic.attribute.globalZIndex) {
|
|
13214
13361
|
interactiveGraphic || (interactiveGraphic = graphic.clone(), graphic.interactiveGraphic = interactiveGraphic, interactiveGraphic.baseGraphic = graphic), interactiveGraphic.setAttributes({
|
|
13215
13362
|
globalZIndex: 0,
|
|
13216
|
-
zIndex: graphic.attribute.globalZIndex
|
|
13363
|
+
zIndex: graphic.attribute.globalZIndex,
|
|
13364
|
+
postMatrix: this.resolveInteractivePostMatrix(graphic, interactiveGraphic)
|
|
13217
13365
|
}, !1, {
|
|
13218
13366
|
skipUpdateCallback: !0
|
|
13219
13367
|
}), drawContext.stage.tryInitInteractiveLayer();
|
|
@@ -22808,7 +22956,7 @@
|
|
|
22808
22956
|
release(forceReleaseVRenderComponents = !0) {
|
|
22809
22957
|
forceReleaseVRenderComponents && [...this._components, ...this._regions, ...this._series].forEach(m => {
|
|
22810
22958
|
m.beforeRelease();
|
|
22811
|
-
}), super.release(), this.clear(), [...this._components, ...this._regions, ...this._series].forEach(m => {
|
|
22959
|
+
}), this._event.release(), super.release(), this.clear(), [...this._components, ...this._regions, ...this._series].forEach(m => {
|
|
22812
22960
|
m.release();
|
|
22813
22961
|
}), this._components = this._regions = this._series = [], this._spec = {}, this._dataSet = this._globalScale = this._layoutFunc = null, this._layoutTag = !1, this._idMap.clear();
|
|
22814
22962
|
}
|