@visactor/vchart-extension 2.1.5-alpha.0 → 2.1.5-alpha.1
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 +206 -32
- 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 -2
- 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 -1
- 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 -1
- 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 -2
- 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/histogram-3d/chart.js +1 -1
- package/cjs/charts/histogram-3d/index.js +1 -1
- package/cjs/charts/histogram-3d/interface.js +1 -1
- package/cjs/charts/image-cloud/image-cloud-transformer.js +1 -1
- package/cjs/charts/image-cloud/image-cloud.js +1 -1
- package/cjs/charts/image-cloud/index.js +1 -1
- package/cjs/charts/image-cloud/interface.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 -2
- 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 -1
- 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 -1
- 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 -2
- 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/histogram-3d/chart.js +1 -1
- package/esm/charts/histogram-3d/index.js +1 -1
- package/esm/charts/histogram-3d/interface.js +1 -1
- package/esm/charts/image-cloud/image-cloud-transformer.js +1 -1
- package/esm/charts/image-cloud/image-cloud.js +1 -1
- package/esm/charts/image-cloud/index.js +1 -1
- package/esm/charts/image-cloud/interface.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 +6 -6
package/build/index.js
CHANGED
|
@@ -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
|
}
|
|
@@ -7510,21 +7522,20 @@
|
|
|
7510
7522
|
}), snapshot) : snapshot;
|
|
7511
7523
|
}
|
|
7512
7524
|
buildRemovedStateAnimationAttrs(targetStateAttrs, previousResolvedStatePatch) {
|
|
7513
|
-
|
|
7514
|
-
if (!previousResolvedStatePatch) return extraAttrs;
|
|
7525
|
+
if (!previousResolvedStatePatch) return;
|
|
7515
7526
|
const snapshot = this.buildStaticAttributeSnapshot(),
|
|
7516
|
-
|
|
7527
|
+
extraAttrs = {};
|
|
7517
7528
|
return Object.keys(previousResolvedStatePatch).forEach(key => {
|
|
7518
7529
|
const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetStateAttrs, key);
|
|
7519
7530
|
if (hasTargetAttr && void 0 !== targetStateAttrs[key]) return;
|
|
7520
7531
|
const assignFallbackAttr = value => {
|
|
7521
|
-
|
|
7532
|
+
extraAttrs[key] = void 0 === value ? value : cloneAttributeValue(value);
|
|
7522
7533
|
};
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
}
|
|
7534
|
+
hasTargetAttr ? assignFallbackAttr(targetStateAttrs[key]) : Object.prototype.hasOwnProperty.call(snapshot, key) ? assignFallbackAttr(snapshot[key]) : assignFallbackAttr(void 0);
|
|
7535
|
+
}), {
|
|
7536
|
+
extraAttrs: extraAttrs,
|
|
7537
|
+
stateTransitionTargetAttrs: snapshot
|
|
7538
|
+
};
|
|
7528
7539
|
}
|
|
7529
7540
|
syncObjectToSnapshot(target, snapshot, excludedKeys) {
|
|
7530
7541
|
const delta = new Map();
|
|
@@ -8244,29 +8255,37 @@
|
|
|
8244
8255
|
resolvedStateAttrs: resolvedStateAttrs
|
|
8245
8256
|
} = this.resolveGraphicStateTransition(states, !0),
|
|
8246
8257
|
patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
|
|
8247
|
-
patchChanged
|
|
8258
|
+
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) {
|
|
8259
|
+
this._syncFinalAttributeFromStaticTruth();
|
|
8260
|
+
const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
|
|
8261
|
+
this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
|
|
8262
|
+
} else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
8248
8263
|
type: AttributeUpdateType.STATE
|
|
8249
8264
|
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
8250
8265
|
type: AttributeUpdateType.STATE
|
|
8251
|
-
}), this.emitStateUpdateEvent()
|
|
8266
|
+
}), this.emitStateUpdateEvent();
|
|
8252
8267
|
}
|
|
8253
8268
|
resolveStateAnimateConfig(animateConfig) {
|
|
8254
8269
|
var _a, _b, _c;
|
|
8255
8270
|
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
8271
|
}
|
|
8257
|
-
applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs) {
|
|
8272
|
+
applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs, stateTransitionTargetAttrs) {
|
|
8258
8273
|
const resolvedAnimateConfig = hasAnimation ? this.resolveStateAnimateConfig(animateConfig) : void 0,
|
|
8259
8274
|
transitionOptions = resolvedAnimateConfig ? {
|
|
8260
8275
|
animateConfig: resolvedAnimateConfig,
|
|
8261
8276
|
extraAnimateAttrs: extraAnimateAttrs,
|
|
8262
|
-
|
|
8277
|
+
getStateTransitionDefaultAttribute: this.getStateTransitionDefaultAttribute.bind(this),
|
|
8278
|
+
shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this),
|
|
8279
|
+
stateTransitionTargetAttrs: stateTransitionTargetAttrs
|
|
8263
8280
|
} : void 0;
|
|
8264
8281
|
if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, transitionOptions);
|
|
8265
8282
|
const plan = this.getStateTransitionOrchestrator().analyzeTransition(attrs, hasAnimation, {
|
|
8266
8283
|
noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
|
|
8267
8284
|
animateConfig: resolvedAnimateConfig,
|
|
8268
8285
|
extraAnimateAttrs: extraAnimateAttrs,
|
|
8269
|
-
|
|
8286
|
+
getStateTransitionDefaultAttribute: this.getStateTransitionDefaultAttribute.bind(this),
|
|
8287
|
+
shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this),
|
|
8288
|
+
stateTransitionTargetAttrs: stateTransitionTargetAttrs
|
|
8270
8289
|
});
|
|
8271
8290
|
this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
|
|
8272
8291
|
}
|
|
@@ -8293,11 +8312,15 @@
|
|
|
8293
8312
|
transition = this.resolveClearStatesTransition();
|
|
8294
8313
|
if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
|
|
8295
8314
|
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
|
|
8315
|
+
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) {
|
|
8316
|
+
this._syncFinalAttributeFromStaticTruth();
|
|
8317
|
+
const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
|
|
8318
|
+
this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
|
|
8319
|
+
} else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
8297
8320
|
type: AttributeUpdateType.STATE
|
|
8298
8321
|
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
|
|
8299
8322
|
type: AttributeUpdateType.STATE
|
|
8300
|
-
}), this.emitStateUpdateEvent()
|
|
8323
|
+
}), this.emitStateUpdateEvent();
|
|
8301
8324
|
}
|
|
8302
8325
|
removeState(stateName, hasAnimation) {
|
|
8303
8326
|
const transition = this.resolveRemoveStateTransition(stateName);
|
|
@@ -8338,11 +8361,15 @@
|
|
|
8338
8361
|
effectiveStates: effectiveStates,
|
|
8339
8362
|
resolvedStateAttrs: resolvedStateAttrs
|
|
8340
8363
|
} = this.resolveGraphicStateTransition(states);
|
|
8341
|
-
|
|
8364
|
+
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) {
|
|
8365
|
+
this._syncFinalAttributeFromStaticTruth();
|
|
8366
|
+
const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
|
|
8367
|
+
this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
|
|
8368
|
+
} else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
8342
8369
|
type: AttributeUpdateType.STATE
|
|
8343
8370
|
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
8344
8371
|
type: AttributeUpdateType.STATE
|
|
8345
|
-
}), this.emitStateUpdateEvent()
|
|
8372
|
+
}), this.emitStateUpdateEvent();
|
|
8346
8373
|
}
|
|
8347
8374
|
invalidateResolver() {
|
|
8348
8375
|
var _a, _b;
|
|
@@ -10342,7 +10369,7 @@
|
|
|
10342
10369
|
}
|
|
10343
10370
|
|
|
10344
10371
|
var _a;
|
|
10345
|
-
const factoryRegistryKey = Symbol.for("@visactor/vchart/factory-registry@2.1.
|
|
10372
|
+
const factoryRegistryKey = Symbol.for("@visactor/vchart/factory-registry@2.1.5"),
|
|
10346
10373
|
globalFactoryRegistry = globalThis;
|
|
10347
10374
|
const factoryRegistry = null !== (_a = globalFactoryRegistry[factoryRegistryKey]) && void 0 !== _a ? _a : globalFactoryRegistry[factoryRegistryKey] = {
|
|
10348
10375
|
charts: {},
|
|
@@ -10869,7 +10896,132 @@
|
|
|
10869
10896
|
cap: 1
|
|
10870
10897
|
}, NOWORK_ANIMATE_ATTR);
|
|
10871
10898
|
|
|
10872
|
-
|
|
10899
|
+
function getPolygonWinding(points) {
|
|
10900
|
+
let signedArea = 0;
|
|
10901
|
+
for (let i = 0; i < points.length; i++) {
|
|
10902
|
+
const current = points[i],
|
|
10903
|
+
next = points[(i + 1) % points.length];
|
|
10904
|
+
signedArea += current.x * next.y - next.x * current.y;
|
|
10905
|
+
}
|
|
10906
|
+
return signedArea > 0 ? 1 : -1;
|
|
10907
|
+
}
|
|
10908
|
+
function offsetPolygonPoints(points, distance, closePath = !0) {
|
|
10909
|
+
var _a;
|
|
10910
|
+
const n = null !== (_a = null == points ? void 0 : points.length) && void 0 !== _a ? _a : 0;
|
|
10911
|
+
if (n < 2 || closePath && n < 3 || !distance) return points;
|
|
10912
|
+
const sign = getPolygonWinding(points),
|
|
10913
|
+
edgeCount = closePath ? n : n - 1,
|
|
10914
|
+
lines = [];
|
|
10915
|
+
for (let i = 0; i < edgeCount; i++) {
|
|
10916
|
+
const cur = points[i],
|
|
10917
|
+
next = points[(i + 1) % n],
|
|
10918
|
+
dx = next.x - cur.x,
|
|
10919
|
+
dy = next.y - cur.y,
|
|
10920
|
+
len = Math.sqrt(dx * dx + dy * dy);
|
|
10921
|
+
if (!len) {
|
|
10922
|
+
lines.push(null);
|
|
10923
|
+
continue;
|
|
10924
|
+
}
|
|
10925
|
+
const offsetX = sign * dy * distance / len,
|
|
10926
|
+
offsetY = -sign * dx * distance / len;
|
|
10927
|
+
lines.push({
|
|
10928
|
+
x: cur.x + offsetX,
|
|
10929
|
+
y: cur.y + offsetY,
|
|
10930
|
+
dx: dx,
|
|
10931
|
+
dy: dy,
|
|
10932
|
+
len: len,
|
|
10933
|
+
offsetX: offsetX,
|
|
10934
|
+
offsetY: offsetY
|
|
10935
|
+
});
|
|
10936
|
+
}
|
|
10937
|
+
const prevLines = new Array(n);
|
|
10938
|
+
let prevLine = null;
|
|
10939
|
+
if (closePath) for (let i = edgeCount - 1; i >= 0; i--) if (lines[i]) {
|
|
10940
|
+
prevLine = lines[i];
|
|
10941
|
+
break;
|
|
10942
|
+
}
|
|
10943
|
+
for (let i = 0; i < n; i++) prevLines[i] = prevLine, i < edgeCount && lines[i] && (prevLine = lines[i]);
|
|
10944
|
+
const nextLines = new Array(n);
|
|
10945
|
+
let nextLine = null;
|
|
10946
|
+
if (closePath) for (let count = 0; count < edgeCount; count++) {
|
|
10947
|
+
const line = lines[(n - 1 + count) % edgeCount];
|
|
10948
|
+
if (line) {
|
|
10949
|
+
nextLine = line;
|
|
10950
|
+
break;
|
|
10951
|
+
}
|
|
10952
|
+
}
|
|
10953
|
+
for (let i = n - 1; i >= 0; i--) i < edgeCount && lines[i] && (nextLine = lines[i]), nextLines[i] = nextLine;
|
|
10954
|
+
const offsetPointByLine = (point, line) => ({
|
|
10955
|
+
x: point.x + line.offsetX,
|
|
10956
|
+
y: point.y + line.offsetY
|
|
10957
|
+
}),
|
|
10958
|
+
result = [];
|
|
10959
|
+
for (let i = 0; i < n; i++) {
|
|
10960
|
+
const prev = prevLines[i],
|
|
10961
|
+
cur = nextLines[i],
|
|
10962
|
+
line = prev || cur;
|
|
10963
|
+
if (!line) {
|
|
10964
|
+
result.push(points[i]);
|
|
10965
|
+
continue;
|
|
10966
|
+
}
|
|
10967
|
+
if (!prev || !cur) {
|
|
10968
|
+
result.push(offsetPointByLine(points[i], line));
|
|
10969
|
+
continue;
|
|
10970
|
+
}
|
|
10971
|
+
const denominator = prev.dx * cur.dy - prev.dy * cur.dx;
|
|
10972
|
+
if (Math.abs(denominator) <= 1e-12 * prev.len * cur.len) {
|
|
10973
|
+
result.push(offsetPointByLine(points[i], cur));
|
|
10974
|
+
continue;
|
|
10975
|
+
}
|
|
10976
|
+
const t = ((cur.x - prev.x) * cur.dy - (cur.y - prev.y) * cur.dx) / denominator,
|
|
10977
|
+
point = {
|
|
10978
|
+
x: prev.x + prev.dx * t,
|
|
10979
|
+
y: prev.y + prev.dy * t
|
|
10980
|
+
};
|
|
10981
|
+
result.push(Number.isFinite(point.x) && Number.isFinite(point.y) ? point : offsetPointByLine(points[i], cur));
|
|
10982
|
+
}
|
|
10983
|
+
return result;
|
|
10984
|
+
}
|
|
10985
|
+
|
|
10986
|
+
const getBoundsScaleMatrix = polygon => {
|
|
10987
|
+
var _a;
|
|
10988
|
+
const globalMatrix = polygon.globalTransMatrix,
|
|
10989
|
+
viewBoxMatrix = null === (_a = polygon.stage) || void 0 === _a ? void 0 : _a.window.getViewBoxTransform();
|
|
10990
|
+
return viewBoxMatrix ? {
|
|
10991
|
+
a: viewBoxMatrix.a * globalMatrix.a + viewBoxMatrix.c * globalMatrix.b,
|
|
10992
|
+
b: viewBoxMatrix.b * globalMatrix.a + viewBoxMatrix.d * globalMatrix.b,
|
|
10993
|
+
c: viewBoxMatrix.a * globalMatrix.c + viewBoxMatrix.c * globalMatrix.d,
|
|
10994
|
+
d: viewBoxMatrix.b * globalMatrix.c + viewBoxMatrix.d * globalMatrix.d
|
|
10995
|
+
} : globalMatrix;
|
|
10996
|
+
};
|
|
10997
|
+
const getPolygonBoundsScale = polygon => getScaledStrokeWithMatrix(getBoundsScaleMatrix(polygon), 1, 1);
|
|
10998
|
+
const updateBoundsOfPolygonOuterBorder = (attribute, polygonTheme, aabbBounds, polygon) => {
|
|
10999
|
+
const {
|
|
11000
|
+
outerBorder: outerBorder,
|
|
11001
|
+
points = polygonTheme.points,
|
|
11002
|
+
closePath = polygonTheme.closePath,
|
|
11003
|
+
shadowBlur = polygonTheme.shadowBlur,
|
|
11004
|
+
keepStrokeScale = polygonTheme.keepStrokeScale
|
|
11005
|
+
} = attribute;
|
|
11006
|
+
if (outerBorder && !1 !== outerBorder.visible) {
|
|
11007
|
+
const defaultOuterBorder = polygonTheme.outerBorder,
|
|
11008
|
+
{
|
|
11009
|
+
distance = defaultOuterBorder.distance,
|
|
11010
|
+
lineWidth = defaultOuterBorder.lineWidth,
|
|
11011
|
+
lineJoin = defaultOuterBorder.lineJoin,
|
|
11012
|
+
strokeBoundsBuffer = defaultOuterBorder.strokeBoundsBuffer
|
|
11013
|
+
} = outerBorder,
|
|
11014
|
+
boundsScale = getPolygonBoundsScale(polygon);
|
|
11015
|
+
let scaledDistance = distance;
|
|
11016
|
+
keepStrokeScale || (scaledDistance *= boundsScale), offsetPolygonPoints(points, scaledDistance, closePath).forEach(point => {
|
|
11017
|
+
aabbBounds.add(point.x, point.y);
|
|
11018
|
+
});
|
|
11019
|
+
boundStroke(aabbBounds, (shadowBlur * boundsScale + lineWidth * (keepStrokeScale ? 1 : boundsScale)) / 2, "miter" === lineJoin, strokeBoundsBuffer);
|
|
11020
|
+
}
|
|
11021
|
+
return aabbBounds;
|
|
11022
|
+
};
|
|
11023
|
+
|
|
11024
|
+
const POLYGON_UPDATE_TAG_KEY = ["points", "cornerRadius", "outerBorder", "keepStrokeScale", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
10873
11025
|
class Polygon extends Graphic {
|
|
10874
11026
|
constructor(params) {
|
|
10875
11027
|
super(params), this.type = "polygon", this.numberType = POLYGON_NUMBER_TYPE;
|
|
@@ -10886,6 +11038,16 @@
|
|
|
10886
11038
|
getGraphicTheme() {
|
|
10887
11039
|
return getTheme(this).polygon;
|
|
10888
11040
|
}
|
|
11041
|
+
tryUpdateAABBBounds() {
|
|
11042
|
+
const {
|
|
11043
|
+
outerBorder: outerBorder
|
|
11044
|
+
} = this.attribute;
|
|
11045
|
+
if (outerBorder && !1 !== outerBorder.visible) {
|
|
11046
|
+
const boundsScale = getPolygonBoundsScale(this);
|
|
11047
|
+
boundsScale !== this._outerBorderBoundsScale && (this._outerBorderBoundsScale = boundsScale, this.addUpdateBoundTag());
|
|
11048
|
+
} else this._outerBorderBoundsScale = void 0;
|
|
11049
|
+
return super.tryUpdateAABBBounds();
|
|
11050
|
+
}
|
|
10889
11051
|
updateAABBBounds(attribute, polygonTheme, aabbBounds) {
|
|
10890
11052
|
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
11053
|
const {
|
|
@@ -10899,7 +11061,7 @@
|
|
|
10899
11061
|
} = attribute;
|
|
10900
11062
|
return points.forEach(p => {
|
|
10901
11063
|
aabbBounds.add(p.x, p.y);
|
|
10902
|
-
}), aabbBounds;
|
|
11064
|
+
}), updateBoundsOfPolygonOuterBorder(attribute, polygonTheme, aabbBounds, this), aabbBounds;
|
|
10903
11065
|
}
|
|
10904
11066
|
_interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes) {
|
|
10905
11067
|
"points" === key && (nextAttributes.points = pointsInterpolation(lastStepVal, nextStepVal, ratio));
|
|
@@ -13144,7 +13306,8 @@
|
|
|
13144
13306
|
const DrawContribution = Symbol.for("DrawContribution");
|
|
13145
13307
|
|
|
13146
13308
|
const DrawItemInterceptor = Symbol.for("DrawItemInterceptor");
|
|
13147
|
-
const
|
|
13309
|
+
const INTERACTIVE_POST_MATRIX = "_interactivePostMatrix",
|
|
13310
|
+
tempDirtyBounds = new vutils.AABBBounds(),
|
|
13148
13311
|
tempBackupDirtyBounds = new vutils.AABBBounds();
|
|
13149
13312
|
class ShadowRootDrawItemInterceptorContribution {
|
|
13150
13313
|
constructor() {
|
|
@@ -13208,12 +13371,23 @@
|
|
|
13208
13371
|
beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
13209
13372
|
return !this.processing && (graphic.baseGraphic ? this.beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) : this.beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params));
|
|
13210
13373
|
}
|
|
13374
|
+
resolveInteractivePostMatrix(graphic, interactiveGraphic) {
|
|
13375
|
+
const parent = graphic.parent;
|
|
13376
|
+
if (!parent) return graphic.attribute.postMatrix;
|
|
13377
|
+
let matrix = interactiveGraphic[INTERACTIVE_POST_MATRIX];
|
|
13378
|
+
matrix || (matrix = new vutils.Matrix(), interactiveGraphic[INTERACTIVE_POST_MATRIX] = matrix);
|
|
13379
|
+
const ancestorMatrix = parent.globalTransMatrix;
|
|
13380
|
+
matrix.setValue(ancestorMatrix.a, ancestorMatrix.b, ancestorMatrix.c, ancestorMatrix.d, ancestorMatrix.e, ancestorMatrix.f);
|
|
13381
|
+
const ownPostMatrix = graphic.attribute.postMatrix;
|
|
13382
|
+
return ownPostMatrix && matrix.multiply(ownPostMatrix.a, ownPostMatrix.b, ownPostMatrix.c, ownPostMatrix.d, ownPostMatrix.e, ownPostMatrix.f), matrix;
|
|
13383
|
+
}
|
|
13211
13384
|
beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params) {
|
|
13212
13385
|
let interactiveGraphic = graphic.interactiveGraphic;
|
|
13213
13386
|
if (graphic.attribute.globalZIndex) {
|
|
13214
13387
|
interactiveGraphic || (interactiveGraphic = graphic.clone(), graphic.interactiveGraphic = interactiveGraphic, interactiveGraphic.baseGraphic = graphic), interactiveGraphic.setAttributes({
|
|
13215
13388
|
globalZIndex: 0,
|
|
13216
|
-
zIndex: graphic.attribute.globalZIndex
|
|
13389
|
+
zIndex: graphic.attribute.globalZIndex,
|
|
13390
|
+
postMatrix: this.resolveInteractivePostMatrix(graphic, interactiveGraphic)
|
|
13217
13391
|
}, !1, {
|
|
13218
13392
|
skipUpdateCallback: !0
|
|
13219
13393
|
}), drawContext.stage.tryInitInteractiveLayer();
|
|
@@ -22808,7 +22982,7 @@
|
|
|
22808
22982
|
release(forceReleaseVRenderComponents = !0) {
|
|
22809
22983
|
forceReleaseVRenderComponents && [...this._components, ...this._regions, ...this._series].forEach(m => {
|
|
22810
22984
|
m.beforeRelease();
|
|
22811
|
-
}), super.release(), this.clear(), [...this._components, ...this._regions, ...this._series].forEach(m => {
|
|
22985
|
+
}), this._event.release(), super.release(), this.clear(), [...this._components, ...this._regions, ...this._series].forEach(m => {
|
|
22812
22986
|
m.release();
|
|
22813
22987
|
}), this._components = this._regions = this._series = [], this._spec = {}, this._dataSet = this._globalScale = this._layoutFunc = null, this._layoutTag = !1, this._idMap.clear();
|
|
22814
22988
|
}
|