@visactor/vrender-components 1.1.6-alpha.0 → 1.1.7
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/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/legend/discrete/discrete.d.ts +0 -1
- package/cjs/legend/discrete/discrete.js +15 -30
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/dist/index.es.js +401 -191
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/legend/discrete/discrete.d.ts +0 -1
- package/es/legend/discrete/discrete.js +13 -29
- package/es/legend/discrete/discrete.js.map +1 -1
- package/package.json +5 -5
package/dist/index.es.js
CHANGED
|
@@ -208,7 +208,7 @@ class Node extends EventEmitter {
|
|
|
208
208
|
constructor() {
|
|
209
209
|
super(), this._uid = Generator.GenAutoIncrementId(), this._firstChild = null, this._lastChild = null, this.parent = null, this._count = 1;
|
|
210
210
|
}
|
|
211
|
-
onParentSharedStateTreeChanged(_stage, _layer
|
|
211
|
+
onParentSharedStateTreeChanged(_stage, _layer) {}
|
|
212
212
|
forEachChildren(cb, reverse = !1) {
|
|
213
213
|
if (reverse) {
|
|
214
214
|
let child = this._lastChild,
|
|
@@ -3781,18 +3781,21 @@ class GradientParser {
|
|
|
3781
3781
|
}
|
|
3782
3782
|
}
|
|
3783
3783
|
|
|
3784
|
-
function
|
|
3784
|
+
function getScaledStrokeWithMatrix(matrix, width, dpr) {
|
|
3785
3785
|
let strokeWidth = width;
|
|
3786
3786
|
const {
|
|
3787
3787
|
a: a,
|
|
3788
3788
|
b: b,
|
|
3789
3789
|
c: c,
|
|
3790
3790
|
d: d
|
|
3791
|
-
} =
|
|
3791
|
+
} = matrix,
|
|
3792
3792
|
scaleX = Math.sign(a) * Math.sqrt(a * a + b * b),
|
|
3793
3793
|
scaleY = Math.sign(d) * Math.sqrt(c * c + d * d);
|
|
3794
3794
|
return scaleX + scaleY === 0 ? 0 : (strokeWidth = strokeWidth / Math.abs(scaleX + scaleY) * 2 * dpr, strokeWidth);
|
|
3795
3795
|
}
|
|
3796
|
+
function getScaledStroke(context, width, dpr) {
|
|
3797
|
+
return getScaledStrokeWithMatrix(context.currentMatrix, width, dpr);
|
|
3798
|
+
}
|
|
3796
3799
|
function createColor(context, c, params, offsetX = 0, offsetY = 0) {
|
|
3797
3800
|
var _a, _b, _c, _d;
|
|
3798
3801
|
if (!c || !0 === c) return "black";
|
|
@@ -4624,7 +4627,7 @@ function normalizeNoAnimateAttrConfig(config) {
|
|
|
4624
4627
|
}
|
|
4625
4628
|
class StateTransitionOrchestrator {
|
|
4626
4629
|
analyzeTransition(targetAttrs, hasAnimation, options = {}) {
|
|
4627
|
-
var _a, _b;
|
|
4630
|
+
var _a, _b, _c, _d;
|
|
4628
4631
|
const plan = {
|
|
4629
4632
|
targetAttrs: Object.assign({}, targetAttrs),
|
|
4630
4633
|
animateAttrs: {},
|
|
@@ -4633,10 +4636,17 @@ class StateTransitionOrchestrator {
|
|
|
4633
4636
|
if (!hasAnimation) return plan;
|
|
4634
4637
|
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)),
|
|
4635
4638
|
isClear = !0 === options.isClear,
|
|
4636
|
-
|
|
4639
|
+
getDefaultAttribute = options.getDefaultAttribute,
|
|
4640
|
+
readDefaultAttribute = getDefaultAttribute,
|
|
4641
|
+
readStateTransitionDefaultAttribute = null !== (_c = options.getStateTransitionDefaultAttribute) && void 0 !== _c ? _c : getDefaultAttribute,
|
|
4637
4642
|
shouldSkipDefaultAttribute = options.shouldSkipDefaultAttribute,
|
|
4638
|
-
|
|
4639
|
-
|
|
4643
|
+
stateTransitionTargetAttrs = null !== (_d = options.stateTransitionTargetAttrs) && void 0 !== _d ? _d : targetAttrs,
|
|
4644
|
+
assignTransitionAttr = (key, value, isRemovedStateAttr = !1) => {
|
|
4645
|
+
if (noWorkAnimateAttr[key]) plan.noAnimateAttrs[key] = value;else if (isRemovedStateAttr && void 0 === value) {
|
|
4646
|
+
const defaultValue = null == readStateTransitionDefaultAttribute ? void 0 : readStateTransitionDefaultAttribute(key, stateTransitionTargetAttrs);
|
|
4647
|
+
if (void 0 === defaultValue && (null == shouldSkipDefaultAttribute ? void 0 : shouldSkipDefaultAttribute(key, stateTransitionTargetAttrs))) return;
|
|
4648
|
+
plan.animateAttrs[key] = defaultValue;
|
|
4649
|
+
} else if (isClear && void 0 === value) {
|
|
4640
4650
|
if (null == shouldSkipDefaultAttribute ? void 0 : shouldSkipDefaultAttribute(key, targetAttrs)) return;
|
|
4641
4651
|
plan.animateAttrs[key] = readDefaultAttribute(key);
|
|
4642
4652
|
} else plan.animateAttrs[key] = value;
|
|
@@ -4648,7 +4658,7 @@ class StateTransitionOrchestrator {
|
|
|
4648
4658
|
const extraAnimateAttrs = options.extraAnimateAttrs;
|
|
4649
4659
|
if (extraAnimateAttrs) for (const key in extraAnimateAttrs) {
|
|
4650
4660
|
const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetAttrs, key);
|
|
4651
|
-
!Object.prototype.hasOwnProperty.call(extraAnimateAttrs, key) || hasTargetAttr && void 0 !== targetAttrs[key] || assignTransitionAttr(key, extraAnimateAttrs[key]);
|
|
4661
|
+
!Object.prototype.hasOwnProperty.call(extraAnimateAttrs, key) || hasTargetAttr && void 0 !== targetAttrs[key] || assignTransitionAttr(key, extraAnimateAttrs[key], !0);
|
|
4652
4662
|
}
|
|
4653
4663
|
return plan;
|
|
4654
4664
|
}
|
|
@@ -4680,9 +4690,11 @@ class StateTransitionOrchestrator {
|
|
|
4680
4690
|
noWorkAnimateAttr: graphic.getNoWorkAnimateAttr(),
|
|
4681
4691
|
isClear: !0,
|
|
4682
4692
|
getDefaultAttribute: graphic.getDefaultAttribute.bind(graphic),
|
|
4693
|
+
getStateTransitionDefaultAttribute: options.getStateTransitionDefaultAttribute,
|
|
4683
4694
|
shouldSkipDefaultAttribute: null !== (_a = options.shouldSkipDefaultAttribute) && void 0 !== _a ? _a : graphic.shouldSkipStateTransitionDefaultAttribute.bind(graphic),
|
|
4684
4695
|
animateConfig: options.animateConfig,
|
|
4685
|
-
extraAnimateAttrs: options.extraAnimateAttrs
|
|
4696
|
+
extraAnimateAttrs: options.extraAnimateAttrs,
|
|
4697
|
+
stateTransitionTargetAttrs: options.stateTransitionTargetAttrs
|
|
4686
4698
|
});
|
|
4687
4699
|
return this.applyTransition(graphic, plan, hasAnimation, options);
|
|
4688
4700
|
}
|
|
@@ -4875,17 +4887,14 @@ class GraphicImpl extends Node {
|
|
|
4875
4887
|
}
|
|
4876
4888
|
return null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope;
|
|
4877
4889
|
}
|
|
4878
|
-
|
|
4890
|
+
syncSharedStateScopeBindingFromTree(markDirty = !0) {
|
|
4879
4891
|
var _a;
|
|
4892
|
+
const nextScope = this.resolveBoundSharedStateScope();
|
|
4880
4893
|
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);
|
|
4881
4894
|
}
|
|
4882
|
-
|
|
4883
|
-
const nextScope = void 0 === inheritedSharedStateScope ? this.resolveBoundSharedStateScope() : null != inheritedSharedStateScope ? inheritedSharedStateScope : void 0;
|
|
4884
|
-
return this.syncSharedStateScopeBinding(nextScope, markDirty);
|
|
4885
|
-
}
|
|
4886
|
-
syncSharedStateScopeBindingOnTreeChange(markDirty = !0, inheritedSharedStateScope) {
|
|
4895
|
+
syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
|
|
4887
4896
|
var _a, _b;
|
|
4888
|
-
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
|
|
4897
|
+
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);
|
|
4889
4898
|
}
|
|
4890
4899
|
syncSharedStateActiveRegistrations() {
|
|
4891
4900
|
var _a;
|
|
@@ -4893,7 +4902,6 @@ class GraphicImpl extends Node {
|
|
|
4893
4902
|
if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
|
|
4894
4903
|
scope.subtreeActiveDescendants.delete(this);
|
|
4895
4904
|
}), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
|
|
4896
|
-
if ((null == previousScopes ? void 0 : previousScopes.size) && this.isSharedStateScopeChainRegistered(previousScopes)) return;
|
|
4897
4905
|
const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
|
|
4898
4906
|
null == previousScopes || previousScopes.forEach(scope => {
|
|
4899
4907
|
nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
|
|
@@ -4901,15 +4909,6 @@ class GraphicImpl extends Node {
|
|
|
4901
4909
|
scope.subtreeActiveDescendants.add(this);
|
|
4902
4910
|
}), this.registeredActiveScopes = nextScopes;
|
|
4903
4911
|
}
|
|
4904
|
-
isSharedStateScopeChainRegistered(previousScopes) {
|
|
4905
|
-
let scope = this.boundSharedStateScope,
|
|
4906
|
-
scopeCount = 0;
|
|
4907
|
-
for (; scope;) {
|
|
4908
|
-
if (!previousScopes.has(scope)) return !1;
|
|
4909
|
-
scopeCount += 1, scope = scope.parentScope;
|
|
4910
|
-
}
|
|
4911
|
-
return scopeCount === previousScopes.size;
|
|
4912
|
-
}
|
|
4913
4912
|
clearSharedStateActiveRegistrations() {
|
|
4914
4913
|
const previousScopes = this.registeredActiveScopes;
|
|
4915
4914
|
previousScopes && (previousScopes.forEach(scope => {
|
|
@@ -4919,8 +4918,8 @@ class GraphicImpl extends Node {
|
|
|
4919
4918
|
markSharedStateDirty() {
|
|
4920
4919
|
this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
|
|
4921
4920
|
}
|
|
4922
|
-
onParentSharedStateTreeChanged(stage, layer
|
|
4923
|
-
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange(
|
|
4921
|
+
onParentSharedStateTreeChanged(stage, layer) {
|
|
4922
|
+
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
|
|
4924
4923
|
}
|
|
4925
4924
|
refreshSharedStateBeforeRender() {
|
|
4926
4925
|
var _a;
|
|
@@ -4970,21 +4969,20 @@ class GraphicImpl extends Node {
|
|
|
4970
4969
|
}), snapshot) : snapshot;
|
|
4971
4970
|
}
|
|
4972
4971
|
buildRemovedStateAnimationAttrs(targetStateAttrs, previousResolvedStatePatch) {
|
|
4973
|
-
|
|
4974
|
-
if (!previousResolvedStatePatch) return extraAttrs;
|
|
4972
|
+
if (!previousResolvedStatePatch) return;
|
|
4975
4973
|
const snapshot = this.buildStaticAttributeSnapshot(),
|
|
4976
|
-
|
|
4974
|
+
extraAttrs = {};
|
|
4977
4975
|
return Object.keys(previousResolvedStatePatch).forEach(key => {
|
|
4978
4976
|
const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetStateAttrs, key);
|
|
4979
4977
|
if (hasTargetAttr && void 0 !== targetStateAttrs[key]) return;
|
|
4980
4978
|
const assignFallbackAttr = value => {
|
|
4981
|
-
|
|
4979
|
+
extraAttrs[key] = void 0 === value ? value : cloneAttributeValue(value);
|
|
4982
4980
|
};
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
}
|
|
4981
|
+
hasTargetAttr ? assignFallbackAttr(targetStateAttrs[key]) : Object.prototype.hasOwnProperty.call(snapshot, key) ? assignFallbackAttr(snapshot[key]) : assignFallbackAttr(void 0);
|
|
4982
|
+
}), {
|
|
4983
|
+
extraAttrs: extraAttrs,
|
|
4984
|
+
stateTransitionTargetAttrs: snapshot
|
|
4985
|
+
};
|
|
4988
4986
|
}
|
|
4989
4987
|
syncObjectToSnapshot(target, snapshot, excludedKeys) {
|
|
4990
4988
|
const delta = new Map();
|
|
@@ -5571,10 +5569,6 @@ class GraphicImpl extends Node {
|
|
|
5571
5569
|
var _a;
|
|
5572
5570
|
return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
|
|
5573
5571
|
}
|
|
5574
|
-
setStateDefinitionsWithCompiled(definitions, compiledDefinitions) {
|
|
5575
|
-
var _a;
|
|
5576
|
-
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}`;
|
|
5577
|
-
}
|
|
5578
5572
|
getStateResolveBaseAttrs() {
|
|
5579
5573
|
var _a;
|
|
5580
5574
|
return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
|
|
@@ -5704,29 +5698,37 @@ class GraphicImpl extends Node {
|
|
|
5704
5698
|
resolvedStateAttrs: resolvedStateAttrs
|
|
5705
5699
|
} = this.resolveGraphicStateTransition(states, !0),
|
|
5706
5700
|
patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
|
|
5707
|
-
patchChanged
|
|
5701
|
+
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) {
|
|
5702
|
+
this._syncFinalAttributeFromStaticTruth();
|
|
5703
|
+
const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
|
|
5704
|
+
this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
|
|
5705
|
+
} else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
5708
5706
|
type: AttributeUpdateType.STATE
|
|
5709
5707
|
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
5710
5708
|
type: AttributeUpdateType.STATE
|
|
5711
|
-
}), this.emitStateUpdateEvent()
|
|
5709
|
+
}), this.emitStateUpdateEvent();
|
|
5712
5710
|
}
|
|
5713
5711
|
resolveStateAnimateConfig(animateConfig) {
|
|
5714
5712
|
var _a, _b, _c;
|
|
5715
5713
|
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;
|
|
5716
5714
|
}
|
|
5717
|
-
applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs) {
|
|
5715
|
+
applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs, stateTransitionTargetAttrs) {
|
|
5718
5716
|
const resolvedAnimateConfig = hasAnimation ? this.resolveStateAnimateConfig(animateConfig) : void 0,
|
|
5719
5717
|
transitionOptions = resolvedAnimateConfig ? {
|
|
5720
5718
|
animateConfig: resolvedAnimateConfig,
|
|
5721
5719
|
extraAnimateAttrs: extraAnimateAttrs,
|
|
5722
|
-
|
|
5720
|
+
getStateTransitionDefaultAttribute: this.getStateTransitionDefaultAttribute.bind(this),
|
|
5721
|
+
shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this),
|
|
5722
|
+
stateTransitionTargetAttrs: stateTransitionTargetAttrs
|
|
5723
5723
|
} : void 0;
|
|
5724
5724
|
if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, transitionOptions);
|
|
5725
5725
|
const plan = this.getStateTransitionOrchestrator().analyzeTransition(attrs, hasAnimation, {
|
|
5726
5726
|
noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
|
|
5727
5727
|
animateConfig: resolvedAnimateConfig,
|
|
5728
5728
|
extraAnimateAttrs: extraAnimateAttrs,
|
|
5729
|
-
|
|
5729
|
+
getStateTransitionDefaultAttribute: this.getStateTransitionDefaultAttribute.bind(this),
|
|
5730
|
+
shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this),
|
|
5731
|
+
stateTransitionTargetAttrs: stateTransitionTargetAttrs
|
|
5730
5732
|
});
|
|
5731
5733
|
this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
|
|
5732
5734
|
}
|
|
@@ -5753,11 +5755,15 @@ class GraphicImpl extends Node {
|
|
|
5753
5755
|
transition = this.resolveClearStatesTransition();
|
|
5754
5756
|
if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
|
|
5755
5757
|
const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
|
|
5756
|
-
transition.changed
|
|
5758
|
+
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) {
|
|
5759
|
+
this._syncFinalAttributeFromStaticTruth();
|
|
5760
|
+
const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
|
|
5761
|
+
this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
|
|
5762
|
+
} else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
5757
5763
|
type: AttributeUpdateType.STATE
|
|
5758
5764
|
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
|
|
5759
5765
|
type: AttributeUpdateType.STATE
|
|
5760
|
-
}), this.emitStateUpdateEvent()
|
|
5766
|
+
}), this.emitStateUpdateEvent();
|
|
5761
5767
|
}
|
|
5762
5768
|
removeState(stateName, hasAnimation) {
|
|
5763
5769
|
const transition = this.resolveRemoveStateTransition(stateName);
|
|
@@ -5798,11 +5804,15 @@ class GraphicImpl extends Node {
|
|
|
5798
5804
|
effectiveStates: effectiveStates,
|
|
5799
5805
|
resolvedStateAttrs: resolvedStateAttrs
|
|
5800
5806
|
} = this.resolveGraphicStateTransition(states);
|
|
5801
|
-
|
|
5807
|
+
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) {
|
|
5808
|
+
this._syncFinalAttributeFromStaticTruth();
|
|
5809
|
+
const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
|
|
5810
|
+
this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
|
|
5811
|
+
} else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
5802
5812
|
type: AttributeUpdateType.STATE
|
|
5803
5813
|
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
5804
5814
|
type: AttributeUpdateType.STATE
|
|
5805
|
-
}), this.emitStateUpdateEvent()
|
|
5815
|
+
}), this.emitStateUpdateEvent();
|
|
5806
5816
|
}
|
|
5807
5817
|
invalidateResolver() {
|
|
5808
5818
|
var _a, _b;
|
|
@@ -5922,12 +5932,12 @@ class GraphicImpl extends Node {
|
|
|
5922
5932
|
this._globalTransMatrix.translate(scrollX, scrollY);
|
|
5923
5933
|
}
|
|
5924
5934
|
}
|
|
5925
|
-
setStage(stage, layer
|
|
5935
|
+
setStage(stage, layer) {
|
|
5926
5936
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
5927
5937
|
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,
|
|
5928
5938
|
previousStage = this.stage;
|
|
5929
5939
|
if (this.stage !== stage || this.layer !== layer) {
|
|
5930
|
-
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
|
|
5940
|
+
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()) {
|
|
5931
5941
|
const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
|
|
5932
5942
|
nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
|
|
5933
5943
|
detachedStageAnimates = [];
|
|
@@ -5944,7 +5954,7 @@ class GraphicImpl extends Node {
|
|
|
5944
5954
|
}
|
|
5945
5955
|
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));
|
|
5946
5956
|
}
|
|
5947
|
-
((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
|
|
5957
|
+
((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);
|
|
5948
5958
|
}
|
|
5949
5959
|
detachStageForRelease() {
|
|
5950
5960
|
var _a, _b, _c;
|
|
@@ -6366,13 +6376,13 @@ class Group extends Graphic {
|
|
|
6366
6376
|
child.setStage(null, null);
|
|
6367
6377
|
}), this.addUpdateBoundTag();
|
|
6368
6378
|
}
|
|
6369
|
-
setStage(stage, layer
|
|
6379
|
+
setStage(stage, layer) {
|
|
6370
6380
|
var _a, _b, _c, _d, _e, _f;
|
|
6371
6381
|
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,
|
|
6372
6382
|
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;
|
|
6373
|
-
if (this.stage !== stage) return this.stage = stage, this.layer = layer, needsSharedStateTreeSync && (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0
|
|
6383
|
+
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();
|
|
6374
6384
|
const layerChanged = this.layer !== layer;
|
|
6375
|
-
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0
|
|
6385
|
+
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.notifyChildrenSharedStateTreeChanged();
|
|
6376
6386
|
}
|
|
6377
6387
|
addUpdatePositionTag() {
|
|
6378
6388
|
super.addUpdatePositionTag(), this.forEachChildren(g => {
|
|
@@ -6431,26 +6441,17 @@ class Group extends Graphic {
|
|
|
6431
6441
|
hasSharedStateDefinitions() {
|
|
6432
6442
|
return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
|
|
6433
6443
|
}
|
|
6434
|
-
|
|
6435
|
-
var _a;
|
|
6436
|
-
return this.sharedStateScope ? this.sharedStateScope : void 0 !== inheritedSharedStateScope ? inheritedSharedStateScope : null !== (_a = this.resolveBoundSharedStateScope()) && void 0 !== _a ? _a : null;
|
|
6437
|
-
}
|
|
6438
|
-
notifyChildrenSharedStateTreeChanged(inheritedSharedStateScope) {
|
|
6439
|
-
const childSharedStateScope = this.resolveChildSharedStateScope(inheritedSharedStateScope);
|
|
6444
|
+
notifyChildrenSharedStateTreeChanged() {
|
|
6440
6445
|
this.forEachChildren(item => {
|
|
6441
|
-
this.
|
|
6446
|
+
this.syncChildSharedStateTreeBinding(item);
|
|
6442
6447
|
});
|
|
6443
6448
|
}
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
"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);
|
|
6449
|
+
syncChildSharedStateTreeBinding(child) {
|
|
6450
|
+
child.onParentSharedStateTreeChanged(this.stage, this.layer);
|
|
6447
6451
|
}
|
|
6448
|
-
|
|
6449
|
-
void 0 === inheritedSharedStateScope && (inheritedSharedStateScope = this.resolveChildSharedStateScope()), this.setStageToChild(child, inheritedSharedStateScope);
|
|
6450
|
-
}
|
|
6451
|
-
onParentSharedStateTreeChanged(stage, layer, inheritedSharedStateScope) {
|
|
6452
|
+
onParentSharedStateTreeChanged(stage, layer) {
|
|
6452
6453
|
var _a;
|
|
6453
|
-
this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length)
|
|
6454
|
+
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);
|
|
6454
6455
|
}
|
|
6455
6456
|
}
|
|
6456
6457
|
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
@@ -7214,8 +7215,15 @@ class Text extends Graphic {
|
|
|
7214
7215
|
const b = this.AABBBounds;
|
|
7215
7216
|
return this._OBBBounds.setValue(b.x1, b.y1, b.x2, b.y2), this._OBBBounds;
|
|
7216
7217
|
}
|
|
7217
|
-
this.obbText || (this.obbText = new Text({}))
|
|
7218
|
-
|
|
7218
|
+
this.obbText || (this.obbText = new Text({}));
|
|
7219
|
+
const {
|
|
7220
|
+
dx = 0,
|
|
7221
|
+
dy = 0
|
|
7222
|
+
} = attribute;
|
|
7223
|
+
this.obbText.setAttributes(Object.assign(Object.assign({}, attribute), {
|
|
7224
|
+
angle: 0,
|
|
7225
|
+
dx: 0,
|
|
7226
|
+
dy: 0
|
|
7219
7227
|
}));
|
|
7220
7228
|
const bounds1 = this.obbText.AABBBounds,
|
|
7221
7229
|
{
|
|
@@ -7230,7 +7238,7 @@ class Text extends Graphic {
|
|
|
7230
7238
|
x: x,
|
|
7231
7239
|
y: y
|
|
7232
7240
|
});
|
|
7233
|
-
return this._OBBBounds.copy(bounds1), this._OBBBounds.translate(center.x - boundsCenter.x, center.y - boundsCenter.y), this._OBBBounds.angle = angle, this._OBBBounds;
|
|
7241
|
+
return this._OBBBounds.copy(bounds1), this._OBBBounds.translate(center.x - boundsCenter.x + dx, center.y - boundsCenter.y + dy), this._OBBBounds.angle = angle, this._OBBBounds;
|
|
7234
7242
|
}
|
|
7235
7243
|
updateAABBBounds(attribute, textTheme, aabbBounds) {
|
|
7236
7244
|
const {
|
|
@@ -9053,8 +9061,8 @@ class RichText extends Graphic {
|
|
|
9053
9061
|
clone() {
|
|
9054
9062
|
return new RichText(Object.assign({}, this.attribute));
|
|
9055
9063
|
}
|
|
9056
|
-
setStage(stage, layer
|
|
9057
|
-
super.setStage(stage, layer
|
|
9064
|
+
setStage(stage, layer) {
|
|
9065
|
+
super.setStage(stage, layer);
|
|
9058
9066
|
this.getFrameCache().icons.forEach(icon => {
|
|
9059
9067
|
icon.setStage(stage, layer);
|
|
9060
9068
|
});
|
|
@@ -9490,7 +9498,204 @@ function createArc(attributes) {
|
|
|
9490
9498
|
return new Arc(attributes);
|
|
9491
9499
|
}
|
|
9492
9500
|
|
|
9493
|
-
|
|
9501
|
+
function drawPolygon(path, points, x, y) {
|
|
9502
|
+
if (points && points.length) {
|
|
9503
|
+
path.moveTo(points[0].x + x, points[0].y + y);
|
|
9504
|
+
for (let i = 1; i < points.length; i++) path.lineTo(points[i].x + x, points[i].y + y);
|
|
9505
|
+
}
|
|
9506
|
+
}
|
|
9507
|
+
function drawRoundedPolygon(path, points, x, y, cornerRadius, closePath = !0) {
|
|
9508
|
+
var _a;
|
|
9509
|
+
const normalized = normalizePolygonPoints(points, cornerRadius, closePath);
|
|
9510
|
+
if (normalized) return void drawRoundedPolygon(path, normalized.points, x, y, normalized.cornerRadius, closePath);
|
|
9511
|
+
if (points.length < 3) return void drawPolygon(path, points, x, y);
|
|
9512
|
+
let startI = 0,
|
|
9513
|
+
endI = points.length - 1;
|
|
9514
|
+
closePath || (startI += 1, endI -= 1, path.moveTo(points[0].x + x, points[0].y + y));
|
|
9515
|
+
for (let i = startI; i <= endI; i++) {
|
|
9516
|
+
const p1 = points[0 === i ? endI : (i - 1) % points.length],
|
|
9517
|
+
angularPoint = points[i % points.length],
|
|
9518
|
+
p2 = points[(i + 1) % points.length],
|
|
9519
|
+
dx1 = angularPoint.x - p1.x,
|
|
9520
|
+
dy1 = angularPoint.y - p1.y,
|
|
9521
|
+
dx2 = angularPoint.x - p2.x,
|
|
9522
|
+
dy2 = angularPoint.y - p2.y,
|
|
9523
|
+
angle = (Math.atan2(dy1, dx1) - Math.atan2(dy2, dx2)) / 2,
|
|
9524
|
+
tan = Math.abs(Math.tan(angle));
|
|
9525
|
+
let radius = Array.isArray(cornerRadius) ? null !== (_a = cornerRadius[i % points.length]) && void 0 !== _a ? _a : 0 : cornerRadius,
|
|
9526
|
+
segment = radius / tan;
|
|
9527
|
+
const length1 = getLength(dx1, dy1),
|
|
9528
|
+
length2 = getLength(dx2, dy2),
|
|
9529
|
+
length = Math.min(length1, length2);
|
|
9530
|
+
segment > length && (segment = length, radius = length * tan);
|
|
9531
|
+
const p1Cross = getProportionPoint(angularPoint, segment, length1, dx1, dy1),
|
|
9532
|
+
p2Cross = getProportionPoint(angularPoint, segment, length2, dx2, dy2),
|
|
9533
|
+
dx = 2 * angularPoint.x - p1Cross.x - p2Cross.x,
|
|
9534
|
+
dy = 2 * angularPoint.y - p1Cross.y - p2Cross.y,
|
|
9535
|
+
L = getLength(dx, dy),
|
|
9536
|
+
circlePoint = getProportionPoint(angularPoint, getLength(segment, radius), L, dx, dy);
|
|
9537
|
+
let startAngle = Math.atan2(p1Cross.y - circlePoint.y, p1Cross.x - circlePoint.x);
|
|
9538
|
+
const endAngle = Math.atan2(p2Cross.y - circlePoint.y, p2Cross.x - circlePoint.x);
|
|
9539
|
+
let sweepAngle = endAngle - startAngle;
|
|
9540
|
+
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);
|
|
9541
|
+
}
|
|
9542
|
+
closePath || path.lineTo(points[endI + 1].x + x, points[endI + 1].y + y);
|
|
9543
|
+
}
|
|
9544
|
+
function getLength(dx, dy) {
|
|
9545
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
9546
|
+
}
|
|
9547
|
+
function getProportionPoint(point, segment, length, dx, dy) {
|
|
9548
|
+
const factor = segment / length;
|
|
9549
|
+
return {
|
|
9550
|
+
x: point.x - dx * factor,
|
|
9551
|
+
y: point.y - dy * factor
|
|
9552
|
+
};
|
|
9553
|
+
}
|
|
9554
|
+
function normalizePolygonPoints(points, cornerRadius, closePath = !0) {
|
|
9555
|
+
var _a;
|
|
9556
|
+
let hasDuplicate = !1;
|
|
9557
|
+
for (let i = 1; i < points.length; i++) if (isSamePoint(points[i - 1], points[i])) {
|
|
9558
|
+
hasDuplicate = !0;
|
|
9559
|
+
break;
|
|
9560
|
+
}
|
|
9561
|
+
if (!hasDuplicate && closePath && points.length > 1 && isSamePoint(points[0], points[points.length - 1]) && (hasDuplicate = !0), !hasDuplicate) return null;
|
|
9562
|
+
const normalizedPoints = [],
|
|
9563
|
+
normalizedCornerRadius = Array.isArray(cornerRadius) ? [] : null;
|
|
9564
|
+
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));
|
|
9565
|
+
return closePath && normalizedPoints.length > 1 && isSamePoint(normalizedPoints[0], normalizedPoints[normalizedPoints.length - 1]) && (normalizedPoints.pop(), null == normalizedCornerRadius || normalizedCornerRadius.pop()), {
|
|
9566
|
+
points: normalizedPoints,
|
|
9567
|
+
cornerRadius: null != normalizedCornerRadius ? normalizedCornerRadius : cornerRadius
|
|
9568
|
+
};
|
|
9569
|
+
}
|
|
9570
|
+
function isSamePoint(a, b) {
|
|
9571
|
+
return a.x === b.x && a.y === b.y;
|
|
9572
|
+
}
|
|
9573
|
+
function getPolygonWinding(points) {
|
|
9574
|
+
let signedArea = 0;
|
|
9575
|
+
for (let i = 0; i < points.length; i++) {
|
|
9576
|
+
const current = points[i],
|
|
9577
|
+
next = points[(i + 1) % points.length];
|
|
9578
|
+
signedArea += current.x * next.y - next.x * current.y;
|
|
9579
|
+
}
|
|
9580
|
+
return signedArea > 0 ? 1 : -1;
|
|
9581
|
+
}
|
|
9582
|
+
function offsetPolygonPoints(points, distance, closePath = !0) {
|
|
9583
|
+
var _a;
|
|
9584
|
+
const n = null !== (_a = null == points ? void 0 : points.length) && void 0 !== _a ? _a : 0;
|
|
9585
|
+
if (n < 2 || closePath && n < 3 || !distance) return points;
|
|
9586
|
+
const sign = getPolygonWinding(points),
|
|
9587
|
+
edgeCount = closePath ? n : n - 1,
|
|
9588
|
+
lines = [];
|
|
9589
|
+
for (let i = 0; i < edgeCount; i++) {
|
|
9590
|
+
const cur = points[i],
|
|
9591
|
+
next = points[(i + 1) % n],
|
|
9592
|
+
dx = next.x - cur.x,
|
|
9593
|
+
dy = next.y - cur.y,
|
|
9594
|
+
len = Math.sqrt(dx * dx + dy * dy);
|
|
9595
|
+
if (!len) {
|
|
9596
|
+
lines.push(null);
|
|
9597
|
+
continue;
|
|
9598
|
+
}
|
|
9599
|
+
const offsetX = sign * dy * distance / len,
|
|
9600
|
+
offsetY = -sign * dx * distance / len;
|
|
9601
|
+
lines.push({
|
|
9602
|
+
x: cur.x + offsetX,
|
|
9603
|
+
y: cur.y + offsetY,
|
|
9604
|
+
dx: dx,
|
|
9605
|
+
dy: dy,
|
|
9606
|
+
len: len,
|
|
9607
|
+
offsetX: offsetX,
|
|
9608
|
+
offsetY: offsetY
|
|
9609
|
+
});
|
|
9610
|
+
}
|
|
9611
|
+
const prevLines = new Array(n);
|
|
9612
|
+
let prevLine = null;
|
|
9613
|
+
if (closePath) for (let i = edgeCount - 1; i >= 0; i--) if (lines[i]) {
|
|
9614
|
+
prevLine = lines[i];
|
|
9615
|
+
break;
|
|
9616
|
+
}
|
|
9617
|
+
for (let i = 0; i < n; i++) prevLines[i] = prevLine, i < edgeCount && lines[i] && (prevLine = lines[i]);
|
|
9618
|
+
const nextLines = new Array(n);
|
|
9619
|
+
let nextLine = null;
|
|
9620
|
+
if (closePath) for (let count = 0; count < edgeCount; count++) {
|
|
9621
|
+
const line = lines[(n - 1 + count) % edgeCount];
|
|
9622
|
+
if (line) {
|
|
9623
|
+
nextLine = line;
|
|
9624
|
+
break;
|
|
9625
|
+
}
|
|
9626
|
+
}
|
|
9627
|
+
for (let i = n - 1; i >= 0; i--) i < edgeCount && lines[i] && (nextLine = lines[i]), nextLines[i] = nextLine;
|
|
9628
|
+
const offsetPointByLine = (point, line) => ({
|
|
9629
|
+
x: point.x + line.offsetX,
|
|
9630
|
+
y: point.y + line.offsetY
|
|
9631
|
+
}),
|
|
9632
|
+
result = [];
|
|
9633
|
+
for (let i = 0; i < n; i++) {
|
|
9634
|
+
const prev = prevLines[i],
|
|
9635
|
+
cur = nextLines[i],
|
|
9636
|
+
line = prev || cur;
|
|
9637
|
+
if (!line) {
|
|
9638
|
+
result.push(points[i]);
|
|
9639
|
+
continue;
|
|
9640
|
+
}
|
|
9641
|
+
if (!prev || !cur) {
|
|
9642
|
+
result.push(offsetPointByLine(points[i], line));
|
|
9643
|
+
continue;
|
|
9644
|
+
}
|
|
9645
|
+
const denominator = prev.dx * cur.dy - prev.dy * cur.dx;
|
|
9646
|
+
if (Math.abs(denominator) <= 1e-12 * prev.len * cur.len) {
|
|
9647
|
+
result.push(offsetPointByLine(points[i], cur));
|
|
9648
|
+
continue;
|
|
9649
|
+
}
|
|
9650
|
+
const t = ((cur.x - prev.x) * cur.dy - (cur.y - prev.y) * cur.dx) / denominator,
|
|
9651
|
+
point = {
|
|
9652
|
+
x: prev.x + prev.dx * t,
|
|
9653
|
+
y: prev.y + prev.dy * t
|
|
9654
|
+
};
|
|
9655
|
+
result.push(Number.isFinite(point.x) && Number.isFinite(point.y) ? point : offsetPointByLine(points[i], cur));
|
|
9656
|
+
}
|
|
9657
|
+
return result;
|
|
9658
|
+
}
|
|
9659
|
+
|
|
9660
|
+
const getBoundsScaleMatrix = polygon => {
|
|
9661
|
+
var _a;
|
|
9662
|
+
const globalMatrix = polygon.globalTransMatrix,
|
|
9663
|
+
viewBoxMatrix = null === (_a = polygon.stage) || void 0 === _a ? void 0 : _a.window.getViewBoxTransform();
|
|
9664
|
+
return viewBoxMatrix ? {
|
|
9665
|
+
a: viewBoxMatrix.a * globalMatrix.a + viewBoxMatrix.c * globalMatrix.b,
|
|
9666
|
+
b: viewBoxMatrix.b * globalMatrix.a + viewBoxMatrix.d * globalMatrix.b,
|
|
9667
|
+
c: viewBoxMatrix.a * globalMatrix.c + viewBoxMatrix.c * globalMatrix.d,
|
|
9668
|
+
d: viewBoxMatrix.b * globalMatrix.c + viewBoxMatrix.d * globalMatrix.d
|
|
9669
|
+
} : globalMatrix;
|
|
9670
|
+
};
|
|
9671
|
+
const getPolygonBoundsScale = polygon => getScaledStrokeWithMatrix(getBoundsScaleMatrix(polygon), 1, 1);
|
|
9672
|
+
const updateBoundsOfPolygonOuterBorder = (attribute, polygonTheme, aabbBounds, polygon) => {
|
|
9673
|
+
const {
|
|
9674
|
+
outerBorder: outerBorder,
|
|
9675
|
+
points = polygonTheme.points,
|
|
9676
|
+
closePath = polygonTheme.closePath,
|
|
9677
|
+
shadowBlur = polygonTheme.shadowBlur,
|
|
9678
|
+
keepStrokeScale = polygonTheme.keepStrokeScale
|
|
9679
|
+
} = attribute;
|
|
9680
|
+
if (outerBorder && !1 !== outerBorder.visible) {
|
|
9681
|
+
const defaultOuterBorder = polygonTheme.outerBorder,
|
|
9682
|
+
{
|
|
9683
|
+
distance = defaultOuterBorder.distance,
|
|
9684
|
+
lineWidth = defaultOuterBorder.lineWidth,
|
|
9685
|
+
lineJoin = defaultOuterBorder.lineJoin,
|
|
9686
|
+
strokeBoundsBuffer = defaultOuterBorder.strokeBoundsBuffer
|
|
9687
|
+
} = outerBorder,
|
|
9688
|
+
boundsScale = getPolygonBoundsScale(polygon);
|
|
9689
|
+
let scaledDistance = distance;
|
|
9690
|
+
keepStrokeScale || (scaledDistance *= boundsScale), offsetPolygonPoints(points, scaledDistance, closePath).forEach(point => {
|
|
9691
|
+
aabbBounds.add(point.x, point.y);
|
|
9692
|
+
});
|
|
9693
|
+
boundStroke(aabbBounds, (shadowBlur * boundsScale + lineWidth * (keepStrokeScale ? 1 : boundsScale)) / 2, "miter" === lineJoin, strokeBoundsBuffer);
|
|
9694
|
+
}
|
|
9695
|
+
return aabbBounds;
|
|
9696
|
+
};
|
|
9697
|
+
|
|
9698
|
+
const POLYGON_UPDATE_TAG_KEY = ["points", "cornerRadius", "outerBorder", "keepStrokeScale", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
9494
9699
|
class Polygon extends Graphic {
|
|
9495
9700
|
constructor(params) {
|
|
9496
9701
|
super(params), this.type = "polygon", this.numberType = POLYGON_NUMBER_TYPE;
|
|
@@ -9507,6 +9712,16 @@ class Polygon extends Graphic {
|
|
|
9507
9712
|
getGraphicTheme() {
|
|
9508
9713
|
return getTheme(this).polygon;
|
|
9509
9714
|
}
|
|
9715
|
+
tryUpdateAABBBounds() {
|
|
9716
|
+
const {
|
|
9717
|
+
outerBorder: outerBorder
|
|
9718
|
+
} = this.attribute;
|
|
9719
|
+
if (outerBorder && !1 !== outerBorder.visible) {
|
|
9720
|
+
const boundsScale = getPolygonBoundsScale(this);
|
|
9721
|
+
boundsScale !== this._outerBorderBoundsScale && (this._outerBorderBoundsScale = boundsScale, this.addUpdateBoundTag());
|
|
9722
|
+
} else this._outerBorderBoundsScale = void 0;
|
|
9723
|
+
return super.tryUpdateAABBBounds();
|
|
9724
|
+
}
|
|
9510
9725
|
updateAABBBounds(attribute, polygonTheme, aabbBounds) {
|
|
9511
9726
|
this.updatePathProxyAABBBounds(aabbBounds) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds), application.graphicService.updateTempAABBBounds(aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
|
|
9512
9727
|
const {
|
|
@@ -9520,7 +9735,7 @@ class Polygon extends Graphic {
|
|
|
9520
9735
|
} = attribute;
|
|
9521
9736
|
return points.forEach(p => {
|
|
9522
9737
|
aabbBounds.add(p.x, p.y);
|
|
9523
|
-
}), aabbBounds;
|
|
9738
|
+
}), updateBoundsOfPolygonOuterBorder(attribute, polygonTheme, aabbBounds, this), aabbBounds;
|
|
9524
9739
|
}
|
|
9525
9740
|
_interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes) {
|
|
9526
9741
|
"points" === key && (nextAttributes.points = pointsInterpolation(lastStepVal, nextStepVal, ratio));
|
|
@@ -12448,22 +12663,26 @@ class DefaultRectRenderContribution {
|
|
|
12448
12663
|
width: width,
|
|
12449
12664
|
height: height
|
|
12450
12665
|
} = rect.attribute;
|
|
12451
|
-
width = (null != width ? width : x1 -
|
|
12452
|
-
const
|
|
12453
|
-
|
|
12454
|
-
|
|
12455
|
-
|
|
12456
|
-
|
|
12457
|
-
|
|
12458
|
-
|
|
12459
|
-
|
|
12460
|
-
|
|
12461
|
-
|
|
12462
|
-
|
|
12463
|
-
|
|
12464
|
-
|
|
12465
|
-
|
|
12466
|
-
|
|
12666
|
+
width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
|
|
12667
|
+
const borderX = width < 0 ? x + width : x,
|
|
12668
|
+
borderY = height < 0 ? y + height : y,
|
|
12669
|
+
borderWidth = width < 0 ? -width : width,
|
|
12670
|
+
borderHeight = height < 0 ? -height : height,
|
|
12671
|
+
renderBorder = (borderStyle, key) => {
|
|
12672
|
+
const doStroke = !(!borderStyle || !borderStyle.stroke),
|
|
12673
|
+
sign = "outerBorder" === key ? -1 : 1,
|
|
12674
|
+
{
|
|
12675
|
+
distance = rectAttribute[key].distance
|
|
12676
|
+
} = borderStyle,
|
|
12677
|
+
d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
|
|
12678
|
+
nextX = borderX + sign * d,
|
|
12679
|
+
nextY = borderY + sign * d,
|
|
12680
|
+
dw = 2 * d;
|
|
12681
|
+
if (0 === cornerRadius || isArray(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) {
|
|
12682
|
+
const lastOpacity = rectAttribute[key].opacity;
|
|
12683
|
+
rectAttribute[key].opacity = opacity, context.setStrokeStyle(rect, borderStyle, (originX - x) / scaleX, (originY - y) / scaleY, rectAttribute[key]), rectAttribute[key].opacity = lastOpacity, context.stroke();
|
|
12684
|
+
}
|
|
12685
|
+
};
|
|
12467
12686
|
doOuterBorder && renderBorder(outerBorder, "outerBorder"), doInnerBorder && renderBorder(innerBorder, "innerBorder");
|
|
12468
12687
|
}
|
|
12469
12688
|
}
|
|
@@ -12877,7 +13096,8 @@ class DefaultIncrementalDrawContribution extends DefaultDrawContribution {
|
|
|
12877
13096
|
}
|
|
12878
13097
|
|
|
12879
13098
|
const DrawItemInterceptor = Symbol.for("DrawItemInterceptor");
|
|
12880
|
-
const
|
|
13099
|
+
const INTERACTIVE_POST_MATRIX = "_interactivePostMatrix",
|
|
13100
|
+
tempDirtyBounds = new AABBBounds(),
|
|
12881
13101
|
tempBackupDirtyBounds = new AABBBounds();
|
|
12882
13102
|
class ShadowRootDrawItemInterceptorContribution {
|
|
12883
13103
|
constructor() {
|
|
@@ -12941,12 +13161,23 @@ class InteractiveDrawItemInterceptorContribution {
|
|
|
12941
13161
|
beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
12942
13162
|
return !this.processing && (graphic.baseGraphic ? this.beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) : this.beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params));
|
|
12943
13163
|
}
|
|
13164
|
+
resolveInteractivePostMatrix(graphic, interactiveGraphic) {
|
|
13165
|
+
const parent = graphic.parent;
|
|
13166
|
+
if (!parent) return graphic.attribute.postMatrix;
|
|
13167
|
+
let matrix = interactiveGraphic[INTERACTIVE_POST_MATRIX];
|
|
13168
|
+
matrix || (matrix = new Matrix(), interactiveGraphic[INTERACTIVE_POST_MATRIX] = matrix);
|
|
13169
|
+
const ancestorMatrix = parent.globalTransMatrix;
|
|
13170
|
+
matrix.setValue(ancestorMatrix.a, ancestorMatrix.b, ancestorMatrix.c, ancestorMatrix.d, ancestorMatrix.e, ancestorMatrix.f);
|
|
13171
|
+
const ownPostMatrix = graphic.attribute.postMatrix;
|
|
13172
|
+
return ownPostMatrix && matrix.multiply(ownPostMatrix.a, ownPostMatrix.b, ownPostMatrix.c, ownPostMatrix.d, ownPostMatrix.e, ownPostMatrix.f), matrix;
|
|
13173
|
+
}
|
|
12944
13174
|
beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params) {
|
|
12945
13175
|
let interactiveGraphic = graphic.interactiveGraphic;
|
|
12946
13176
|
if (graphic.attribute.globalZIndex) {
|
|
12947
13177
|
interactiveGraphic || (interactiveGraphic = graphic.clone(), graphic.interactiveGraphic = interactiveGraphic, interactiveGraphic.baseGraphic = graphic), interactiveGraphic.setAttributes({
|
|
12948
13178
|
globalZIndex: 0,
|
|
12949
|
-
zIndex: graphic.attribute.globalZIndex
|
|
13179
|
+
zIndex: graphic.attribute.globalZIndex,
|
|
13180
|
+
postMatrix: this.resolveInteractivePostMatrix(graphic, interactiveGraphic)
|
|
12950
13181
|
}, !1, {
|
|
12951
13182
|
skipUpdateCallback: !0
|
|
12952
13183
|
}), drawContext.stage.tryInitInteractiveLayer();
|
|
@@ -14473,64 +14704,69 @@ class DefaultCanvasTextRender extends BaseRender {
|
|
|
14473
14704
|
}
|
|
14474
14705
|
}
|
|
14475
14706
|
|
|
14476
|
-
|
|
14477
|
-
|
|
14478
|
-
|
|
14479
|
-
|
|
14707
|
+
const defaultPolygonTextureRenderContribution = defaultBaseTextureRenderContribution;
|
|
14708
|
+
const defaultPolygonBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
|
|
14709
|
+
class DefaultPolygonRenderContribution {
|
|
14710
|
+
constructor() {
|
|
14711
|
+
this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
14480
14712
|
}
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
|
|
14485
|
-
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
|
|
14489
|
-
const
|
|
14490
|
-
|
|
14491
|
-
|
|
14492
|
-
|
|
14493
|
-
|
|
14494
|
-
|
|
14495
|
-
|
|
14496
|
-
|
|
14497
|
-
|
|
14498
|
-
|
|
14499
|
-
|
|
14500
|
-
|
|
14501
|
-
|
|
14502
|
-
|
|
14503
|
-
|
|
14504
|
-
|
|
14505
|
-
|
|
14506
|
-
|
|
14507
|
-
|
|
14508
|
-
|
|
14509
|
-
|
|
14510
|
-
|
|
14511
|
-
|
|
14512
|
-
|
|
14513
|
-
|
|
14713
|
+
drawShape(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb) {
|
|
14714
|
+
const {
|
|
14715
|
+
outerBorder: outerBorder,
|
|
14716
|
+
innerBorder: innerBorder
|
|
14717
|
+
} = polygon.attribute,
|
|
14718
|
+
doOuterBorder = outerBorder && !1 !== outerBorder.visible,
|
|
14719
|
+
doInnerBorder = innerBorder && !1 !== innerBorder.visible;
|
|
14720
|
+
if (!doOuterBorder && !doInnerBorder) return;
|
|
14721
|
+
const {
|
|
14722
|
+
points = polygonAttribute.points,
|
|
14723
|
+
cornerRadius = polygonAttribute.cornerRadius,
|
|
14724
|
+
opacity = polygonAttribute.opacity,
|
|
14725
|
+
x: originX = polygonAttribute.x,
|
|
14726
|
+
y: originY = polygonAttribute.y,
|
|
14727
|
+
scaleX = polygonAttribute.scaleX,
|
|
14728
|
+
scaleY = polygonAttribute.scaleY,
|
|
14729
|
+
keepStrokeScale = polygonAttribute.keepStrokeScale,
|
|
14730
|
+
closePath = polygonAttribute.closePath
|
|
14731
|
+
} = polygon.attribute,
|
|
14732
|
+
renderBorder = (borderStyle, key) => {
|
|
14733
|
+
var _a, _b;
|
|
14734
|
+
const doBorderStroke = !!borderStyle.stroke,
|
|
14735
|
+
distanceDirection = "outerBorder" === key ? 1 : -1,
|
|
14736
|
+
{
|
|
14737
|
+
distance = polygonAttribute[key].distance
|
|
14738
|
+
} = borderStyle,
|
|
14739
|
+
borderDistance = distanceDirection * (keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr)),
|
|
14740
|
+
normalized = normalizePolygonPoints(points, cornerRadius, closePath),
|
|
14741
|
+
normalizedPoints = null !== (_a = null == normalized ? void 0 : normalized.points) && void 0 !== _a ? _a : points,
|
|
14742
|
+
normalizedCornerRadius = null !== (_b = null == normalized ? void 0 : normalized.cornerRadius) && void 0 !== _b ? _b : cornerRadius,
|
|
14743
|
+
borderPoints = offsetPolygonPoints(normalizedPoints, borderDistance, closePath),
|
|
14744
|
+
winding = getPolygonWinding(normalizedPoints),
|
|
14745
|
+
borderCornerRadius = normalizedPoints.map((point, i) => {
|
|
14746
|
+
var _a;
|
|
14747
|
+
const radius = isArray(normalizedCornerRadius) ? null !== (_a = normalizedCornerRadius[i]) && void 0 !== _a ? _a : 0 : normalizedCornerRadius || 0;
|
|
14748
|
+
if (!closePath && (0 === i || i === normalizedPoints.length - 1) || normalizedPoints.length < 3) return radius;
|
|
14749
|
+
const prev = normalizedPoints[(i - 1 + normalizedPoints.length) % normalizedPoints.length],
|
|
14750
|
+
next = normalizedPoints[(i + 1) % normalizedPoints.length],
|
|
14751
|
+
cornerDirection = ((point.x - prev.x) * (next.y - point.y) - (point.y - prev.y) * (next.x - point.x)) * winding < 0 ? -1 : 1;
|
|
14752
|
+
return Math.max(0, radius + borderDistance * cornerDirection);
|
|
14753
|
+
}),
|
|
14754
|
+
noCorner = 0 === borderCornerRadius.length || borderCornerRadius.every(r => 0 === r);
|
|
14755
|
+
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) {
|
|
14756
|
+
const lastOpacity = polygonAttribute[key].opacity,
|
|
14757
|
+
borderStyleWithStrokeScale = borderStyle,
|
|
14758
|
+
lastKeepStrokeScale = borderStyleWithStrokeScale.keepStrokeScale;
|
|
14759
|
+
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();
|
|
14760
|
+
}
|
|
14761
|
+
};
|
|
14762
|
+
doOuterBorder && renderBorder(outerBorder, "outerBorder"), doInnerBorder && renderBorder(innerBorder, "innerBorder");
|
|
14514
14763
|
}
|
|
14515
|
-
closePath || path.lineTo(points[endI + 1].x + x, points[endI + 1].y + y);
|
|
14516
|
-
}
|
|
14517
|
-
function getLength(dx, dy) {
|
|
14518
|
-
return Math.sqrt(dx * dx + dy * dy);
|
|
14519
|
-
}
|
|
14520
|
-
function getProportionPoint(point, segment, length, dx, dy) {
|
|
14521
|
-
const factor = segment / length;
|
|
14522
|
-
return {
|
|
14523
|
-
x: point.x - dx * factor,
|
|
14524
|
-
y: point.y - dy * factor
|
|
14525
|
-
};
|
|
14526
14764
|
}
|
|
14527
|
-
|
|
14528
|
-
const defaultPolygonTextureRenderContribution = defaultBaseTextureRenderContribution;
|
|
14529
|
-
const defaultPolygonBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
|
|
14765
|
+
const defaultPolygonRenderContribution = new DefaultPolygonRenderContribution();
|
|
14530
14766
|
|
|
14531
14767
|
class DefaultCanvasPolygonRender extends BaseRender {
|
|
14532
14768
|
constructor(graphicRenderContributions) {
|
|
14533
|
-
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(graphicRenderContributions);
|
|
14769
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonRenderContribution, defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(graphicRenderContributions);
|
|
14534
14770
|
}
|
|
14535
14771
|
drawShape(polygon, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
14536
14772
|
const polygonAttribute = getTheme(polygon, null == params ? void 0 : params.theme).polygon,
|
|
@@ -30030,7 +30266,6 @@ class DiscreteLegend extends LegendBase {
|
|
|
30030
30266
|
this._itemHeight = 0;
|
|
30031
30267
|
this._itemMaxWidth = 0;
|
|
30032
30268
|
this._contentMaxHeight = 0;
|
|
30033
|
-
this._stateDefinitionsCache = new WeakMap();
|
|
30034
30269
|
this._onHover = (e) => {
|
|
30035
30270
|
const target = e.target;
|
|
30036
30271
|
if (target && target.name && target.name.startsWith(LEGEND_ELEMENT_NAME.item)) {
|
|
@@ -30117,7 +30352,6 @@ class DiscreteLegend extends LegendBase {
|
|
|
30117
30352
|
};
|
|
30118
30353
|
}
|
|
30119
30354
|
render() {
|
|
30120
|
-
this._stateDefinitionsCache = new WeakMap();
|
|
30121
30355
|
super.render();
|
|
30122
30356
|
this._lastActiveItem = null;
|
|
30123
30357
|
}
|
|
@@ -30396,7 +30630,7 @@ class DiscreteLegend extends LegendBase {
|
|
|
30396
30630
|
}
|
|
30397
30631
|
else {
|
|
30398
30632
|
itemGroup = graphicCreator.group(Object.assign({ x: 0, y: 0 }, backgroundStyle.style));
|
|
30399
|
-
this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup, backgroundStyle.state
|
|
30633
|
+
this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup, backgroundStyle.state);
|
|
30400
30634
|
}
|
|
30401
30635
|
itemGroup.id = `${id !== null && id !== void 0 ? id : label}-${index}`;
|
|
30402
30636
|
itemGroup.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);
|
|
@@ -30429,7 +30663,7 @@ class DiscreteLegend extends LegendBase {
|
|
|
30429
30663
|
shapeStyle.state[key].stroke = color;
|
|
30430
30664
|
}
|
|
30431
30665
|
});
|
|
30432
|
-
this._appendDataToShape(itemShape, LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state
|
|
30666
|
+
this._appendDataToShape(itemShape, LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state);
|
|
30433
30667
|
itemShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);
|
|
30434
30668
|
innerGroup.add(itemShape);
|
|
30435
30669
|
}
|
|
@@ -30444,7 +30678,7 @@ class DiscreteLegend extends LegendBase {
|
|
|
30444
30678
|
const text = labelAttr.formatMethod ? labelAttr.formatMethod(label, item, index) : label;
|
|
30445
30679
|
const labelAttributes = Object.assign(Object.assign({ x: shapeSize / 2 + shapeSpace, y: 0, textAlign: 'start', textBaseline: 'middle', lineHeight: (_b = labelStyle.style) === null || _b === void 0 ? void 0 : _b.fontSize }, labelStyle.style), { text, _originText: labelAttr.formatMethod ? label : undefined });
|
|
30446
30680
|
const labelShape = createTextGraphicByType(labelAttributes);
|
|
30447
|
-
this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state
|
|
30681
|
+
this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state);
|
|
30448
30682
|
labelShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);
|
|
30449
30683
|
innerGroup.add(labelShape);
|
|
30450
30684
|
const labelSpace = get(labelAttr, 'space', DEFAULT_LABEL_SPACE);
|
|
@@ -30453,7 +30687,7 @@ class DiscreteLegend extends LegendBase {
|
|
|
30453
30687
|
const valueText = valueAttr.formatMethod ? valueAttr.formatMethod(value, item, index) : value;
|
|
30454
30688
|
const valueAttributes = Object.assign(Object.assign({ x: 0, y: 0, textAlign: 'start', textBaseline: 'middle', lineHeight: valueStyle.style.fontSize }, valueStyle.style), { text: valueText, _originText: valueAttr.formatMethod ? value : undefined });
|
|
30455
30689
|
const valueShape = createTextGraphicByType(valueAttributes);
|
|
30456
|
-
this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state
|
|
30690
|
+
this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state);
|
|
30457
30691
|
valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);
|
|
30458
30692
|
if (this._itemWidthByUser) {
|
|
30459
30693
|
const layoutWidth = this._itemWidthByUser -
|
|
@@ -31105,29 +31339,11 @@ class DiscreteLegend extends LegendBase {
|
|
|
31105
31339
|
});
|
|
31106
31340
|
return selectedData;
|
|
31107
31341
|
}
|
|
31108
|
-
_appendDataToShape(shape, name, data, delegateShape, states
|
|
31342
|
+
_appendDataToShape(shape, name, data, delegateShape, states = {}) {
|
|
31109
31343
|
shape.name = name;
|
|
31110
31344
|
shape.data = data;
|
|
31111
31345
|
shape.delegate = delegateShape;
|
|
31112
|
-
|
|
31113
|
-
shape.states = merge({}, DEFAULT_STATES, states);
|
|
31114
|
-
return;
|
|
31115
|
-
}
|
|
31116
|
-
const source = states !== null && states !== void 0 ? states : DEFAULT_STATES;
|
|
31117
|
-
const cached = this._stateDefinitionsCache.get(source);
|
|
31118
|
-
if (cached) {
|
|
31119
|
-
shape.states = cached.definitions;
|
|
31120
|
-
shape.setStateDefinitionsWithCompiled(cached.definitions, cached.compiledDefinitions);
|
|
31121
|
-
return;
|
|
31122
|
-
}
|
|
31123
|
-
const definitions = states ? merge({}, DEFAULT_STATES, states) : DEFAULT_STATES;
|
|
31124
|
-
const entry = {
|
|
31125
|
-
definitions,
|
|
31126
|
-
compiledDefinitions: new StateDefinitionCompiler().compile(definitions)
|
|
31127
|
-
};
|
|
31128
|
-
this._stateDefinitionsCache.set(source, entry);
|
|
31129
|
-
shape.states = entry.definitions;
|
|
31130
|
-
shape.setStateDefinitionsWithCompiled(entry.definitions, entry.compiledDefinitions);
|
|
31346
|
+
shape.states = merge({}, DEFAULT_STATES, states);
|
|
31131
31347
|
}
|
|
31132
31348
|
_dispatchLegendEvent(eventName, legendItem, event) {
|
|
31133
31349
|
const currentSelectedItems = this._getSelectedLegends();
|
|
@@ -31153,27 +31369,21 @@ class DiscreteLegend extends LegendBase {
|
|
|
31153
31369
|
}
|
|
31154
31370
|
}
|
|
31155
31371
|
if (config.state) {
|
|
31156
|
-
|
|
31157
|
-
|
|
31158
|
-
|
|
31159
|
-
|
|
31160
|
-
|
|
31161
|
-
}
|
|
31162
|
-
else {
|
|
31163
|
-
newConfig.state = {};
|
|
31164
|
-
stateKeys.forEach(key => {
|
|
31165
|
-
if (config.state[key]) {
|
|
31166
|
-
newConfig.state[key] = isFunction(config.state[key])
|
|
31167
|
-
? config.state[key](item, isSelected, index, items)
|
|
31168
|
-
: config.state[key];
|
|
31372
|
+
newConfig.state = {};
|
|
31373
|
+
Object.keys(config.state).forEach(key => {
|
|
31374
|
+
if (config.state[key]) {
|
|
31375
|
+
if (isFunction(config.state[key])) {
|
|
31376
|
+
newConfig.state[key] = config.state[key](item, isSelected, index, items);
|
|
31169
31377
|
}
|
|
31170
|
-
|
|
31171
|
-
|
|
31378
|
+
else {
|
|
31379
|
+
newConfig.state[key] = config.state[key];
|
|
31380
|
+
}
|
|
31381
|
+
}
|
|
31382
|
+
});
|
|
31172
31383
|
}
|
|
31173
31384
|
return newConfig;
|
|
31174
31385
|
}
|
|
31175
31386
|
release() {
|
|
31176
|
-
this._stateDefinitionsCache = new WeakMap();
|
|
31177
31387
|
super.release();
|
|
31178
31388
|
this.removeAllEventListeners();
|
|
31179
31389
|
}
|
|
@@ -36676,6 +36886,6 @@ TableSeriesNumber.defaultAttributes = {
|
|
|
36676
36886
|
select: true
|
|
36677
36887
|
};
|
|
36678
36888
|
|
|
36679
|
-
const version = "1.1.
|
|
36889
|
+
const version = "1.1.7";
|
|
36680
36890
|
|
|
36681
36891
|
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IDataZoomEvent, IDataZoomInteractiveEvent, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PolygonSectorCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SeriesNumberCellStateValue, SeriesNumberEvent, SizeContinuousLegend, Slider, StoryLabelItem, Switch, SymbolLabel, TableSeriesNumber, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, WeatherBox, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, installPoptipToApp, installScrollbarToApp, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, loadScrollbar, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
|