@visactor/vrender-components 1.1.0-alpha.2 → 1.1.0-alpha.21
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/animation/axis-animate.d.ts +1 -0
- package/cjs/animation/axis-animate.js +11 -4
- package/cjs/animation/axis-animate.js.map +1 -1
- package/cjs/animation/exit-release.d.ts +13 -0
- package/cjs/animation/exit-release.js +39 -0
- package/cjs/animation/exit-release.js.map +1 -0
- package/cjs/animation/static-truth.d.ts +2 -0
- package/cjs/animation/static-truth.js +21 -0
- package/cjs/animation/static-truth.js.map +1 -0
- package/cjs/axis/animate/group-transition.d.ts +2 -2
- package/cjs/axis/animate/group-transition.js +7 -3
- package/cjs/axis/animate/group-transition.js.map +1 -1
- package/cjs/axis/base.d.ts +6 -2
- package/cjs/axis/base.js +80 -30
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/line.d.ts +1 -1
- package/cjs/axis/line.js +2 -2
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/util.js +1 -2
- package/cjs/brush/config.js +2 -1
- package/cjs/core/type.d.ts +7 -0
- package/cjs/core/type.js.map +1 -1
- package/cjs/crosshair/polygon-sector.js +1 -2
- package/cjs/crosshair/sector.js +2 -1
- package/cjs/empty-tip/register.js +1 -2
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/indicator/config.js +2 -1
- package/cjs/jsx/index.js +1 -1
- package/cjs/label/arc.js +14 -9
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.d.ts +8 -1
- package/cjs/label/base.js +86 -10
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/dataLabel.d.ts +5 -1
- package/cjs/label/dataLabel.js +46 -1
- package/cjs/label/dataLabel.js.map +1 -1
- package/cjs/legend/discrete/discrete.js +17 -9
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/marker/animate/call-in.js +6 -2
- package/cjs/marker/animate/call-in.js.map +1 -1
- package/cjs/marker/animate/clip-in.js +6 -2
- package/cjs/marker/animate/clip-in.js.map +1 -1
- package/cjs/marker/animate/common.js +14 -5
- package/cjs/marker/animate/common.js.map +1 -1
- package/cjs/marker/base.d.ts +6 -2
- package/cjs/marker/base.js +51 -9
- package/cjs/marker/base.js.map +1 -1
- package/cjs/marker/type.d.ts +2 -1
- package/cjs/marker/type.js.map +1 -1
- package/cjs/timeline/timeline.js +35 -12
- package/cjs/timeline/timeline.js.map +1 -1
- package/cjs/title/title.js +5 -2
- package/cjs/title/title.js.map +1 -1
- package/dist/index.es.js +1631 -297
- package/es/animation/axis-animate.d.ts +1 -0
- package/es/animation/axis-animate.js +12 -4
- package/es/animation/axis-animate.js.map +1 -1
- package/es/animation/exit-release.d.ts +13 -0
- package/es/animation/exit-release.js +31 -0
- package/es/animation/exit-release.js.map +1 -0
- package/es/animation/static-truth.d.ts +2 -0
- package/es/animation/static-truth.js +14 -0
- package/es/animation/static-truth.js.map +1 -0
- package/es/axis/animate/group-transition.d.ts +2 -2
- package/es/axis/animate/group-transition.js +7 -2
- package/es/axis/animate/group-transition.js.map +1 -1
- package/es/axis/base.d.ts +6 -2
- package/es/axis/base.js +81 -28
- package/es/axis/base.js.map +1 -1
- package/es/axis/line.d.ts +1 -1
- package/es/axis/line.js +2 -2
- package/es/axis/line.js.map +1 -1
- package/es/axis/util.js +1 -2
- package/es/brush/config.js +2 -1
- package/es/core/type.d.ts +7 -0
- package/es/core/type.js.map +1 -1
- package/es/crosshair/polygon-sector.js +1 -2
- package/es/crosshair/sector.js +2 -1
- package/es/empty-tip/register.js +1 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/indicator/config.js +2 -1
- package/es/jsx/index.js +1 -1
- package/es/label/arc.js +14 -9
- package/es/label/arc.js.map +1 -1
- package/es/label/base.d.ts +8 -1
- package/es/label/base.js +88 -9
- package/es/label/base.js.map +1 -1
- package/es/label/dataLabel.d.ts +5 -1
- package/es/label/dataLabel.js +46 -0
- package/es/label/dataLabel.js.map +1 -1
- package/es/legend/discrete/discrete.js +18 -8
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/marker/animate/call-in.js +7 -2
- package/es/marker/animate/call-in.js.map +1 -1
- package/es/marker/animate/clip-in.js +7 -2
- package/es/marker/animate/clip-in.js.map +1 -1
- package/es/marker/animate/common.js +10 -2
- package/es/marker/animate/common.js.map +1 -1
- package/es/marker/base.d.ts +6 -2
- package/es/marker/base.js +51 -8
- package/es/marker/base.js.map +1 -1
- package/es/marker/type.d.ts +2 -1
- package/es/marker/type.js.map +1 -1
- package/es/timeline/timeline.js +36 -11
- package/es/timeline/timeline.js.map +1 -1
- package/es/title/title.js +5 -2
- package/es/title/title.js.map +1 -1
- package/package.json +6 -6
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventEmitter, Logger, isBoolean, isObject, isFunction, tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, isArray, cos, sin, pi, isString, pointAt, isNumber, sqrt, isPointInLine, Color,
|
|
1
|
+
import { EventEmitter, Logger, isBoolean, isObject, isFunction, tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, isArray, cos, sin, pi, isString, pointAt, isNumber, sqrt, isPointInLine, Color, OBBBounds, isEqual, isNil, normalTransform, isValidUrl, isBase64, getContextFont, rotatePoint, transformBoundsWithMatrix, clampAngleByRadian, asin, isNumberClose, TextMeasure, Bounds, getRectIntersect, isRectIntersect, arrayEqual, acos, isPlainObject as isPlainObject$3, merge, isValid, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isEmpty, array, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, normalizeAngle, isValidNumber, flattenArray, isRotateAABBIntersect, isLess, isGreater, aabbSeparation, obbSeparation, cloneDeep, get, last, mixin, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, pointInRect, calculateAnchorOfBounds, computeQuadrant, polygonContainPoint } from '@visactor/vutils';
|
|
2
2
|
import { isContinuous, isDiscrete, LinearScale } from '@visactor/vscale';
|
|
3
3
|
|
|
4
4
|
class Hook {
|
|
@@ -4800,9 +4800,172 @@ function classifyAttributeDelta(key, prev, next) {
|
|
|
4800
4800
|
}
|
|
4801
4801
|
|
|
4802
4802
|
const STAGE_PERF_MONITOR = Symbol("vrender.statePerfMonitor");
|
|
4803
|
+
function createReasonBreakdown() {
|
|
4804
|
+
return {
|
|
4805
|
+
config_disabled: 0,
|
|
4806
|
+
context_disabled: 0,
|
|
4807
|
+
non_batch_operation: 0,
|
|
4808
|
+
mixed_update_category: 0,
|
|
4809
|
+
resolver_unstable_keys: 0,
|
|
4810
|
+
graphic_unavailable: 0
|
|
4811
|
+
};
|
|
4812
|
+
}
|
|
4813
|
+
function createEmptyStatePerfSnapshot() {
|
|
4814
|
+
return {
|
|
4815
|
+
counters: {
|
|
4816
|
+
stateCommits: 0,
|
|
4817
|
+
sharedRefreshCommits: 0,
|
|
4818
|
+
deferredJobsCreated: 0,
|
|
4819
|
+
deferredJobsCompleted: 0,
|
|
4820
|
+
deferredJobsCancelled: 0,
|
|
4821
|
+
deferredJobsCoalesced: 0,
|
|
4822
|
+
deferredGraphicsCommitted: 0,
|
|
4823
|
+
deferredBudgetYields: 0,
|
|
4824
|
+
deferredIneligibleGraphics: 0
|
|
4825
|
+
},
|
|
4826
|
+
deferredIneligibleByReason: createReasonBreakdown(),
|
|
4827
|
+
categoryBreakdown: {
|
|
4828
|
+
paint: 0,
|
|
4829
|
+
transform: 0,
|
|
4830
|
+
shape: 0,
|
|
4831
|
+
bounds: 0,
|
|
4832
|
+
layout: 0,
|
|
4833
|
+
pick: 0
|
|
4834
|
+
},
|
|
4835
|
+
refresh: {
|
|
4836
|
+
queuedGraphics: 0,
|
|
4837
|
+
flushedGraphics: 0,
|
|
4838
|
+
ensureFreshCalls: 0,
|
|
4839
|
+
renderScheduled: 0
|
|
4840
|
+
},
|
|
4841
|
+
resolver: {
|
|
4842
|
+
cacheHits: 0,
|
|
4843
|
+
cacheMisses: 0,
|
|
4844
|
+
invalidations: 0
|
|
4845
|
+
},
|
|
4846
|
+
cost: {
|
|
4847
|
+
resolverTotalMs: 0,
|
|
4848
|
+
resolverMaxMs: 0,
|
|
4849
|
+
patchTotalMs: 0,
|
|
4850
|
+
patchMaxMs: 0,
|
|
4851
|
+
sharedRefreshTotalMs: 0,
|
|
4852
|
+
sharedRefreshMaxMs: 0,
|
|
4853
|
+
batchSliceTotalMs: 0,
|
|
4854
|
+
batchSliceMaxMs: 0
|
|
4855
|
+
},
|
|
4856
|
+
allocationHints: {
|
|
4857
|
+
patchObjectsCreated: 0,
|
|
4858
|
+
batchEntriesCreated: 0,
|
|
4859
|
+
refreshQueuePushes: 0
|
|
4860
|
+
},
|
|
4861
|
+
batch: {
|
|
4862
|
+
pendingJobs: 0,
|
|
4863
|
+
maxPendingJobs: 0,
|
|
4864
|
+
maxGraphicsInJob: 0,
|
|
4865
|
+
maxFrameSliceCost: 0
|
|
4866
|
+
},
|
|
4867
|
+
events: []
|
|
4868
|
+
};
|
|
4869
|
+
}
|
|
4870
|
+
function cloneSnapshot(snapshot) {
|
|
4871
|
+
return {
|
|
4872
|
+
counters: Object.assign({}, snapshot.counters),
|
|
4873
|
+
deferredIneligibleByReason: Object.assign({}, snapshot.deferredIneligibleByReason),
|
|
4874
|
+
categoryBreakdown: Object.assign({}, snapshot.categoryBreakdown),
|
|
4875
|
+
refresh: Object.assign({}, snapshot.refresh),
|
|
4876
|
+
resolver: Object.assign({}, snapshot.resolver),
|
|
4877
|
+
cost: Object.assign({}, snapshot.cost),
|
|
4878
|
+
allocationHints: Object.assign({}, snapshot.allocationHints),
|
|
4879
|
+
batch: Object.assign({}, snapshot.batch),
|
|
4880
|
+
events: snapshot.events ? snapshot.events.slice() : []
|
|
4881
|
+
};
|
|
4882
|
+
}
|
|
4883
|
+
class StatePerfMonitor {
|
|
4884
|
+
constructor(configSource) {
|
|
4885
|
+
this.configSource = configSource, this.snapshot = createEmptyStatePerfSnapshot();
|
|
4886
|
+
}
|
|
4887
|
+
setConfig(config) {
|
|
4888
|
+
this.configSource = config;
|
|
4889
|
+
}
|
|
4890
|
+
getSnapshot() {
|
|
4891
|
+
return cloneSnapshot(this.snapshot);
|
|
4892
|
+
}
|
|
4893
|
+
reset() {
|
|
4894
|
+
const next = createEmptyStatePerfSnapshot();
|
|
4895
|
+
Object.assign(this.snapshot.counters, next.counters), Object.assign(this.snapshot.deferredIneligibleByReason, next.deferredIneligibleByReason), Object.assign(this.snapshot.categoryBreakdown, next.categoryBreakdown), Object.assign(this.snapshot.refresh, next.refresh), Object.assign(this.snapshot.resolver, next.resolver), Object.assign(this.snapshot.cost, next.cost), Object.assign(this.snapshot.allocationHints, next.allocationHints), Object.assign(this.snapshot.batch, next.batch), this.snapshot.events = [];
|
|
4896
|
+
}
|
|
4897
|
+
incrementCounter(key, delta = 1) {
|
|
4898
|
+
this.isEnabled() && (this.snapshot.counters[key] += delta);
|
|
4899
|
+
}
|
|
4900
|
+
recordDeferredIneligible(reason, delta = 1) {
|
|
4901
|
+
this.isEnabled() && (this.snapshot.deferredIneligibleByReason[reason] += delta, this.snapshot.counters.deferredIneligibleGraphics += delta, this.recordEvent("deferred-ineligible", {
|
|
4902
|
+
reason: reason,
|
|
4903
|
+
count: delta
|
|
4904
|
+
}));
|
|
4905
|
+
}
|
|
4906
|
+
recordCategory(category) {
|
|
4907
|
+
this.isEnabled() && (category & UpdateCategory.PAINT && (this.snapshot.categoryBreakdown.paint += 1), category & UpdateCategory.TRANSFORM && (this.snapshot.categoryBreakdown.transform += 1), category & UpdateCategory.SHAPE && (this.snapshot.categoryBreakdown.shape += 1), category & UpdateCategory.BOUNDS && (this.snapshot.categoryBreakdown.bounds += 1), category & UpdateCategory.LAYOUT && (this.snapshot.categoryBreakdown.layout += 1), category & UpdateCategory.PICK && (this.snapshot.categoryBreakdown.pick += 1));
|
|
4908
|
+
}
|
|
4909
|
+
recordRefresh(key, delta = 1) {
|
|
4910
|
+
this.isEnabled() && (this.snapshot.refresh[key] += delta);
|
|
4911
|
+
}
|
|
4912
|
+
recordResolver(key, delta = 1) {
|
|
4913
|
+
this.isEnabled() && (this.snapshot.resolver[key] += delta);
|
|
4914
|
+
}
|
|
4915
|
+
recordCost(kind, durationMs) {
|
|
4916
|
+
if (this.isEnabled()) {
|
|
4917
|
+
if ("resolver" === kind) return this.snapshot.cost.resolverTotalMs += durationMs, void (this.snapshot.cost.resolverMaxMs = Math.max(this.snapshot.cost.resolverMaxMs, durationMs));
|
|
4918
|
+
if ("patch" === kind) return this.snapshot.cost.patchTotalMs += durationMs, void (this.snapshot.cost.patchMaxMs = Math.max(this.snapshot.cost.patchMaxMs, durationMs));
|
|
4919
|
+
if ("sharedRefresh" === kind) return this.snapshot.cost.sharedRefreshTotalMs += durationMs, void (this.snapshot.cost.sharedRefreshMaxMs = Math.max(this.snapshot.cost.sharedRefreshMaxMs, durationMs));
|
|
4920
|
+
this.snapshot.cost.batchSliceTotalMs += durationMs, this.snapshot.cost.batchSliceMaxMs = Math.max(this.snapshot.cost.batchSliceMaxMs, durationMs), this.snapshot.batch.maxFrameSliceCost = Math.max(this.snapshot.batch.maxFrameSliceCost, durationMs);
|
|
4921
|
+
}
|
|
4922
|
+
}
|
|
4923
|
+
recordAllocation(key, delta = 1) {
|
|
4924
|
+
this.isEnabled() && (this.snapshot.allocationHints[key] += delta);
|
|
4925
|
+
}
|
|
4926
|
+
updateBatchPending(pendingJobs) {
|
|
4927
|
+
this.isEnabled() && (this.snapshot.batch.pendingJobs = pendingJobs, this.snapshot.batch.maxPendingJobs = Math.max(this.snapshot.batch.maxPendingJobs, pendingJobs));
|
|
4928
|
+
}
|
|
4929
|
+
updateMaxGraphicsInJob(count) {
|
|
4930
|
+
this.isEnabled() && (this.snapshot.batch.maxGraphicsInJob = Math.max(this.snapshot.batch.maxGraphicsInJob, count));
|
|
4931
|
+
}
|
|
4932
|
+
recordEvent(type, detail) {
|
|
4933
|
+
var _a, _b, _c;
|
|
4934
|
+
if (!this.shouldRecordEvents()) return;
|
|
4935
|
+
const events = null !== (_a = this.snapshot.events) && void 0 !== _a ? _a : this.snapshot.events = [];
|
|
4936
|
+
events.push({
|
|
4937
|
+
type: type,
|
|
4938
|
+
at: Date.now(),
|
|
4939
|
+
detail: detail
|
|
4940
|
+
});
|
|
4941
|
+
const max = null !== (_c = null === (_b = this.getConfig()) || void 0 === _b ? void 0 : _b.maxEventRecords) && void 0 !== _c ? _c : 100;
|
|
4942
|
+
events.length > max && events.splice(0, events.length - max);
|
|
4943
|
+
}
|
|
4944
|
+
isEnabled() {
|
|
4945
|
+
var _a;
|
|
4946
|
+
return !0 === (null === (_a = this.getConfig()) || void 0 === _a ? void 0 : _a.enabled);
|
|
4947
|
+
}
|
|
4948
|
+
shouldRecordEvents() {
|
|
4949
|
+
const config = this.getConfig();
|
|
4950
|
+
return !!(null == config ? void 0 : config.enabled) && !!config.recordEvents;
|
|
4951
|
+
}
|
|
4952
|
+
getConfig() {
|
|
4953
|
+
return "function" == typeof this.configSource ? this.configSource() : this.configSource;
|
|
4954
|
+
}
|
|
4955
|
+
}
|
|
4956
|
+
function ensureStageStatePerfMonitor(stage) {
|
|
4957
|
+
const stageAny = stage;
|
|
4958
|
+
return stageAny[STAGE_PERF_MONITOR] || (stageAny[STAGE_PERF_MONITOR] = new StatePerfMonitor(() => stage.statePerfConfig)), stageAny[STAGE_PERF_MONITOR];
|
|
4959
|
+
}
|
|
4803
4960
|
function getStageStatePerfMonitor(stage) {
|
|
4804
4961
|
if (stage) return stage[STAGE_PERF_MONITOR];
|
|
4805
4962
|
}
|
|
4963
|
+
function getActiveStageStatePerfMonitor(stage) {
|
|
4964
|
+
var _a;
|
|
4965
|
+
if (!stage) return;
|
|
4966
|
+
const current = getStageStatePerfMonitor(stage);
|
|
4967
|
+
return current || (!0 === (null === (_a = stage.statePerfConfig) || void 0 === _a ? void 0 : _a.enabled) ? ensureStageStatePerfMonitor(stage) : void 0);
|
|
4968
|
+
}
|
|
4806
4969
|
|
|
4807
4970
|
function isPlainObject$1(value) {
|
|
4808
4971
|
return null != value && "object" == typeof value && !Array.isArray(value);
|
|
@@ -4898,7 +5061,7 @@ class StateEngine {
|
|
|
4898
5061
|
}
|
|
4899
5062
|
invalidateResolverCache() {
|
|
4900
5063
|
var _a, _b;
|
|
4901
|
-
this.resolverPatchCache.clear(), this.resolverCacheKey = "", this.resolverCacheValid = !1, null === (_b =
|
|
5064
|
+
this.resolverPatchCache.clear(), this.resolverCacheKey = "", this.resolverCacheValid = !1, null === (_b = getActiveStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage)) || void 0 === _b || _b.recordResolver("invalidations");
|
|
4902
5065
|
}
|
|
4903
5066
|
hasState(stateName) {
|
|
4904
5067
|
return !!this._activeStates.length && (null == stateName || this._activeStates.includes(stateName));
|
|
@@ -4945,7 +5108,7 @@ class StateEngine {
|
|
|
4945
5108
|
}
|
|
4946
5109
|
recomputePatch(effectiveStates) {
|
|
4947
5110
|
var _a;
|
|
4948
|
-
const perfMonitor =
|
|
5111
|
+
const perfMonitor = getActiveStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage),
|
|
4949
5112
|
patchStart = perfMonitor ? performance.now() : 0;
|
|
4950
5113
|
let resolverCost = 0;
|
|
4951
5114
|
const cacheKey = effectiveStates.join(","),
|
|
@@ -5193,32 +5356,6 @@ class StateStyleResolver {
|
|
|
5193
5356
|
}
|
|
5194
5357
|
}), resolvedAttrs;
|
|
5195
5358
|
}
|
|
5196
|
-
resolveWithCompiled(normalAttrs, compiledDefinitions, stateProxy, effectiveStates, resolvedPatch) {
|
|
5197
|
-
var _a, _b;
|
|
5198
|
-
const mergeMode = null !== (_a = this.options.mergeMode) && void 0 !== _a ? _a : "shallow",
|
|
5199
|
-
resolvedAttrs = null !== (_b = cloneValue(resolvedPatch)) && void 0 !== _b ? _b : {};
|
|
5200
|
-
return effectiveStates.forEach(stateName => {
|
|
5201
|
-
const proxyPatch = null == stateProxy ? void 0 : stateProxy(stateName, effectiveStates);
|
|
5202
|
-
null != proxyPatch && Object.keys(proxyPatch).forEach(key => {
|
|
5203
|
-
const nextValue = proxyPatch[key],
|
|
5204
|
-
hasCompiledDefinition = compiledDefinitions.has(stateName);
|
|
5205
|
-
if ("deep" === mergeMode && isPlainObject(nextValue) && (isPlainObject(resolvedAttrs[key]) || !hasCompiledDefinition && isPlainObject(normalAttrs[key]))) {
|
|
5206
|
-
const baseValue = isPlainObject(resolvedAttrs[key]) ? resolvedAttrs[key] : isPlainObject(normalAttrs[key]) ? normalAttrs[key] : {};
|
|
5207
|
-
resolvedAttrs[key] = deepMerge(baseValue, nextValue);
|
|
5208
|
-
} else resolvedAttrs[key] = cloneValue(nextValue);
|
|
5209
|
-
});
|
|
5210
|
-
}), resolvedAttrs;
|
|
5211
|
-
}
|
|
5212
|
-
computeNormalAttrsBackup(normalAttrs, targetAttrs, finalAttribute) {
|
|
5213
|
-
const nextNormalAttrs = {},
|
|
5214
|
-
nextTargetAttrs = Object.assign({}, targetAttrs);
|
|
5215
|
-
for (const key in targetAttrs) Object.prototype.hasOwnProperty.call(targetAttrs, key) && (nextNormalAttrs[key] = cloneValue(normalAttrs && key in normalAttrs ? normalAttrs[key] : finalAttribute[key]));
|
|
5216
|
-
if (normalAttrs) for (const key in normalAttrs) Object.prototype.hasOwnProperty.call(normalAttrs, key) && !(key in targetAttrs) && (nextTargetAttrs[key] = cloneValue(normalAttrs[key]));
|
|
5217
|
-
return {
|
|
5218
|
-
attrs: nextTargetAttrs,
|
|
5219
|
-
normalAttrs: nextNormalAttrs
|
|
5220
|
-
};
|
|
5221
|
-
}
|
|
5222
5359
|
}
|
|
5223
5360
|
|
|
5224
5361
|
function hasOwnKeys(value) {
|
|
@@ -5240,11 +5377,23 @@ class StateTransitionOrchestrator {
|
|
|
5240
5377
|
if (!hasAnimation) return plan;
|
|
5241
5378
|
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)),
|
|
5242
5379
|
isClear = !0 === options.isClear,
|
|
5243
|
-
getDefaultAttribute = options.getDefaultAttribute
|
|
5380
|
+
getDefaultAttribute = options.getDefaultAttribute,
|
|
5381
|
+
shouldSkipDefaultAttribute = options.shouldSkipDefaultAttribute,
|
|
5382
|
+
assignTransitionAttr = (key, value) => {
|
|
5383
|
+
if (noWorkAnimateAttr[key]) return plan.jumpAttrs[key] = value, void (plan.noAnimateAttrs[key] = value);
|
|
5384
|
+
if (isClear && void 0 === value) {
|
|
5385
|
+
if (null == shouldSkipDefaultAttribute ? void 0 : shouldSkipDefaultAttribute(key, targetAttrs)) return;
|
|
5386
|
+
plan.animateAttrs[key] = getDefaultAttribute ? getDefaultAttribute(key) : value;
|
|
5387
|
+
} else plan.animateAttrs[key] = value;
|
|
5388
|
+
};
|
|
5244
5389
|
for (const key in targetAttrs) {
|
|
5245
5390
|
if (!Object.prototype.hasOwnProperty.call(targetAttrs, key)) continue;
|
|
5246
|
-
|
|
5247
|
-
|
|
5391
|
+
assignTransitionAttr(key, targetAttrs[key]);
|
|
5392
|
+
}
|
|
5393
|
+
const extraAnimateAttrs = options.extraAnimateAttrs;
|
|
5394
|
+
if (extraAnimateAttrs) for (const key in extraAnimateAttrs) {
|
|
5395
|
+
const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetAttrs, key);
|
|
5396
|
+
!Object.prototype.hasOwnProperty.call(extraAnimateAttrs, key) || hasTargetAttr && void 0 !== targetAttrs[key] || assignTransitionAttr(key, extraAnimateAttrs[key]);
|
|
5248
5397
|
}
|
|
5249
5398
|
return plan;
|
|
5250
5399
|
}
|
|
@@ -5271,12 +5420,14 @@ class StateTransitionOrchestrator {
|
|
|
5271
5420
|
}), plan;
|
|
5272
5421
|
}
|
|
5273
5422
|
applyClearTransition(graphic, targetAttrs, hasAnimation, stateNames, options = {}) {
|
|
5274
|
-
var _a, _b;
|
|
5423
|
+
var _a, _b, _c, _d;
|
|
5275
5424
|
const plan = this.analyzeTransition({}, targetAttrs, stateNames, hasAnimation, {
|
|
5276
5425
|
noWorkAnimateAttr: null === (_a = graphic.getNoWorkAnimateAttr) || void 0 === _a ? void 0 : _a.call(graphic),
|
|
5277
5426
|
isClear: !0,
|
|
5278
5427
|
getDefaultAttribute: null === (_b = graphic.getDefaultAttribute) || void 0 === _b ? void 0 : _b.bind(graphic),
|
|
5279
|
-
|
|
5428
|
+
shouldSkipDefaultAttribute: null !== (_c = options.shouldSkipDefaultAttribute) && void 0 !== _c ? _c : null === (_d = graphic.shouldSkipStateTransitionDefaultAttribute) || void 0 === _d ? void 0 : _d.bind(graphic),
|
|
5429
|
+
animateConfig: options.animateConfig,
|
|
5430
|
+
extraAnimateAttrs: options.extraAnimateAttrs
|
|
5280
5431
|
});
|
|
5281
5432
|
return this.applyTransition(graphic, plan, hasAnimation, options);
|
|
5282
5433
|
}
|
|
@@ -5324,7 +5475,7 @@ function rebuildSharedStateScope(scope) {
|
|
|
5324
5475
|
}
|
|
5325
5476
|
function ensureSharedStateScopeFresh(scope) {
|
|
5326
5477
|
var _a;
|
|
5327
|
-
if (scope) return null === (_a =
|
|
5478
|
+
if (scope) return null === (_a = getActiveStageStatePerfMonitor(scope.ownerStage)) || void 0 === _a || _a.recordRefresh("ensureFreshCalls"), scope.parentScope && ensureSharedStateScopeFresh(scope.parentScope), (scope.dirty || scope.parentScope && scope.parentRevisionAtBuild !== scope.parentScope.revision) && rebuildSharedStateScope(scope), scope;
|
|
5328
5479
|
}
|
|
5329
5480
|
function collectSharedStateScopeChain(scope) {
|
|
5330
5481
|
const chain = [];
|
|
@@ -5335,7 +5486,7 @@ function collectSharedStateScopeChain(scope) {
|
|
|
5335
5486
|
|
|
5336
5487
|
function scheduleStageSharedStateRefresh(stage) {
|
|
5337
5488
|
var _a;
|
|
5338
|
-
stage && "released" !== stage.releaseStatus && (null === (_a =
|
|
5489
|
+
stage && "released" !== stage.releaseStatus && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordRefresh("renderScheduled"), stage.renderNextFrame());
|
|
5339
5490
|
}
|
|
5340
5491
|
function enqueueGraphicSharedStateRefresh(stage, graphic) {
|
|
5341
5492
|
var _a;
|
|
@@ -5343,7 +5494,7 @@ function enqueueGraphicSharedStateRefresh(stage, graphic) {
|
|
|
5343
5494
|
const pending = null !== (_a = stage._pendingSharedStateRefreshGraphics) && void 0 !== _a ? _a : stage._pendingSharedStateRefreshGraphics = new Set();
|
|
5344
5495
|
if (!pending.has(graphic)) {
|
|
5345
5496
|
pending.add(graphic);
|
|
5346
|
-
const perfMonitor =
|
|
5497
|
+
const perfMonitor = getActiveStageStatePerfMonitor(stage);
|
|
5347
5498
|
null == perfMonitor || perfMonitor.recordRefresh("queuedGraphics"), null == perfMonitor || perfMonitor.recordAllocation("refreshQueuePushes");
|
|
5348
5499
|
}
|
|
5349
5500
|
}
|
|
@@ -5363,9 +5514,12 @@ const tempConstantXYKey = ["x", "y"],
|
|
|
5363
5514
|
tempConstantScaleXYKey = ["scaleX", "scaleY"],
|
|
5364
5515
|
tempConstantAngleKey = ["angle"],
|
|
5365
5516
|
builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
|
|
5366
|
-
|
|
5517
|
+
FULL_STATE_DEFINITION_KEYS = new Set(["name", "patch", "priority", "exclude", "suppress", "resolver", "declaredAffectedKeys"]),
|
|
5518
|
+
point = new Point(),
|
|
5519
|
+
EMPTY_STATE_NAMES = [],
|
|
5520
|
+
BROAD_UPDATE_CATEGORY = UpdateCategory.PAINT | UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.TRANSFORM | UpdateCategory.LAYOUT;
|
|
5367
5521
|
function isPlainObjectValue(value) {
|
|
5368
|
-
return "object" == typeof value && null != value && !isArray(value);
|
|
5522
|
+
return "object" == typeof value && null != value && !Array.isArray(value);
|
|
5369
5523
|
}
|
|
5370
5524
|
function cloneAttributeValue(value) {
|
|
5371
5525
|
if (!isPlainObjectValue(value)) return value;
|
|
@@ -5376,12 +5530,6 @@ function cloneAttributeValue(value) {
|
|
|
5376
5530
|
clone[key] = isPlainObjectValue(nextValue) ? cloneAttributeValue(nextValue) : nextValue;
|
|
5377
5531
|
}), clone;
|
|
5378
5532
|
}
|
|
5379
|
-
function cloneSimpleAttributeRecord(value) {
|
|
5380
|
-
return isPlainObjectValue(value) ? Object.assign({}, value) : value;
|
|
5381
|
-
}
|
|
5382
|
-
function shouldUseSimpleAttributeFastPath(value) {
|
|
5383
|
-
return !!isPlainObjectValue(value) && !Object.keys(value).some(key => isPlainObjectValue(value[key]));
|
|
5384
|
-
}
|
|
5385
5533
|
function cloneAttributeSurface(value) {
|
|
5386
5534
|
if (!isPlainObjectValue(value)) return value;
|
|
5387
5535
|
const source = value,
|
|
@@ -5391,6 +5539,9 @@ function cloneAttributeSurface(value) {
|
|
|
5391
5539
|
clone[key] = isPlainObjectValue(nextValue) ? Object.assign({}, nextValue) : nextValue;
|
|
5392
5540
|
}), clone;
|
|
5393
5541
|
}
|
|
5542
|
+
function areAttributeValuesEqual(left, right) {
|
|
5543
|
+
return left === right || !!(isPlainObjectValue(left) || isPlainObjectValue(right) || Array.isArray(left) || Array.isArray(right)) && isEqual(left, right);
|
|
5544
|
+
}
|
|
5394
5545
|
function deepMergeAttributeValue(base, value) {
|
|
5395
5546
|
var _a;
|
|
5396
5547
|
const result = null !== (_a = cloneAttributeValue(base)) && void 0 !== _a ? _a : {};
|
|
@@ -5453,18 +5604,24 @@ class Graphic extends Node {
|
|
|
5453
5604
|
get globalTransMatrix() {
|
|
5454
5605
|
return this.tryUpdateGlobalTransMatrix(!0);
|
|
5455
5606
|
}
|
|
5607
|
+
get baseAttributes() {
|
|
5608
|
+
var _a;
|
|
5609
|
+
return null !== (_a = this._baseAttributes) && void 0 !== _a ? _a : this.attribute;
|
|
5610
|
+
}
|
|
5611
|
+
set baseAttributes(value) {
|
|
5612
|
+
value !== this.attribute ? this._baseAttributes = value : this._baseAttributes = void 0;
|
|
5613
|
+
}
|
|
5456
5614
|
constructor(params = {}) {
|
|
5457
5615
|
var _a;
|
|
5458
|
-
super(), this.
|
|
5459
|
-
const useSimpleAttributeFastPath = shouldUseSimpleAttributeFastPath(params),
|
|
5460
|
-
initialBaseAttributes = useSimpleAttributeFastPath ? cloneSimpleAttributeRecord(params) : cloneAttributeValue(params);
|
|
5461
|
-
this.baseAttributes = initialBaseAttributes, this.attribute = useSimpleAttributeFastPath ? cloneSimpleAttributeRecord(initialBaseAttributes) : cloneAttributeSurface(initialBaseAttributes), this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background && this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0), isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
|
|
5616
|
+
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background && this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0), params.texture && isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
|
|
5462
5617
|
}
|
|
5463
5618
|
get normalAttrs() {
|
|
5464
5619
|
return this.baseAttributes;
|
|
5465
5620
|
}
|
|
5466
|
-
set normalAttrs(
|
|
5467
|
-
|
|
5621
|
+
set normalAttrs(_value) {}
|
|
5622
|
+
getBaseAttributesStorage() {
|
|
5623
|
+
var _a;
|
|
5624
|
+
return null !== (_a = this._baseAttributes) && void 0 !== _a ? _a : this.attribute;
|
|
5468
5625
|
}
|
|
5469
5626
|
getGraphicService() {
|
|
5470
5627
|
var _a, _b;
|
|
@@ -5495,10 +5652,18 @@ class Graphic extends Node {
|
|
|
5495
5652
|
const nextScope = this.resolveBoundSharedStateScope();
|
|
5496
5653
|
return this.boundSharedStateScope === nextScope ? (this.syncSharedStateActiveRegistrations(), !1) : (this.boundSharedStateScope = nextScope, this.boundSharedStateRevision = void 0, this.localFallbackCompiledDefinitions = void 0, this.compiledStateDefinitions = void 0, this.compiledStateDefinitionsCacheKey = void 0, this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0, this.stateEngineStateProxyModeKey = void 0, this.syncSharedStateActiveRegistrations(), markDirty && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.markSharedStateDirty(), !0);
|
|
5497
5654
|
}
|
|
5498
|
-
|
|
5655
|
+
syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
|
|
5499
5656
|
var _a, _b;
|
|
5500
|
-
|
|
5501
|
-
|
|
5657
|
+
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);
|
|
5658
|
+
}
|
|
5659
|
+
syncSharedStateActiveRegistrations() {
|
|
5660
|
+
var _a;
|
|
5661
|
+
const previousScopes = this.registeredActiveScopes;
|
|
5662
|
+
if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
|
|
5663
|
+
scope.subtreeActiveDescendants.delete(this);
|
|
5664
|
+
}), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
|
|
5665
|
+
const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
|
|
5666
|
+
null == previousScopes || previousScopes.forEach(scope => {
|
|
5502
5667
|
nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
|
|
5503
5668
|
}), nextScopes.forEach(scope => {
|
|
5504
5669
|
scope.subtreeActiveDescendants.add(this);
|
|
@@ -5514,15 +5679,13 @@ class Graphic extends Node {
|
|
|
5514
5679
|
this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
|
|
5515
5680
|
}
|
|
5516
5681
|
onParentSharedStateTreeChanged(stage, layer) {
|
|
5517
|
-
this.stage === stage && this.layer === layer ? this.
|
|
5682
|
+
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
|
|
5518
5683
|
}
|
|
5519
5684
|
refreshSharedStateBeforeRender() {
|
|
5520
5685
|
var _a;
|
|
5521
5686
|
(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) ? (this.syncSharedStateScopeBindingFromTree(!1), this.boundSharedStateScope && ensureSharedStateScopeFresh(this.boundSharedStateScope), this.recomputeCurrentStatePatch(), this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
|
|
5522
5687
|
type: AttributeUpdateType.STATE
|
|
5523
|
-
}), this.
|
|
5524
|
-
type: AttributeUpdateType.STATE
|
|
5525
|
-
}), this.sharedStateDirty = !1) : this.sharedStateDirty = !1;
|
|
5688
|
+
}), this.emitStateUpdateEvent(), this.sharedStateDirty = !1) : this.sharedStateDirty = !1;
|
|
5526
5689
|
}
|
|
5527
5690
|
getLocalStatesVersion() {
|
|
5528
5691
|
var _a, _b;
|
|
@@ -5572,15 +5735,13 @@ class Graphic extends Node {
|
|
|
5572
5735
|
};
|
|
5573
5736
|
}
|
|
5574
5737
|
recomputeCurrentStatePatch() {
|
|
5575
|
-
var _a, _b
|
|
5738
|
+
var _a, _b;
|
|
5576
5739
|
if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length)) return this.effectiveStates = [], this.resolvedStatePatch = void 0, void this.syncSharedStateActiveRegistrations();
|
|
5577
|
-
const stateResolveBaseAttrs =
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
const transition = stateModel.useStates(this.currentStates),
|
|
5581
|
-
effectiveStates = null !== (_d = transition.effectiveStates) && void 0 !== _d ? _d : transition.states,
|
|
5740
|
+
const stateResolveBaseAttrs = this.getStateResolveBaseAttrs(),
|
|
5741
|
+
transition = this.createStateModel(stateResolveBaseAttrs).useStates(this.currentStates),
|
|
5742
|
+
effectiveStates = null !== (_b = transition.effectiveStates) && void 0 !== _b ? _b : transition.states,
|
|
5582
5743
|
resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
|
|
5583
|
-
this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch =
|
|
5744
|
+
this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.syncSharedStateActiveRegistrations();
|
|
5584
5745
|
}
|
|
5585
5746
|
buildStaticAttributeSnapshot() {
|
|
5586
5747
|
var _a;
|
|
@@ -5592,6 +5753,23 @@ class Graphic extends Node {
|
|
|
5592
5753
|
"deep" === this.stateMergeMode && isPlainObjectValue(previousValue) && isPlainObjectValue(nextValue) ? snapshot[key] = deepMergeAttributeValue(previousValue, nextValue) : snapshot[key] = cloneAttributeValue(nextValue);
|
|
5593
5754
|
}), snapshot) : snapshot;
|
|
5594
5755
|
}
|
|
5756
|
+
buildRemovedStateAnimationAttrs(targetStateAttrs, previousResolvedStatePatch) {
|
|
5757
|
+
const extraAttrs = {};
|
|
5758
|
+
if (!previousResolvedStatePatch) return extraAttrs;
|
|
5759
|
+
const snapshot = this.buildStaticAttributeSnapshot(),
|
|
5760
|
+
staticTargetAttrs = snapshot;
|
|
5761
|
+
return Object.keys(previousResolvedStatePatch).forEach(key => {
|
|
5762
|
+
const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetStateAttrs, key);
|
|
5763
|
+
if (hasTargetAttr && void 0 !== targetStateAttrs[key]) return;
|
|
5764
|
+
const assignFallbackAttr = value => {
|
|
5765
|
+
void 0 === value && this.shouldSkipStateTransitionDefaultAttribute(key, staticTargetAttrs) || (extraAttrs[key] = void 0 === value ? value : cloneAttributeValue(value));
|
|
5766
|
+
};
|
|
5767
|
+
if (hasTargetAttr) assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));else if (Object.prototype.hasOwnProperty.call(snapshot, key)) {
|
|
5768
|
+
const snapshotValue = snapshot[key];
|
|
5769
|
+
assignFallbackAttr(void 0 === snapshotValue ? this.getStateTransitionDefaultAttribute(key, staticTargetAttrs) : snapshotValue);
|
|
5770
|
+
} else assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));
|
|
5771
|
+
}), extraAttrs;
|
|
5772
|
+
}
|
|
5595
5773
|
syncObjectToSnapshot(target, snapshot) {
|
|
5596
5774
|
const delta = new Map();
|
|
5597
5775
|
return new Set([...Object.keys(target), ...Object.keys(snapshot)]).forEach(key => {
|
|
@@ -5602,16 +5780,17 @@ class Graphic extends Node {
|
|
|
5602
5780
|
next: void 0
|
|
5603
5781
|
}), delete target[key]));
|
|
5604
5782
|
const nextValue = snapshot[key];
|
|
5605
|
-
|
|
5783
|
+
areAttributeValuesEqual(previousValue, nextValue) || (delta.set(key, {
|
|
5606
5784
|
prev: previousValue,
|
|
5607
5785
|
next: nextValue
|
|
5608
5786
|
}), target[key] = cloneAttributeValue(nextValue));
|
|
5609
5787
|
}), delta;
|
|
5610
5788
|
}
|
|
5611
5789
|
_syncAttribute() {
|
|
5790
|
+
this.attribute === this.baseAttributes && this.resolvedStatePatch && this.detachAttributeFromBaseAttributes();
|
|
5612
5791
|
const snapshot = this.buildStaticAttributeSnapshot(),
|
|
5613
5792
|
delta = this.syncObjectToSnapshot(this.attribute, snapshot);
|
|
5614
|
-
return this.valid = this.isValid(), delta;
|
|
5793
|
+
return this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, delta;
|
|
5615
5794
|
}
|
|
5616
5795
|
_syncFinalAttributeFromStaticTruth() {
|
|
5617
5796
|
const target = this.finalAttribute;
|
|
@@ -5619,47 +5798,146 @@ class Graphic extends Node {
|
|
|
5619
5798
|
const snapshot = this.buildStaticAttributeSnapshot();
|
|
5620
5799
|
this.syncObjectToSnapshot(target, snapshot);
|
|
5621
5800
|
}
|
|
5622
|
-
|
|
5801
|
+
mergeAttributeDeltaCategory(category, key, prev, next) {
|
|
5802
|
+
var _a;
|
|
5803
|
+
let nextCategory = "stroke" === key || "shadowBlur" === key ? classifyAttributeDelta(key, prev, next) : null !== (_a = ATTRIBUTE_CATEGORY[key]) && void 0 !== _a ? _a : UpdateCategory.PAINT;
|
|
5804
|
+
return nextCategory & UpdateCategory.PICK && (nextCategory |= UpdateCategory.BOUNDS), nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key) && (nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS), category | nextCategory;
|
|
5805
|
+
}
|
|
5806
|
+
submitUpdateByCategory(category, forceUpdateTag = !1) {
|
|
5623
5807
|
var _a;
|
|
5624
5808
|
if (forceUpdateTag) return this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), void this.addUpdateLayoutTag();
|
|
5809
|
+
if (category !== UpdateCategory.NONE) {
|
|
5810
|
+
const stage = this.stage;
|
|
5811
|
+
stage && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordCategory(category));
|
|
5812
|
+
}
|
|
5813
|
+
(category & BROAD_UPDATE_CATEGORY) !== BROAD_UPDATE_CATEGORY ? (category & UpdateCategory.SHAPE ? this.addUpdateShapeAndBoundsTag() : category & UpdateCategory.BOUNDS && this.addUpdateBoundTag(), category & UpdateCategory.PAINT && this.addUpdatePaintTag(), category & UpdateCategory.TRANSFORM && this.addUpdatePositionTag(), category & UpdateCategory.LAYOUT && this.addUpdateLayoutTag()) : this.addBroadUpdateTag();
|
|
5814
|
+
}
|
|
5815
|
+
submitUpdateByDelta(delta, forceUpdateTag = !1) {
|
|
5625
5816
|
let category = UpdateCategory.NONE;
|
|
5626
5817
|
delta.forEach((entry, key) => {
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5818
|
+
category = this.mergeAttributeDeltaCategory(category, key, entry.prev, entry.next);
|
|
5819
|
+
}), this.submitUpdateByCategory(category, forceUpdateTag);
|
|
5820
|
+
}
|
|
5821
|
+
submitTouchedKeyUpdate(keys, forceUpdateTag = !1) {
|
|
5822
|
+
this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTags(keys));
|
|
5823
|
+
}
|
|
5824
|
+
submitTouchedUpdate(needsShapeAndBounds) {
|
|
5825
|
+
!this.updateShapeAndBoundsTagSetted() && needsShapeAndBounds ? this.addUpdateShapeAndBoundsTag() : this.addUpdateBoundTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag();
|
|
5630
5826
|
}
|
|
5631
5827
|
commitBaseAttributeMutation(forceUpdateTag = !1, context) {
|
|
5632
|
-
var _a, _b;
|
|
5633
|
-
(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && (this.resolverEpoch
|
|
5828
|
+
var _a, _b, _c;
|
|
5829
|
+
(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && (this.resolverEpoch = (null !== (_b = this.resolverEpoch) && void 0 !== _b ? _b : 0) + 1, null === (_c = this.stateEngine) || void 0 === _c || _c.invalidateResolverCache(), this.recomputeCurrentStatePatch());
|
|
5634
5830
|
const delta = this._syncAttribute();
|
|
5635
5831
|
this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
|
|
5636
5832
|
}
|
|
5833
|
+
canCommitBaseAttributesByTouchedKeys() {
|
|
5834
|
+
var _a, _b;
|
|
5835
|
+
return !((null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || this.resolvedStatePatch || this.attributeMayContainTransientAttrs) && (!(null === (_b = this.animates) || void 0 === _b ? void 0 : _b.size) && !this._animationStateManager || !this.hasAnyTrackedAnimate());
|
|
5836
|
+
}
|
|
5837
|
+
detachAttributeFromBaseAttributes() {
|
|
5838
|
+
this.attribute === this.baseAttributes && (this._baseAttributes = this.attribute, this.attribute = cloneAttributeSurface(this.attribute));
|
|
5839
|
+
}
|
|
5840
|
+
commitInternalBaseAttributes(params, context) {
|
|
5841
|
+
params && Object.keys(params).length && (this.canCommitBaseAttributesByTouchedKeys() ? this.commitBaseAttributesByTouchedKeys(params, !1, context) : (this.detachAttributeFromBaseAttributes(), this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context)));
|
|
5842
|
+
}
|
|
5843
|
+
commitBaseAttributesByTouchedKeys(params, forceUpdateTag = !1, context) {
|
|
5844
|
+
const source = params,
|
|
5845
|
+
baseAttributes = this.getBaseAttributesStorage();
|
|
5846
|
+
let hasKeys = !1,
|
|
5847
|
+
needsShapeAndBounds = forceUpdateTag;
|
|
5848
|
+
for (const key in source) Object.prototype.hasOwnProperty.call(source, key) && (hasKeys = !0, baseAttributes[key] = source[key], !needsShapeAndBounds && this.needUpdateTag(key) && (needsShapeAndBounds = !0));
|
|
5849
|
+
hasKeys && (this.attribute = baseAttributes, this._baseAttributes = void 0, this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, this.submitTouchedUpdate(needsShapeAndBounds), this.onAttributeUpdate(context));
|
|
5850
|
+
}
|
|
5851
|
+
commitBaseAttributeBySingleKey(key, value, forceUpdateTag = !1, context) {
|
|
5852
|
+
this.getBaseAttributesStorage()[key] = value, this.attribute = this.getBaseAttributesStorage(), this._baseAttributes = void 0, this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTag(key)), this.onAttributeUpdate(context);
|
|
5853
|
+
}
|
|
5637
5854
|
applyBaseAttributes(params) {
|
|
5638
5855
|
const keys = Object.keys(params);
|
|
5639
5856
|
for (let i = 0; i < keys.length; i++) {
|
|
5640
5857
|
const key = keys[i];
|
|
5641
|
-
this.
|
|
5858
|
+
this.getBaseAttributesStorage()[key] = params[key];
|
|
5642
5859
|
}
|
|
5643
5860
|
}
|
|
5861
|
+
applyAnimationTransientAttributes(params, forceUpdateTag = !1, context) {
|
|
5862
|
+
const source = params;
|
|
5863
|
+
let target,
|
|
5864
|
+
needsShapeAndBounds = forceUpdateTag;
|
|
5865
|
+
for (const key in source) Object.prototype.hasOwnProperty.call(source, key) && (target || (this.detachAttributeFromBaseAttributes(), target = this.attribute), target[key] = source[key], !needsShapeAndBounds && this.needUpdateTag(key) && (needsShapeAndBounds = !0));
|
|
5866
|
+
target && (this.attributeMayContainTransientAttrs = !0, this.valid = this.isValid(), this.submitTouchedUpdate(needsShapeAndBounds), this.onAttributeUpdate(context));
|
|
5867
|
+
}
|
|
5644
5868
|
applyTransientAttributes(params, forceUpdateTag = !1, context) {
|
|
5869
|
+
this.detachAttributeFromBaseAttributes();
|
|
5645
5870
|
const delta = new Map(),
|
|
5646
5871
|
keys = Object.keys(params);
|
|
5647
5872
|
for (let i = 0; i < keys.length; i++) {
|
|
5648
5873
|
const key = keys[i],
|
|
5649
5874
|
previousValue = this.attribute[key],
|
|
5650
5875
|
nextValue = params[key];
|
|
5651
|
-
|
|
5876
|
+
areAttributeValuesEqual(previousValue, nextValue) || (delta.set(key, {
|
|
5652
5877
|
prev: previousValue,
|
|
5653
5878
|
next: nextValue
|
|
5654
|
-
}), this.attribute[key] =
|
|
5879
|
+
}), this.attribute[key] = nextValue);
|
|
5655
5880
|
}
|
|
5656
|
-
this.valid = this.isValid(), this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
|
|
5881
|
+
delta.size && (this.attributeMayContainTransientAttrs = !0), this.valid = this.isValid(), this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
|
|
5657
5882
|
}
|
|
5658
5883
|
_restoreAttributeFromStaticTruth(context) {
|
|
5659
5884
|
this._syncFinalAttributeFromStaticTruth();
|
|
5660
5885
|
const delta = this._syncAttribute();
|
|
5661
5886
|
this.submitUpdateByDelta(delta), this.onAttributeUpdate(context);
|
|
5662
5887
|
}
|
|
5888
|
+
collectStatePatchDeltaKeys(previousPatch, nextPatch) {
|
|
5889
|
+
const keys = previousPatch ? Object.keys(previousPatch) : [];
|
|
5890
|
+
if (!nextPatch) return keys;
|
|
5891
|
+
for (const key in nextPatch) Object.prototype.hasOwnProperty.call(nextPatch, key) && !Object.prototype.hasOwnProperty.call(null != previousPatch ? previousPatch : {}, key) && keys.push(key);
|
|
5892
|
+
return keys;
|
|
5893
|
+
}
|
|
5894
|
+
getStaticTruthValueForStateKey(key, nextPatch) {
|
|
5895
|
+
var _a;
|
|
5896
|
+
const baseAttributes = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : {},
|
|
5897
|
+
patch = nextPatch;
|
|
5898
|
+
if (patch && Object.prototype.hasOwnProperty.call(patch, key)) {
|
|
5899
|
+
const patchValue = patch[key],
|
|
5900
|
+
baseValue = baseAttributes[key];
|
|
5901
|
+
return "deep" === this.stateMergeMode && isPlainObjectValue(baseValue) && isPlainObjectValue(patchValue) ? {
|
|
5902
|
+
hasValue: !0,
|
|
5903
|
+
value: deepMergeAttributeValue(baseValue, patchValue)
|
|
5904
|
+
} : {
|
|
5905
|
+
hasValue: !0,
|
|
5906
|
+
value: patchValue
|
|
5907
|
+
};
|
|
5908
|
+
}
|
|
5909
|
+
return Object.prototype.hasOwnProperty.call(baseAttributes, key) ? {
|
|
5910
|
+
hasValue: !0,
|
|
5911
|
+
value: baseAttributes[key]
|
|
5912
|
+
} : {
|
|
5913
|
+
hasValue: !1,
|
|
5914
|
+
value: void 0
|
|
5915
|
+
};
|
|
5916
|
+
}
|
|
5917
|
+
syncStatePatchDeltaToTarget(target, keys, nextPatch, collectCategory = !1) {
|
|
5918
|
+
let category = UpdateCategory.NONE;
|
|
5919
|
+
for (let i = 0; i < keys.length; i++) {
|
|
5920
|
+
const key = keys[i],
|
|
5921
|
+
previousValue = target[key],
|
|
5922
|
+
next = this.getStaticTruthValueForStateKey(key, nextPatch);
|
|
5923
|
+
if (!next.hasValue) {
|
|
5924
|
+
Object.prototype.hasOwnProperty.call(target, key) && (delete target[key], collectCategory && (category = this.mergeAttributeDeltaCategory(category, key, previousValue, void 0)));
|
|
5925
|
+
continue;
|
|
5926
|
+
}
|
|
5927
|
+
if (areAttributeValuesEqual(previousValue, next.value)) continue;
|
|
5928
|
+
const nextValue = cloneAttributeValue(next.value);
|
|
5929
|
+
target[key] = nextValue, collectCategory && (category = this.mergeAttributeDeltaCategory(category, key, previousValue, nextValue));
|
|
5930
|
+
}
|
|
5931
|
+
return category;
|
|
5932
|
+
}
|
|
5933
|
+
restoreAttributeFromStatePatchDelta(previousPatch, nextPatch, context) {
|
|
5934
|
+
this.detachAttributeFromBaseAttributes();
|
|
5935
|
+
const keys = this.collectStatePatchDeltaKeys(previousPatch, nextPatch),
|
|
5936
|
+
finalAttribute = this.finalAttribute;
|
|
5937
|
+
finalAttribute && this.syncStatePatchDeltaToTarget(finalAttribute, keys, nextPatch, !1);
|
|
5938
|
+
const category = this.syncStatePatchDeltaToTarget(this.attribute, keys, nextPatch, !0);
|
|
5939
|
+
this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, this.submitUpdateByCategory(category), this.onAttributeUpdate(context);
|
|
5940
|
+
}
|
|
5663
5941
|
setMode(mode) {
|
|
5664
5942
|
"3d" === mode ? this.set3dMode() : this.set2dMode();
|
|
5665
5943
|
}
|
|
@@ -5682,7 +5960,7 @@ class Graphic extends Node {
|
|
|
5682
5960
|
return point;
|
|
5683
5961
|
}
|
|
5684
5962
|
onAnimateBind(animate) {
|
|
5685
|
-
this._emitCustomEvent("animate-bind", animate);
|
|
5963
|
+
this.detachAttributeFromBaseAttributes(), this._emitCustomEvent("animate-bind", animate);
|
|
5686
5964
|
}
|
|
5687
5965
|
visitTrackedAnimates(cb) {
|
|
5688
5966
|
const hook = this.forEachTrackedAnimate;
|
|
@@ -5695,8 +5973,22 @@ class Graphic extends Node {
|
|
|
5695
5973
|
const getTrackedAnimates = this.getTrackedAnimates;
|
|
5696
5974
|
return "function" == typeof getTrackedAnimates ? getTrackedAnimates.call(this).size > 0 : !!(null === (_a = this.animates) || void 0 === _a ? void 0 : _a.size);
|
|
5697
5975
|
}
|
|
5976
|
+
mayHaveTrackedAnimates() {
|
|
5977
|
+
var _a;
|
|
5978
|
+
return !!(null === (_a = this.animates) || void 0 === _a ? void 0 : _a.size) || !!this._animationStateManager;
|
|
5979
|
+
}
|
|
5698
5980
|
tryUpdateAABBBounds() {
|
|
5981
|
+
if (!(this.shadowRoot || this._updateTag & UpdateTag.UPDATE_BOUNDS)) return this._AABBBounds;
|
|
5699
5982
|
const full = "imprecise" === this.attribute.boundsMode;
|
|
5983
|
+
if (!this.shadowRoot) {
|
|
5984
|
+
const graphicService = this.getGraphicService(),
|
|
5985
|
+
graphicTheme = this.getGraphicTheme();
|
|
5986
|
+
if (!graphicService.validCheck(this.attribute, graphicTheme, this._AABBBounds, this)) return this._AABBBounds;
|
|
5987
|
+
if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
|
|
5988
|
+
graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
5989
|
+
const bounds = this.doUpdateAABBBounds(full, graphicTheme);
|
|
5990
|
+
return graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
5991
|
+
}
|
|
5700
5992
|
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
5701
5993
|
if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
|
|
5702
5994
|
this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
@@ -5769,14 +6061,14 @@ class Graphic extends Node {
|
|
|
5769
6061
|
const _parsedPath = new CustomSymbolClass(symbolType, cache);
|
|
5770
6062
|
return Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
|
|
5771
6063
|
}
|
|
5772
|
-
doUpdateAABBBounds(full) {
|
|
6064
|
+
doUpdateAABBBounds(full, graphicTheme) {
|
|
5773
6065
|
this.updateAABBBoundsStamp++;
|
|
5774
|
-
const
|
|
6066
|
+
const resolvedGraphicTheme = null != graphicTheme ? graphicTheme : this.getGraphicTheme();
|
|
5775
6067
|
this._AABBBounds.clear();
|
|
5776
6068
|
const attribute = this.attribute,
|
|
5777
|
-
bounds = this.updateAABBBounds(attribute,
|
|
6069
|
+
bounds = this.updateAABBBounds(attribute, resolvedGraphicTheme, this._AABBBounds, full),
|
|
5778
6070
|
{
|
|
5779
|
-
boundsPadding =
|
|
6071
|
+
boundsPadding = resolvedGraphicTheme.boundsPadding
|
|
5780
6072
|
} = attribute,
|
|
5781
6073
|
paddingArray = parsePadding(boundsPadding);
|
|
5782
6074
|
return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
|
|
@@ -5844,25 +6136,71 @@ class Graphic extends Node {
|
|
|
5844
6136
|
this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
|
|
5845
6137
|
}
|
|
5846
6138
|
setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context, ignorePriority) {
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
6139
|
+
if (!params) return;
|
|
6140
|
+
const keys = Object.keys(params);
|
|
6141
|
+
this.captureTransientFromAttrsBeforePreventAnimate(params, keys, context), this.syncFinalAttributesFromUpdateContext(context), this.visitTrackedAnimates(animate => {
|
|
6142
|
+
(animate.priority !== 1 / 0 || ignorePriority) && animate.preventAttrs(keys);
|
|
5851
6143
|
}), this.applyTransientAttributes(params, forceUpdateTag, context);
|
|
5852
6144
|
}
|
|
6145
|
+
syncFinalAttributesFromUpdateContext(context) {
|
|
6146
|
+
var _a;
|
|
6147
|
+
const updateType = null == context ? void 0 : context.type;
|
|
6148
|
+
if (updateType === AttributeUpdateType.STATE || null != updateType && updateType >= AttributeUpdateType.ANIMATE_BIND && updateType <= AttributeUpdateType.ANIMATE_END) return;
|
|
6149
|
+
const finalAttrs = null === (_a = this.context) || void 0 === _a ? void 0 : _a.finalAttrs,
|
|
6150
|
+
setFinalAttributes = this.setFinalAttributes;
|
|
6151
|
+
finalAttrs && "function" == typeof setFinalAttributes && setFinalAttributes.call(this, finalAttrs);
|
|
6152
|
+
}
|
|
6153
|
+
captureTransientFromAttrsBeforePreventAnimate(params, keys, context) {
|
|
6154
|
+
var _a, _b;
|
|
6155
|
+
const graphicContext = this.context,
|
|
6156
|
+
diffAttrs = null !== (_a = null == graphicContext ? void 0 : graphicContext.diffAttrs) && void 0 !== _a ? _a : params,
|
|
6157
|
+
updateType = null == context ? void 0 : context.type;
|
|
6158
|
+
if (!keys.length || !diffAttrs || updateType === AttributeUpdateType.STATE || null != updateType && updateType >= AttributeUpdateType.ANIMATE_BIND && updateType <= AttributeUpdateType.ANIMATE_END) return;
|
|
6159
|
+
const sameDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs;
|
|
6160
|
+
let fromAttrs = sameDiffAttrs && null !== (_b = this.transientFromAttrsBeforePreventAnimate) && void 0 !== _b ? _b : null;
|
|
6161
|
+
sameDiffAttrs || (this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null);
|
|
6162
|
+
let captured = !1;
|
|
6163
|
+
for (let i = 0; i < keys.length; i++) {
|
|
6164
|
+
const key = keys[i];
|
|
6165
|
+
if (!Object.prototype.hasOwnProperty.call(diffAttrs, key)) continue;
|
|
6166
|
+
const previousValue = this.attribute[key],
|
|
6167
|
+
nextValue = params[key];
|
|
6168
|
+
isEqual(previousValue, nextValue) || (null != fromAttrs || (fromAttrs = {}), fromAttrs[key] = cloneAttributeValue(previousValue), captured = !0);
|
|
6169
|
+
}
|
|
6170
|
+
captured && (this.transientFromAttrsBeforePreventAnimate = fromAttrs, this.transientFromAttrsBeforePreventAnimateDiffAttrs = diffAttrs);
|
|
6171
|
+
}
|
|
6172
|
+
consumeTransientFromAttrsBeforePreventAnimate(diffAttrs) {
|
|
6173
|
+
const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate,
|
|
6174
|
+
sourceDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs;
|
|
6175
|
+
if (!transientFromAttrs || !sourceDiffAttrs) return null;
|
|
6176
|
+
for (const key in diffAttrs) if (Object.prototype.hasOwnProperty.call(diffAttrs, key) && (!Object.prototype.hasOwnProperty.call(sourceDiffAttrs, key) || !isEqual(sourceDiffAttrs[key], diffAttrs[key]))) return null;
|
|
6177
|
+
let fromAttrs = null,
|
|
6178
|
+
remaining = !1;
|
|
6179
|
+
for (const key in transientFromAttrs) Object.prototype.hasOwnProperty.call(transientFromAttrs, key) && (Object.prototype.hasOwnProperty.call(diffAttrs, key) ? (null != fromAttrs || (fromAttrs = {}), fromAttrs[key] = transientFromAttrs[key]) : remaining = !0);
|
|
6180
|
+
if (remaining) {
|
|
6181
|
+
const nextTransientFromAttrs = {};
|
|
6182
|
+
for (const key in transientFromAttrs) Object.prototype.hasOwnProperty.call(transientFromAttrs, key) && !Object.prototype.hasOwnProperty.call(diffAttrs, key) && (nextTransientFromAttrs[key] = transientFromAttrs[key]);
|
|
6183
|
+
this.transientFromAttrsBeforePreventAnimate = nextTransientFromAttrs;
|
|
6184
|
+
} else this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null;
|
|
6185
|
+
return fromAttrs;
|
|
6186
|
+
}
|
|
5853
6187
|
setAttributes(params, forceUpdateTag = !1, context) {
|
|
5854
|
-
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background && this.loadImage(params.background, !0), isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
|
|
6188
|
+
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background && this.loadImage(params.background, !0), params.texture && isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
|
|
5855
6189
|
}
|
|
5856
6190
|
_setAttributes(params, forceUpdateTag = !1, context) {
|
|
5857
|
-
this.applyBaseAttributes(params), this.commitBaseAttributeMutation(forceUpdateTag, context);
|
|
6191
|
+
this.canCommitBaseAttributesByTouchedKeys() ? this.commitBaseAttributesByTouchedKeys(params, forceUpdateTag, context) : (this.detachAttributeFromBaseAttributes(), this.applyBaseAttributes(params), this.commitBaseAttributeMutation(forceUpdateTag, context));
|
|
5858
6192
|
}
|
|
5859
6193
|
setAttribute(key, value, forceUpdateTag, context) {
|
|
5860
6194
|
const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
|
|
5861
6195
|
[key]: value
|
|
5862
6196
|
}, this.attribute, key, context);
|
|
5863
|
-
params
|
|
5864
|
-
|
|
5865
|
-
|
|
6197
|
+
if (params) this._setAttributes(params, forceUpdateTag, context);else if (this.canCommitBaseAttributesByTouchedKeys()) this.commitBaseAttributeBySingleKey(key, value, !!forceUpdateTag, context);else {
|
|
6198
|
+
const nextAttrs = {
|
|
6199
|
+
[key]: value
|
|
6200
|
+
};
|
|
6201
|
+
this.applyBaseAttributes(nextAttrs), this.commitBaseAttributeMutation(!!forceUpdateTag, context);
|
|
6202
|
+
}
|
|
6203
|
+
"background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
|
|
5866
6204
|
}
|
|
5867
6205
|
needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
|
|
5868
6206
|
for (let i = 0; i < k.length; i++) {
|
|
@@ -5881,7 +6219,7 @@ class Graphic extends Node {
|
|
|
5881
6219
|
const context = {
|
|
5882
6220
|
type: AttributeUpdateType.INIT
|
|
5883
6221
|
};
|
|
5884
|
-
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.
|
|
6222
|
+
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, this._baseAttributes = void 0, this.resolvedStatePatch = void 0, this.attributeMayContainTransientAttrs = !1, this.valid = this.isValid(), params.background && this.loadImage(params.background, !0), params.texture && isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
|
|
5885
6223
|
}
|
|
5886
6224
|
translate(x, y) {
|
|
5887
6225
|
var _a, _b;
|
|
@@ -5893,10 +6231,15 @@ class Graphic extends Node {
|
|
|
5893
6231
|
x: x,
|
|
5894
6232
|
y: y
|
|
5895
6233
|
}, this.attribute, tempConstantXYKey, context);
|
|
5896
|
-
params && (x = params.x, y = params.y, delete params.x, delete params.y
|
|
6234
|
+
params && (x = params.x, y = params.y, delete params.x, delete params.y);
|
|
5897
6235
|
const attribute = this.baseAttributes,
|
|
5898
|
-
postMatrix = attribute.postMatrix
|
|
5899
|
-
|
|
6236
|
+
postMatrix = attribute.postMatrix,
|
|
6237
|
+
nextAttrs = params || {};
|
|
6238
|
+
if (postMatrix) {
|
|
6239
|
+
const nextPostMatrix = postMatrix.clone();
|
|
6240
|
+
application.transformUtil.fromMatrix(nextPostMatrix, nextPostMatrix).translate(x, y), nextAttrs.postMatrix = nextPostMatrix;
|
|
6241
|
+
} else nextAttrs.x = (null !== (_a = attribute.x) && void 0 !== _a ? _a : DefaultTransform.x) + x, nextAttrs.y = (null !== (_b = attribute.y) && void 0 !== _b ? _b : DefaultTransform.y) + y;
|
|
6242
|
+
return this.commitInternalBaseAttributes(nextAttrs, context), this;
|
|
5900
6243
|
}
|
|
5901
6244
|
translateTo(x, y) {
|
|
5902
6245
|
const attribute = this.baseAttributes;
|
|
@@ -5908,7 +6251,10 @@ class Graphic extends Node {
|
|
|
5908
6251
|
x: x,
|
|
5909
6252
|
y: y
|
|
5910
6253
|
}, this.attribute, tempConstantXYKey, context);
|
|
5911
|
-
return params ? (this.
|
|
6254
|
+
return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
|
|
6255
|
+
x: x,
|
|
6256
|
+
y: y
|
|
6257
|
+
}, context), this);
|
|
5912
6258
|
}
|
|
5913
6259
|
scale(scaleX, scaleY, scaleCenter) {
|
|
5914
6260
|
var _a, _b;
|
|
@@ -5921,15 +6267,16 @@ class Graphic extends Node {
|
|
|
5921
6267
|
scaleY: scaleY,
|
|
5922
6268
|
scaleCenter: scaleCenter
|
|
5923
6269
|
}, this.attribute, tempConstantScaleXYKey, context);
|
|
5924
|
-
params && (scaleX = params.scaleX, scaleY = params.scaleY, delete params.scaleX, delete params.scaleY
|
|
5925
|
-
const attribute = this.baseAttributes
|
|
6270
|
+
params && (scaleX = params.scaleX, scaleY = params.scaleY, delete params.scaleX, delete params.scaleY);
|
|
6271
|
+
const attribute = this.baseAttributes,
|
|
6272
|
+
nextAttrs = params || {};
|
|
5926
6273
|
if (scaleCenter) {
|
|
5927
6274
|
let {
|
|
5928
6275
|
postMatrix: postMatrix
|
|
5929
|
-
} = this.
|
|
5930
|
-
postMatrix
|
|
5931
|
-
} else
|
|
5932
|
-
return this.
|
|
6276
|
+
} = this.baseAttributes;
|
|
6277
|
+
postMatrix = postMatrix ? postMatrix.clone() : new Matrix(), application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter), nextAttrs.postMatrix = postMatrix;
|
|
6278
|
+
} else nextAttrs.scaleX = (null !== (_a = attribute.scaleX) && void 0 !== _a ? _a : DefaultTransform.scaleX) * scaleX, nextAttrs.scaleY = (null !== (_b = attribute.scaleY) && void 0 !== _b ? _b : DefaultTransform.scaleY) * scaleY;
|
|
6279
|
+
return this.commitInternalBaseAttributes(nextAttrs, context), this;
|
|
5933
6280
|
}
|
|
5934
6281
|
scaleTo(scaleX, scaleY) {
|
|
5935
6282
|
const attribute = this.baseAttributes;
|
|
@@ -5941,7 +6288,10 @@ class Graphic extends Node {
|
|
|
5941
6288
|
scaleX: scaleX,
|
|
5942
6289
|
scaleY: scaleY
|
|
5943
6290
|
}, this.attribute, tempConstantScaleXYKey, context);
|
|
5944
|
-
return params ? (this.
|
|
6291
|
+
return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
|
|
6292
|
+
scaleX: scaleX,
|
|
6293
|
+
scaleY: scaleY
|
|
6294
|
+
}, context), this);
|
|
5945
6295
|
}
|
|
5946
6296
|
rotate(angle, rotateCenter) {
|
|
5947
6297
|
var _a;
|
|
@@ -5953,24 +6303,26 @@ class Graphic extends Node {
|
|
|
5953
6303
|
angle: angle,
|
|
5954
6304
|
rotateCenter: rotateCenter
|
|
5955
6305
|
}, this.attribute, tempConstantAngleKey, context);
|
|
5956
|
-
params &&
|
|
5957
|
-
const attribute = this.baseAttributes
|
|
6306
|
+
params && delete params.angle;
|
|
6307
|
+
const attribute = this.baseAttributes,
|
|
6308
|
+
nextAttrs = params || {};
|
|
5958
6309
|
if (rotateCenter) {
|
|
5959
6310
|
let {
|
|
5960
6311
|
postMatrix: postMatrix
|
|
5961
6312
|
} = this.baseAttributes;
|
|
5962
|
-
postMatrix
|
|
5963
|
-
} else
|
|
5964
|
-
return this.
|
|
6313
|
+
postMatrix = postMatrix ? postMatrix.clone() : new Matrix(), application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter), nextAttrs.postMatrix = postMatrix;
|
|
6314
|
+
} else nextAttrs.angle = (null !== (_a = attribute.angle) && void 0 !== _a ? _a : DefaultTransform.angle) + angle;
|
|
6315
|
+
return this.commitInternalBaseAttributes(nextAttrs, context), this;
|
|
5965
6316
|
}
|
|
5966
6317
|
rotateTo(angle) {
|
|
5967
|
-
|
|
5968
|
-
if (attribute.angle === angle) return this;
|
|
6318
|
+
if (this.baseAttributes.angle === angle) return this;
|
|
5969
6319
|
const context = {
|
|
5970
6320
|
type: AttributeUpdateType.ROTATE_TO
|
|
5971
6321
|
},
|
|
5972
6322
|
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(angle, this.attribute, tempConstantAngleKey, context);
|
|
5973
|
-
return params ? (this.
|
|
6323
|
+
return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
|
|
6324
|
+
angle: angle
|
|
6325
|
+
}, context), this);
|
|
5974
6326
|
}
|
|
5975
6327
|
skewTo(b, c) {
|
|
5976
6328
|
return this;
|
|
@@ -5988,7 +6340,15 @@ class Graphic extends Node {
|
|
|
5988
6340
|
var _a;
|
|
5989
6341
|
return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
|
|
5990
6342
|
}
|
|
5991
|
-
|
|
6343
|
+
getStateResolveBaseAttrs() {
|
|
6344
|
+
var _a;
|
|
6345
|
+
return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
|
|
6346
|
+
}
|
|
6347
|
+
syncStateResolveContext(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
|
|
6348
|
+
var _a;
|
|
6349
|
+
return null === (_a = this.stateEngine) || void 0 === _a || _a.setResolveContext(this, stateResolveBaseAttrs), stateResolveBaseAttrs;
|
|
6350
|
+
}
|
|
6351
|
+
createStateModel(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
|
|
5992
6352
|
const {
|
|
5993
6353
|
compiledDefinitions: compiledDefinitions,
|
|
5994
6354
|
stateProxyEligibility: stateProxyEligibility,
|
|
@@ -6001,7 +6361,7 @@ class Graphic extends Node {
|
|
|
6001
6361
|
stateProxyEligibility: stateProxyEligibility,
|
|
6002
6362
|
states: this.states,
|
|
6003
6363
|
mergeMode: this.stateMergeMode
|
|
6004
|
-
}), this.stateEngineCompiledDefinitions = compiledDefinitions, this.stateEngineStateProxy = this.stateProxy, this.stateEngineStateSort = this.stateSort, this.stateEngineMergeMode = this.stateMergeMode, this.stateEngineStateProxyModeKey = stateProxyModeKey) : (this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0, this.stateEngineStateProxyModeKey = void 0), new StateModel({
|
|
6364
|
+
}), this.stateEngineCompiledDefinitions = compiledDefinitions, this.stateEngineStateProxy = this.stateProxy, this.stateEngineStateSort = this.stateSort, this.stateEngineMergeMode = this.stateMergeMode, this.stateEngineStateProxyModeKey = stateProxyModeKey) : (this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0, this.stateEngineStateProxyModeKey = void 0), this.syncStateResolveContext(stateResolveBaseAttrs), new StateModel({
|
|
6005
6365
|
states: this.states,
|
|
6006
6366
|
currentStates: this.currentStates,
|
|
6007
6367
|
stateSort: this.stateSort,
|
|
@@ -6009,28 +6369,162 @@ class Graphic extends Node {
|
|
|
6009
6369
|
stateEngine: this.stateEngine
|
|
6010
6370
|
});
|
|
6011
6371
|
}
|
|
6372
|
+
resolveSimpleLocalStateTransition(states, previousStates) {
|
|
6373
|
+
var _a;
|
|
6374
|
+
if (!this.states || this.stateProxy || this.stateSort || "deep" === this.stateMergeMode || this.parent || (null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope) || this.boundSharedStateScope) return null;
|
|
6375
|
+
if (1 === states.length) {
|
|
6376
|
+
const stateName = states[0],
|
|
6377
|
+
hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName),
|
|
6378
|
+
nextStates = [stateName],
|
|
6379
|
+
changed = !this.sameStateNames(previousStates, nextStates),
|
|
6380
|
+
resolvedStateAttrs = {};
|
|
6381
|
+
if (hasDefinition) {
|
|
6382
|
+
const attrs = this.states[stateName];
|
|
6383
|
+
if (null != attrs) {
|
|
6384
|
+
if (!isPlainObjectValue(attrs)) return null;
|
|
6385
|
+
const keys = Object.keys(attrs);
|
|
6386
|
+
for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
|
|
6387
|
+
const key = keys[keyIndex];
|
|
6388
|
+
if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
|
|
6389
|
+
const attrValue = attrs[key];
|
|
6390
|
+
resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
|
|
6391
|
+
}
|
|
6392
|
+
}
|
|
6393
|
+
}
|
|
6394
|
+
return {
|
|
6395
|
+
changed: changed,
|
|
6396
|
+
states: nextStates,
|
|
6397
|
+
effectiveStates: nextStates,
|
|
6398
|
+
resolvedStateAttrs: resolvedStateAttrs
|
|
6399
|
+
};
|
|
6400
|
+
}
|
|
6401
|
+
const uniqueStates = Array.from(new Set(states)),
|
|
6402
|
+
withDefinition = [],
|
|
6403
|
+
withoutDefinition = [];
|
|
6404
|
+
for (let i = 0; i < uniqueStates.length; i++) {
|
|
6405
|
+
const stateName = uniqueStates[i];
|
|
6406
|
+
Object.prototype.hasOwnProperty.call(this.states, stateName) ? withDefinition.push(stateName) : withoutDefinition.push(stateName);
|
|
6407
|
+
}
|
|
6408
|
+
withDefinition.sort((left, right) => left.localeCompare(right));
|
|
6409
|
+
const nextStates = withDefinition.concat(withoutDefinition),
|
|
6410
|
+
changed = !this.sameStateNames(previousStates, nextStates),
|
|
6411
|
+
resolvedStateAttrs = {};
|
|
6412
|
+
for (let i = 0; i < nextStates.length; i++) {
|
|
6413
|
+
const stateName = nextStates[i];
|
|
6414
|
+
if (!Object.prototype.hasOwnProperty.call(this.states, stateName)) continue;
|
|
6415
|
+
const attrs = this.states[stateName];
|
|
6416
|
+
if (null == attrs) continue;
|
|
6417
|
+
if (!isPlainObjectValue(attrs)) return null;
|
|
6418
|
+
const keys = Object.keys(attrs);
|
|
6419
|
+
for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
|
|
6420
|
+
const key = keys[keyIndex];
|
|
6421
|
+
if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
|
|
6422
|
+
const attrValue = attrs[key];
|
|
6423
|
+
resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
|
|
6424
|
+
}
|
|
6425
|
+
}
|
|
6426
|
+
return {
|
|
6427
|
+
changed: changed,
|
|
6428
|
+
states: nextStates,
|
|
6429
|
+
effectiveStates: nextStates,
|
|
6430
|
+
resolvedStateAttrs: resolvedStateAttrs
|
|
6431
|
+
};
|
|
6432
|
+
}
|
|
6433
|
+
resolveGraphicStateTransition(states, previousStates, forceResolverRefresh = !1) {
|
|
6434
|
+
var _a, _b;
|
|
6435
|
+
let transition = this.resolveSimpleLocalStateTransition(states, previousStates);
|
|
6436
|
+
const isSimpleLocalTransition = !!transition;
|
|
6437
|
+
let resolvedStateAttrs;
|
|
6438
|
+
if (transition) resolvedStateAttrs = transition.resolvedStateAttrs;else {
|
|
6439
|
+
const stateResolveBaseAttrs = this.getStateResolveBaseAttrs(),
|
|
6440
|
+
stateModel = this.createStateModel(stateResolveBaseAttrs);
|
|
6441
|
+
forceResolverRefresh && (null === (_a = this.stateEngine) || void 0 === _a || _a.invalidateResolverCache()), transition = stateModel.useStates(states), resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
|
|
6442
|
+
}
|
|
6443
|
+
return {
|
|
6444
|
+
transition: transition,
|
|
6445
|
+
effectiveStates: null !== (_b = transition.effectiveStates) && void 0 !== _b ? _b : transition.states,
|
|
6446
|
+
resolvedStateAttrs: resolvedStateAttrs,
|
|
6447
|
+
isSimpleLocalTransition: isSimpleLocalTransition
|
|
6448
|
+
};
|
|
6449
|
+
}
|
|
6450
|
+
normalizeSetStatesOptions(options) {
|
|
6451
|
+
return options && "object" == typeof options ? {
|
|
6452
|
+
hasAnimation: options.animate,
|
|
6453
|
+
animateSameStatePatchChange: !0 === options.animateSameStatePatchChange,
|
|
6454
|
+
shouldRefreshSameStatePatch: !0
|
|
6455
|
+
} : {
|
|
6456
|
+
hasAnimation: "boolean" == typeof options ? options : void 0,
|
|
6457
|
+
animateSameStatePatchChange: !1,
|
|
6458
|
+
shouldRefreshSameStatePatch: !1
|
|
6459
|
+
};
|
|
6460
|
+
}
|
|
6461
|
+
sameStatePatches(left, right) {
|
|
6462
|
+
const leftRecord = null != left ? left : {},
|
|
6463
|
+
rightRecord = null != right ? right : {},
|
|
6464
|
+
keys = new Set([...Object.keys(leftRecord), ...Object.keys(rightRecord)]);
|
|
6465
|
+
for (const key of keys) {
|
|
6466
|
+
if (Object.prototype.hasOwnProperty.call(leftRecord, key) !== Object.prototype.hasOwnProperty.call(rightRecord, key)) return !1;
|
|
6467
|
+
if (!areAttributeValuesEqual(leftRecord[key], rightRecord[key])) return !1;
|
|
6468
|
+
}
|
|
6469
|
+
return !0;
|
|
6470
|
+
}
|
|
6471
|
+
commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = !1) {
|
|
6472
|
+
var _a;
|
|
6473
|
+
const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
|
|
6474
|
+
previousResolvedStatePatch = this.resolvedStatePatch,
|
|
6475
|
+
{
|
|
6476
|
+
transition: transition,
|
|
6477
|
+
effectiveStates: effectiveStates,
|
|
6478
|
+
resolvedStateAttrs: resolvedStateAttrs,
|
|
6479
|
+
isSimpleLocalTransition: isSimpleLocalTransition
|
|
6480
|
+
} = this.resolveGraphicStateTransition(states, previousStates, !0),
|
|
6481
|
+
patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
|
|
6482
|
+
if ((!patchChanged || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) && (this.currentStates = transition.states, this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), patchChanged)) {
|
|
6483
|
+
if (this.stage) {
|
|
6484
|
+
const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
|
|
6485
|
+
null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
|
|
6486
|
+
graphicId: this._uid,
|
|
6487
|
+
targetStates: [...transition.states]
|
|
6488
|
+
});
|
|
6489
|
+
}
|
|
6490
|
+
hasAnimation && animateSameStatePatchChange ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
6491
|
+
type: AttributeUpdateType.STATE
|
|
6492
|
+
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
6493
|
+
type: AttributeUpdateType.STATE
|
|
6494
|
+
}), this.emitStateUpdateEvent());
|
|
6495
|
+
}
|
|
6496
|
+
}
|
|
6012
6497
|
resolveStateAnimateConfig(animateConfig) {
|
|
6013
6498
|
var _a, _b, _c;
|
|
6014
6499
|
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;
|
|
6015
6500
|
}
|
|
6016
|
-
applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig) {
|
|
6501
|
+
applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs) {
|
|
6017
6502
|
const resolvedAnimateConfig = hasAnimation ? this.resolveStateAnimateConfig(animateConfig) : void 0,
|
|
6018
6503
|
transitionOptions = resolvedAnimateConfig ? {
|
|
6019
|
-
animateConfig: resolvedAnimateConfig
|
|
6504
|
+
animateConfig: resolvedAnimateConfig,
|
|
6505
|
+
extraAnimateAttrs: extraAnimateAttrs,
|
|
6506
|
+
shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
|
|
6020
6507
|
} : void 0;
|
|
6021
6508
|
if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, stateNames, transitionOptions);
|
|
6022
6509
|
const plan = this.getStateTransitionOrchestrator().analyzeTransition({}, attrs, stateNames, hasAnimation, {
|
|
6023
6510
|
noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
|
|
6024
|
-
animateConfig: resolvedAnimateConfig
|
|
6511
|
+
animateConfig: resolvedAnimateConfig,
|
|
6512
|
+
extraAnimateAttrs: extraAnimateAttrs,
|
|
6513
|
+
shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
|
|
6025
6514
|
});
|
|
6026
6515
|
this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
|
|
6027
6516
|
}
|
|
6028
|
-
updateNormalAttrs(
|
|
6029
|
-
|
|
6517
|
+
updateNormalAttrs(_stateAttrs) {}
|
|
6518
|
+
getStateTransitionDefaultAttribute(key, targetAttrs) {
|
|
6519
|
+
return this.getDefaultAttribute(key);
|
|
6520
|
+
}
|
|
6521
|
+
shouldSkipStateTransitionDefaultAttribute(_key, _targetAttrs) {
|
|
6522
|
+
return !1;
|
|
6030
6523
|
}
|
|
6031
6524
|
stopStateAnimates(type = "end") {
|
|
6032
6525
|
const stopAnimationState = this.stopAnimationState;
|
|
6033
6526
|
if ("function" == typeof stopAnimationState) return void stopAnimationState.call(this, "state", type);
|
|
6527
|
+
if (!this.mayHaveTrackedAnimates()) return;
|
|
6034
6528
|
const stateAnimates = [];
|
|
6035
6529
|
this.visitTrackedAnimates(animate => {
|
|
6036
6530
|
animate.stateNames && stateAnimates.push(animate);
|
|
@@ -6043,18 +6537,25 @@ class Graphic extends Node {
|
|
|
6043
6537
|
}
|
|
6044
6538
|
clearStates(hasAnimation) {
|
|
6045
6539
|
var _a, _b, _c;
|
|
6046
|
-
const previousStates =
|
|
6540
|
+
const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
|
|
6541
|
+
previousResolvedStatePatch = this.resolvedStatePatch,
|
|
6047
6542
|
transition = this.createStateModel().clearStates();
|
|
6048
6543
|
if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
|
|
6049
|
-
const resolvedStateAttrs = cloneAttributeValue(null !== (
|
|
6050
|
-
transition.changed
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6544
|
+
const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
|
|
6545
|
+
if (!transition.changed || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0)) {
|
|
6546
|
+
if (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(), this.stage) {
|
|
6547
|
+
const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
|
|
6548
|
+
null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
|
|
6549
|
+
graphicId: this._uid,
|
|
6550
|
+
targetStates: []
|
|
6551
|
+
});
|
|
6552
|
+
}
|
|
6553
|
+
hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
6554
|
+
type: AttributeUpdateType.STATE
|
|
6555
|
+
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
|
|
6556
|
+
type: AttributeUpdateType.STATE
|
|
6557
|
+
}), this.emitStateUpdateEvent());
|
|
6558
|
+
}
|
|
6058
6559
|
}
|
|
6059
6560
|
removeState(stateName, hasAnimation) {
|
|
6060
6561
|
const transition = this.createStateModel().removeState(stateName);
|
|
@@ -6068,38 +6569,59 @@ class Graphic extends Node {
|
|
|
6068
6569
|
const transition = this.createStateModel().addState(stateName, keepCurrentStates);
|
|
6069
6570
|
transition.changed && this.useStates(transition.states, hasAnimation);
|
|
6070
6571
|
}
|
|
6572
|
+
setStates(states, options) {
|
|
6573
|
+
var _a, _b, _c;
|
|
6574
|
+
const {
|
|
6575
|
+
hasAnimation: hasAnimation,
|
|
6576
|
+
animateSameStatePatchChange: animateSameStatePatchChange,
|
|
6577
|
+
shouldRefreshSameStatePatch: shouldRefreshSameStatePatch
|
|
6578
|
+
} = this.normalizeSetStatesOptions(options),
|
|
6579
|
+
nextStates = (null == states ? void 0 : states.length) ? states : EMPTY_STATE_NAMES,
|
|
6580
|
+
hasCurrentState = !!((null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || (null === (_b = this.effectiveStates) || void 0 === _b ? void 0 : _b.length) || this.resolvedStatePatch || (null === (_c = this.registeredActiveScopes) || void 0 === _c ? void 0 : _c.size));
|
|
6581
|
+
if (nextStates.length) {
|
|
6582
|
+
if (this.sameStateNames(this.currentStates, nextStates)) return shouldRefreshSameStatePatch ? void this.commitSameStatePatchRefresh(nextStates, hasAnimation, animateSameStatePatchChange) : void (this.sharedStateDirty && this.refreshSharedStateBeforeRender());
|
|
6583
|
+
this.useStates(nextStates, hasAnimation);
|
|
6584
|
+
} else {
|
|
6585
|
+
if (!hasCurrentState && !this.sharedStateDirty) return;
|
|
6586
|
+
this.clearStates(hasAnimation);
|
|
6587
|
+
}
|
|
6588
|
+
}
|
|
6071
6589
|
useStates(states, hasAnimation) {
|
|
6072
|
-
var _a
|
|
6590
|
+
var _a;
|
|
6073
6591
|
if (!states.length) return void this.clearStates(hasAnimation);
|
|
6074
|
-
const previousStates =
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6592
|
+
const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
|
|
6593
|
+
previousResolvedStatePatch = this.resolvedStatePatch,
|
|
6594
|
+
{
|
|
6595
|
+
transition: transition,
|
|
6596
|
+
effectiveStates: effectiveStates,
|
|
6597
|
+
resolvedStateAttrs: resolvedStateAttrs,
|
|
6598
|
+
isSimpleLocalTransition: isSimpleLocalTransition
|
|
6599
|
+
} = this.resolveGraphicStateTransition(states, previousStates);
|
|
6600
|
+
if ((transition.changed || !this.sameStateNames(previousStates, transition.states)) && this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) {
|
|
6601
|
+
if (this.currentStates = transition.states, this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stage) {
|
|
6602
|
+
const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
|
|
6603
|
+
null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
|
|
6604
|
+
graphicId: this._uid,
|
|
6605
|
+
targetStates: [...transition.states]
|
|
6606
|
+
});
|
|
6607
|
+
}
|
|
6608
|
+
hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
6609
|
+
type: AttributeUpdateType.STATE
|
|
6610
|
+
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
6611
|
+
type: AttributeUpdateType.STATE
|
|
6612
|
+
}), this.emitStateUpdateEvent());
|
|
6613
|
+
}
|
|
6090
6614
|
}
|
|
6091
6615
|
invalidateResolver() {
|
|
6092
6616
|
var _a, _b;
|
|
6093
6617
|
if (!this.stateEngine || !(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.compiledStateDefinitions) return;
|
|
6094
|
-
|
|
6095
|
-
this.
|
|
6618
|
+
this.syncStateResolveContext();
|
|
6619
|
+
this.resolverEpoch = (null !== (_b = this.resolverEpoch) && void 0 !== _b ? _b : 0) + 1, this.stateEngine.invalidateResolverCache();
|
|
6096
6620
|
const transition = this.stateEngine.applyStates(this.currentStates),
|
|
6097
6621
|
resolvedStateAttrs = Object.assign({}, this.stateEngine.resolvedPatch);
|
|
6098
|
-
this.effectiveStates = [...transition.effectiveStates], this.resolvedStatePatch =
|
|
6622
|
+
this.effectiveStates = [...transition.effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
|
|
6099
6623
|
type: AttributeUpdateType.STATE
|
|
6100
|
-
}), this.
|
|
6101
|
-
type: AttributeUpdateType.STATE
|
|
6102
|
-
});
|
|
6624
|
+
}), this.emitStateUpdateEvent();
|
|
6103
6625
|
}
|
|
6104
6626
|
sameStateNames(left, right) {
|
|
6105
6627
|
const normalizedLeft = null != left ? left : [],
|
|
@@ -6120,6 +6642,9 @@ class Graphic extends Node {
|
|
|
6120
6642
|
addUpdateShapeAndBoundsTag() {
|
|
6121
6643
|
this._updateTag |= UpdateTag.UPDATE_SHAPE_AND_BOUNDS, this.parent && this.parent.addChildUpdateBoundTag(), this.glyphHost && this.glyphHost.addUpdateBoundTag();
|
|
6122
6644
|
}
|
|
6645
|
+
addBroadUpdateTag() {
|
|
6646
|
+
this.shadowRoot && this.shadowRoot.addUpdateGlobalPositionTag(), this._updateTag |= UpdateTag.UPDATE_SHAPE_AND_BOUNDS | UpdateTag.UPDATE_PAINT | UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX | UpdateTag.UPDATE_LAYOUT, this.parent && this.parent.addChildUpdateBoundTag(), this.glyphHost && this.glyphHost.addUpdateBoundTag();
|
|
6647
|
+
}
|
|
6123
6648
|
updateShapeAndBoundsTagSetted() {
|
|
6124
6649
|
return (this._updateTag & UpdateTag.UPDATE_SHAPE_AND_BOUNDS) === UpdateTag.UPDATE_SHAPE_AND_BOUNDS;
|
|
6125
6650
|
}
|
|
@@ -6207,13 +6732,13 @@ class Graphic extends Node {
|
|
|
6207
6732
|
}
|
|
6208
6733
|
}
|
|
6209
6734
|
setStage(stage, layer) {
|
|
6210
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6735
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
6211
6736
|
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,
|
|
6212
6737
|
previousStage = this.stage;
|
|
6213
6738
|
if (this.stage !== stage || this.layer !== layer) {
|
|
6214
|
-
if (this.stage = stage, this.layer = layer,
|
|
6215
|
-
const previousTimeline = null === (
|
|
6216
|
-
nextTimeline = null === (
|
|
6739
|
+
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()) {
|
|
6740
|
+
const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
|
|
6741
|
+
nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
|
|
6217
6742
|
detachedStageAnimates = [];
|
|
6218
6743
|
this.visitTrackedAnimates(a => {
|
|
6219
6744
|
(!!previousTimeline && a.timeline === previousTimeline || a.timeline.isGlobal) && (nextTimeline ? a.timeline !== nextTimeline && (previousTimeline && a.timeline === previousTimeline && previousTimeline.removeAnimate(a, !1), a.setTimeline(nextTimeline), nextTimeline.addAnimate(a)) : previousTimeline && a.timeline === previousTimeline && (previousTimeline.removeAnimate(a, !1), detachedStageAnimates.push(a)));
|
|
@@ -6226,9 +6751,13 @@ class Graphic extends Node {
|
|
|
6226
6751
|
type: AttributeUpdateType.ANIMATE_END
|
|
6227
6752
|
}));
|
|
6228
6753
|
}
|
|
6229
|
-
return this._onSetStage && this._onSetStage(this, stage, layer), void (null === (
|
|
6754
|
+
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));
|
|
6230
6755
|
}
|
|
6231
|
-
|
|
6756
|
+
((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);
|
|
6757
|
+
}
|
|
6758
|
+
detachStageForRelease() {
|
|
6759
|
+
var _a, _b, _c;
|
|
6760
|
+
(null === (_a = this.registeredActiveScopes) || void 0 === _a ? void 0 : _a.size) && this.clearSharedStateActiveRegistrations(), (this.mayHaveTrackedAnimates() || this.shadowRoot) && this.stopAnimates(), this.boundSharedStateScope = void 0, this.boundSharedStateRevision = void 0, this.localFallbackCompiledDefinitions = void 0, this.compiledStateDefinitions = void 0, this.compiledStateDefinitionsCacheKey = void 0, this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0, this.stateEngineStateProxyModeKey = void 0, this.sharedStateDirty = !1, this.stage = null, this.layer = null, this.shadowRoot && (null === (_c = (_b = this.shadowRoot).detachStageForRelease) || void 0 === _c || _c.call(_b));
|
|
6232
6761
|
}
|
|
6233
6762
|
setStageToShadowRoot(stage, layer) {
|
|
6234
6763
|
this.shadowRoot && this.shadowRoot.setStage(stage, layer);
|
|
@@ -6295,6 +6824,7 @@ class Graphic extends Node {
|
|
|
6295
6824
|
res && (res.state = "fail", cb && cb());
|
|
6296
6825
|
}
|
|
6297
6826
|
_stopAnimates() {
|
|
6827
|
+
if (!this.mayHaveTrackedAnimates()) return;
|
|
6298
6828
|
const animates = [];
|
|
6299
6829
|
this.visitTrackedAnimates(animate => {
|
|
6300
6830
|
animates.push(animate);
|
|
@@ -6308,14 +6838,17 @@ class Graphic extends Node {
|
|
|
6308
6838
|
});
|
|
6309
6839
|
}
|
|
6310
6840
|
release() {
|
|
6311
|
-
var _a, _b, _c;
|
|
6312
|
-
this.releaseStatus = "released", this.clearSharedStateActiveRegistrations(), this.stopAnimates();
|
|
6313
|
-
const graphicService = null !== (
|
|
6314
|
-
null === (
|
|
6841
|
+
var _a, _b, _c, _d;
|
|
6842
|
+
this.releaseStatus = "released", (null === (_a = this.registeredActiveScopes) || void 0 === _a ? void 0 : _a.size) && this.clearSharedStateActiveRegistrations(), (this.mayHaveTrackedAnimates() || this.shadowRoot) && this.stopAnimates();
|
|
6843
|
+
const graphicService = null !== (_c = null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService;
|
|
6844
|
+
null === (_d = null == graphicService ? void 0 : graphicService.onRelease) || void 0 === _d || _d.call(graphicService, this), super.release();
|
|
6845
|
+
}
|
|
6846
|
+
hasCustomEvent(type) {
|
|
6847
|
+
return !!this._events && type in this._events;
|
|
6315
6848
|
}
|
|
6316
6849
|
_dispatchCustomEvent(type, context) {
|
|
6317
6850
|
var _a, _b;
|
|
6318
|
-
if (this.
|
|
6851
|
+
if (this.hasCustomEvent(type)) {
|
|
6319
6852
|
const changeEvent = new CustomEvent(type, context);
|
|
6320
6853
|
changeEvent.bubbles = !1;
|
|
6321
6854
|
const manager = null === (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem) || void 0 === _b ? void 0 : _b.manager;
|
|
@@ -6324,7 +6857,7 @@ class Graphic extends Node {
|
|
|
6324
6857
|
return !0;
|
|
6325
6858
|
}
|
|
6326
6859
|
beforeStateUpdate(attrs, prevStates, nextStates, hasAnimation, isClear) {
|
|
6327
|
-
return this._dispatchCustomEvent("beforeStateUpdate", {
|
|
6860
|
+
return !this.hasCustomEvent("beforeStateUpdate") || this._dispatchCustomEvent("beforeStateUpdate", {
|
|
6328
6861
|
type: AttributeUpdateType.STATE,
|
|
6329
6862
|
attrs: Object.assign({}, attrs),
|
|
6330
6863
|
prevStates: prevStates.slice(),
|
|
@@ -6333,6 +6866,11 @@ class Graphic extends Node {
|
|
|
6333
6866
|
isClear: !!isClear
|
|
6334
6867
|
});
|
|
6335
6868
|
}
|
|
6869
|
+
emitStateUpdateEvent() {
|
|
6870
|
+
this.hasCustomEvent("afterStateUpdate") && this._emitCustomEvent("afterStateUpdate", {
|
|
6871
|
+
type: AttributeUpdateType.STATE
|
|
6872
|
+
});
|
|
6873
|
+
}
|
|
6336
6874
|
_emitCustomEvent(type, context) {
|
|
6337
6875
|
this._dispatchCustomEvent(type, context);
|
|
6338
6876
|
}
|
|
@@ -7501,6 +8039,52 @@ class Rect extends Graphic {
|
|
|
7501
8039
|
needUpdateTag(key) {
|
|
7502
8040
|
return super.needUpdateTag(key, RECT_UPDATE_TAG_KEY);
|
|
7503
8041
|
}
|
|
8042
|
+
shouldSkipStateTransitionDefaultAttribute(key, targetAttrs) {
|
|
8043
|
+
var _a;
|
|
8044
|
+
const attrs = null !== (_a = null != targetAttrs ? targetAttrs : this.baseAttributes) && void 0 !== _a ? _a : this.attribute,
|
|
8045
|
+
hasValue = attrKey => null != attrs[attrKey],
|
|
8046
|
+
isNilValue = attrKey => null == attrs[attrKey];
|
|
8047
|
+
switch (key) {
|
|
8048
|
+
case "width":
|
|
8049
|
+
return isNilValue("width") && hasValue("x") && hasValue("x1");
|
|
8050
|
+
case "height":
|
|
8051
|
+
return isNilValue("height") && hasValue("y") && hasValue("y1");
|
|
8052
|
+
case "x1":
|
|
8053
|
+
return isNilValue("x1") && hasValue("x") && hasValue("width");
|
|
8054
|
+
case "y1":
|
|
8055
|
+
return isNilValue("y1") && hasValue("y") && hasValue("height");
|
|
8056
|
+
default:
|
|
8057
|
+
return !1;
|
|
8058
|
+
}
|
|
8059
|
+
}
|
|
8060
|
+
getStateTransitionDefaultAttribute(key, targetAttrs) {
|
|
8061
|
+
var _a;
|
|
8062
|
+
const attrs = null !== (_a = null != targetAttrs ? targetAttrs : this.baseAttributes) && void 0 !== _a ? _a : this.attribute,
|
|
8063
|
+
getNumber = attrKey => {
|
|
8064
|
+
const value = attrs[attrKey];
|
|
8065
|
+
return "number" == typeof value && Number.isFinite(value) ? value : void 0;
|
|
8066
|
+
},
|
|
8067
|
+
x = getNumber("x"),
|
|
8068
|
+
y = getNumber("y"),
|
|
8069
|
+
x1 = getNumber("x1"),
|
|
8070
|
+
y1 = getNumber("y1"),
|
|
8071
|
+
width = getNumber("width"),
|
|
8072
|
+
height = getNumber("height");
|
|
8073
|
+
switch (key) {
|
|
8074
|
+
case "width":
|
|
8075
|
+
if (null == width && null != x && null != x1) return x1 - x;
|
|
8076
|
+
break;
|
|
8077
|
+
case "height":
|
|
8078
|
+
if (null == height && null != y && null != y1) return y1 - y;
|
|
8079
|
+
break;
|
|
8080
|
+
case "x1":
|
|
8081
|
+
if (null == x1 && null != x && null != width) return x + width;
|
|
8082
|
+
break;
|
|
8083
|
+
case "y1":
|
|
8084
|
+
if (null == y1 && null != y && null != height) return y + height;
|
|
8085
|
+
}
|
|
8086
|
+
return super.getStateTransitionDefaultAttribute(key, targetAttrs);
|
|
8087
|
+
}
|
|
7504
8088
|
toCustomPath() {
|
|
7505
8089
|
let path = super.toCustomPath();
|
|
7506
8090
|
if (path) return path;
|
|
@@ -8973,13 +9557,15 @@ var GroupUpdateAABBBoundsMode;
|
|
|
8973
9557
|
}(GroupUpdateAABBBoundsMode || (GroupUpdateAABBBoundsMode = {}));
|
|
8974
9558
|
class Group extends Graphic {
|
|
8975
9559
|
constructor(params) {
|
|
8976
|
-
super(params), this.type = "group", this.parent = null, this.isContainer = !0, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
|
|
9560
|
+
super(params), this.type = "group", this.parent = null, this.isContainer = !0, this._hasSharedStateDefinitions = !1, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
|
|
8977
9561
|
}
|
|
8978
9562
|
get sharedStateDefinitions() {
|
|
8979
9563
|
return this._sharedStateDefinitions;
|
|
8980
9564
|
}
|
|
8981
9565
|
set sharedStateDefinitions(value) {
|
|
8982
|
-
|
|
9566
|
+
if (this._sharedStateDefinitions === value) return;
|
|
9567
|
+
const previousScope = this.sharedStateScope;
|
|
9568
|
+
this._sharedStateDefinitions = value, this._hasSharedStateDefinitions = !!value && Object.keys(value).length > 0, this.ensureSharedStateScopeBound(), this.sharedStateScope && (setSharedStateScopeLocalDefinitions(this.sharedStateScope, value), markScopeActiveDescendantsDirty(this.sharedStateScope, this.stage)), previousScope !== this.sharedStateScope && this.notifyChildrenSharedStateTreeChanged();
|
|
8983
9569
|
}
|
|
8984
9570
|
setMode(mode) {
|
|
8985
9571
|
"3d" === mode ? this.set3dMode() : this.set2dMode();
|
|
@@ -9104,9 +9690,10 @@ class Group extends Graphic {
|
|
|
9104
9690
|
insertInto(newNode, idx) {
|
|
9105
9691
|
return this._updateChildToStage(super.insertInto(newNode, idx));
|
|
9106
9692
|
}
|
|
9107
|
-
removeChild(child) {
|
|
9693
|
+
removeChild(child, highPerformance = !1) {
|
|
9694
|
+
var _a;
|
|
9108
9695
|
const data = super.removeChild(child);
|
|
9109
|
-
return this.getGraphicService().onRemove(child), child.setStage(null, null), this.addUpdateBoundTag(), data;
|
|
9696
|
+
return data ? highPerformance ? (null === (_a = child.detachStageForRelease) || void 0 === _a || _a.call(child), data) : (this.getGraphicService().onRemove(child), child.setStage(null, null), this.addUpdateBoundTag(), data) : data;
|
|
9110
9697
|
}
|
|
9111
9698
|
removeAllChild(deep = !1) {
|
|
9112
9699
|
const children = this.children.slice();
|
|
@@ -9118,11 +9705,13 @@ class Group extends Graphic {
|
|
|
9118
9705
|
}
|
|
9119
9706
|
setStage(stage, layer) {
|
|
9120
9707
|
var _a, _b, _c, _d, _e, _f;
|
|
9121
|
-
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
|
|
9122
|
-
|
|
9708
|
+
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,
|
|
9709
|
+
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;
|
|
9710
|
+
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.forEachChildren(item => {
|
|
9123
9711
|
item.setStage(stage, this.layer);
|
|
9124
9712
|
});
|
|
9125
|
-
|
|
9713
|
+
const layerChanged = this.layer !== layer;
|
|
9714
|
+
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.forEachChildren(item => {
|
|
9126
9715
|
item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(stage, this.layer);
|
|
9127
9716
|
});
|
|
9128
9717
|
}
|
|
@@ -9169,15 +9758,29 @@ class Group extends Graphic {
|
|
|
9169
9758
|
g.release(all);
|
|
9170
9759
|
}), super.release();
|
|
9171
9760
|
}
|
|
9761
|
+
detachStageForRelease() {
|
|
9762
|
+
super.detachStageForRelease(), this.sharedStateScope = void 0, this.forEachChildren(item => {
|
|
9763
|
+
var _a;
|
|
9764
|
+
null === (_a = item.detachStageForRelease) || void 0 === _a || _a.call(item);
|
|
9765
|
+
});
|
|
9766
|
+
}
|
|
9172
9767
|
ensureSharedStateScopeBound() {
|
|
9173
9768
|
var _a, _b, _c;
|
|
9769
|
+
if (!this.hasSharedStateDefinitions()) return void (this.sharedStateScope = void 0);
|
|
9174
9770
|
const parentScope = null !== (_b = null === (_a = this.parent) || void 0 === _a ? void 0 : _a.sharedStateScope) && void 0 !== _b ? _b : null === (_c = this.stage) || void 0 === _c ? void 0 : _c.rootSharedStateScope;
|
|
9175
9771
|
this.sharedStateScope ? (this.sharedStateScope.ownerGroup = this, this.sharedStateScope.ownerStage = this.stage, setSharedStateScopeParent(this.sharedStateScope, parentScope), this.sharedStateScope.localStateDefinitions !== this._sharedStateDefinitions && setSharedStateScopeLocalDefinitions(this.sharedStateScope, this._sharedStateDefinitions)) : this.sharedStateScope = createGroupSharedStateScope(this, parentScope, this._sharedStateDefinitions);
|
|
9176
9772
|
}
|
|
9773
|
+
hasSharedStateDefinitions() {
|
|
9774
|
+
return this._hasSharedStateDefinitions;
|
|
9775
|
+
}
|
|
9776
|
+
notifyChildrenSharedStateTreeChanged() {
|
|
9777
|
+
this.forEachChildren(item => {
|
|
9778
|
+
item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(this.stage, this.layer);
|
|
9779
|
+
});
|
|
9780
|
+
}
|
|
9177
9781
|
onParentSharedStateTreeChanged(stage, layer) {
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
})) : this.setStage(stage, layer);
|
|
9782
|
+
var _a;
|
|
9783
|
+
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);
|
|
9181
9784
|
}
|
|
9182
9785
|
}
|
|
9183
9786
|
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
@@ -9365,7 +9968,10 @@ class DefaultGraphicService {
|
|
|
9365
9968
|
beforeUpdateAABBBounds: new SyncHook(["graphic", "stage", "willUpdate", "aabbBounds"]),
|
|
9366
9969
|
afterUpdateAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds", "globalAABBBounds", "selfChange"]),
|
|
9367
9970
|
clearAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds"])
|
|
9368
|
-
}, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds()
|
|
9971
|
+
}, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds(), this.tempAABBBoundsResult = {
|
|
9972
|
+
tb1: this.tempAABBBounds1,
|
|
9973
|
+
tb2: this.tempAABBBounds2
|
|
9974
|
+
};
|
|
9369
9975
|
}
|
|
9370
9976
|
onAttributeUpdate(graphic) {
|
|
9371
9977
|
this.hooks.onAttributeUpdate.taps.length && this.hooks.onAttributeUpdate.call(graphic);
|
|
@@ -9465,10 +10071,7 @@ class DefaultGraphicService {
|
|
|
9465
10071
|
updateTempAABBBounds(aabbBounds) {
|
|
9466
10072
|
const tb1 = this.tempAABBBounds1,
|
|
9467
10073
|
tb2 = this.tempAABBBounds2;
|
|
9468
|
-
return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2),
|
|
9469
|
-
tb1: tb1,
|
|
9470
|
-
tb2: tb2
|
|
9471
|
-
};
|
|
10074
|
+
return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.tempAABBBoundsResult;
|
|
9472
10075
|
}
|
|
9473
10076
|
}
|
|
9474
10077
|
|
|
@@ -12858,7 +13461,11 @@ const result = {
|
|
|
12858
13461
|
};
|
|
12859
13462
|
class BaseRender {
|
|
12860
13463
|
init(contributions) {
|
|
12861
|
-
|
|
13464
|
+
this.builtinContributions || (this.builtinContributions = []), this._renderContribitions = contributions ? contributions.getContributions().slice() : [];
|
|
13465
|
+
const addContribution = item => {
|
|
13466
|
+
this._renderContribitions.includes(item) || this._renderContribitions.push(item);
|
|
13467
|
+
};
|
|
13468
|
+
this.builtinContributions.forEach(addContribution), addContribution(defaultBaseClipRenderBeforeContribution), addContribution(defaultBaseClipRenderAfterContribution), this._renderContribitions.length ? (this._renderContribitions.sort((a, b) => b.order - a.order), this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.beforeFillStroke), this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.afterFillStroke)) : (this._beforeRenderContribitions = [], this._afterRenderContribitions = []);
|
|
12862
13469
|
}
|
|
12863
13470
|
reInit() {
|
|
12864
13471
|
this.init(this.graphicRenderContributions);
|
|
@@ -18241,6 +18848,61 @@ class AnimateComponent extends AbstractComponent {
|
|
|
18241
18848
|
}
|
|
18242
18849
|
}
|
|
18243
18850
|
|
|
18851
|
+
function commitUpdateAnimationTarget(graphic, targetAttrs, startAttrs) {
|
|
18852
|
+
var _a, _b, _c, _d;
|
|
18853
|
+
if (!graphic || !targetAttrs) {
|
|
18854
|
+
return;
|
|
18855
|
+
}
|
|
18856
|
+
const committedTargetAttrs = cloneDeep(targetAttrs);
|
|
18857
|
+
const transientStartAttrs = cloneDeep(startAttrs !== null && startAttrs !== void 0 ? startAttrs : graphic.attribute);
|
|
18858
|
+
graphic.setAttributes(committedTargetAttrs);
|
|
18859
|
+
(_b = (_a = graphic).setFinalAttributes) === null || _b === void 0 ? void 0 : _b.call(_a, committedTargetAttrs);
|
|
18860
|
+
(_d = (_c = graphic).setAttributesAndPreventAnimate) === null || _d === void 0 ? void 0 : _d.call(_c, transientStartAttrs, false, {
|
|
18861
|
+
type: AttributeUpdateType.ANIMATE_BIND
|
|
18862
|
+
});
|
|
18863
|
+
}
|
|
18864
|
+
|
|
18865
|
+
function collectTrackedAnimates(graphic, animates = [], visited = new Set()) {
|
|
18866
|
+
var _a, _b, _c, _d, _e;
|
|
18867
|
+
const trackedAnimates = (_c = (_b = (_a = graphic).getTrackedAnimates) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : graphic.animates;
|
|
18868
|
+
trackedAnimates === null || trackedAnimates === void 0 ? void 0 : trackedAnimates.forEach((animate) => {
|
|
18869
|
+
if (animate && !visited.has(animate)) {
|
|
18870
|
+
visited.add(animate);
|
|
18871
|
+
animates.push(animate);
|
|
18872
|
+
}
|
|
18873
|
+
});
|
|
18874
|
+
(_e = (_d = graphic).forEachChildren) === null || _e === void 0 ? void 0 : _e.call(_d, (child) => {
|
|
18875
|
+
collectTrackedAnimates(child, animates, visited);
|
|
18876
|
+
});
|
|
18877
|
+
return animates;
|
|
18878
|
+
}
|
|
18879
|
+
function appendExitReleaseCallback(state, callback) {
|
|
18880
|
+
if (callback) {
|
|
18881
|
+
state === null || state === void 0 ? void 0 : state.onComplete.push(callback);
|
|
18882
|
+
}
|
|
18883
|
+
}
|
|
18884
|
+
function runExitReleaseCallbacks(callbacks) {
|
|
18885
|
+
callbacks.forEach(callback => {
|
|
18886
|
+
callback();
|
|
18887
|
+
});
|
|
18888
|
+
}
|
|
18889
|
+
function bindExitReleaseAnimates(exitAnimates, getState, finalize) {
|
|
18890
|
+
const finish = (animate) => {
|
|
18891
|
+
const state = getState();
|
|
18892
|
+
if (!state || state.finalized || !state.pendingAnimates.has(animate)) {
|
|
18893
|
+
return;
|
|
18894
|
+
}
|
|
18895
|
+
state.pendingAnimates.delete(animate);
|
|
18896
|
+
if (!state.pendingAnimates.size) {
|
|
18897
|
+
finalize();
|
|
18898
|
+
}
|
|
18899
|
+
};
|
|
18900
|
+
exitAnimates.forEach(animate => {
|
|
18901
|
+
animate.onEnd(() => finish(animate));
|
|
18902
|
+
animate.onRemove(() => finish(animate));
|
|
18903
|
+
});
|
|
18904
|
+
}
|
|
18905
|
+
|
|
18244
18906
|
const DefaultAxisAnimation = {
|
|
18245
18907
|
type: 'default',
|
|
18246
18908
|
duration: 300,
|
|
@@ -18286,7 +18948,101 @@ class AxisBase extends AnimateComponent {
|
|
|
18286
18948
|
this.attribute = currentAttribute;
|
|
18287
18949
|
return offscreenGroup.AABBBounds;
|
|
18288
18950
|
}
|
|
18951
|
+
_finalizeExitRelease() {
|
|
18952
|
+
var _a, _b;
|
|
18953
|
+
const state = this._exitReleaseState;
|
|
18954
|
+
if (state === null || state === void 0 ? void 0 : state.finalized) {
|
|
18955
|
+
return;
|
|
18956
|
+
}
|
|
18957
|
+
if (state) {
|
|
18958
|
+
state.finalized = true;
|
|
18959
|
+
}
|
|
18960
|
+
const parent = this.parent;
|
|
18961
|
+
const removeFromParent = !!(state === null || state === void 0 ? void 0 : state.removeFromParent);
|
|
18962
|
+
const callbacks = (_a = state === null || state === void 0 ? void 0 : state.onComplete) !== null && _a !== void 0 ? _a : [];
|
|
18963
|
+
this._exitReleaseState = undefined;
|
|
18964
|
+
this._prevInnerView = null;
|
|
18965
|
+
this._innerView = null;
|
|
18966
|
+
this.axisLabelsContainer = null;
|
|
18967
|
+
this.axisContainer = null;
|
|
18968
|
+
this.removeAllChild(true);
|
|
18969
|
+
super.release(true);
|
|
18970
|
+
if (removeFromParent) {
|
|
18971
|
+
(_b = (parent !== null && parent !== void 0 ? parent : this.parent)) === null || _b === void 0 ? void 0 : _b.removeChild(this);
|
|
18972
|
+
}
|
|
18973
|
+
runExitReleaseCallbacks(callbacks);
|
|
18974
|
+
}
|
|
18975
|
+
_runExitAnimationBeforeRelease(options = {}) {
|
|
18976
|
+
var _a, _b, _c;
|
|
18977
|
+
if (this._exitReleaseState && !this._exitReleaseState.finalized) {
|
|
18978
|
+
this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent;
|
|
18979
|
+
appendExitReleaseCallback(this._exitReleaseState, options.onComplete);
|
|
18980
|
+
return true;
|
|
18981
|
+
}
|
|
18982
|
+
if (!this.stage ||
|
|
18983
|
+
this.attribute.animation === false ||
|
|
18984
|
+
this.attribute.animationExit === false ||
|
|
18985
|
+
!this._innerView) {
|
|
18986
|
+
return false;
|
|
18987
|
+
}
|
|
18988
|
+
this._prepare();
|
|
18989
|
+
if (!((_a = this._animationConfig) === null || _a === void 0 ? void 0 : _a.exit)) {
|
|
18990
|
+
return false;
|
|
18991
|
+
}
|
|
18992
|
+
const exitTargets = new Set();
|
|
18993
|
+
traverseGroup(this._innerView, (el) => {
|
|
18994
|
+
if (el.type !== 'group') {
|
|
18995
|
+
exitTargets.add(el);
|
|
18996
|
+
}
|
|
18997
|
+
});
|
|
18998
|
+
if (!exitTargets.size) {
|
|
18999
|
+
return false;
|
|
19000
|
+
}
|
|
19001
|
+
const existingAnimates = collectTrackedAnimates(this);
|
|
19002
|
+
const { delay = 0, duration = DefaultAxisAnimation.duration, easing = DefaultAxisAnimation.easing } = this._animationConfig.exit;
|
|
19003
|
+
exitTargets.forEach(target => {
|
|
19004
|
+
var _a, _b, _c;
|
|
19005
|
+
const startAttrs = {
|
|
19006
|
+
opacity: (_a = target.attribute.opacity) !== null && _a !== void 0 ? _a : 1,
|
|
19007
|
+
fillOpacity: (_b = target.attribute.fillOpacity) !== null && _b !== void 0 ? _b : 1,
|
|
19008
|
+
strokeOpacity: (_c = target.attribute.strokeOpacity) !== null && _c !== void 0 ? _c : 1
|
|
19009
|
+
};
|
|
19010
|
+
const endAttrs = {
|
|
19011
|
+
opacity: 0,
|
|
19012
|
+
fillOpacity: 0,
|
|
19013
|
+
strokeOpacity: 0
|
|
19014
|
+
};
|
|
19015
|
+
commitUpdateAnimationTarget(target, endAttrs, startAttrs);
|
|
19016
|
+
target.animate().wait(delay).to(endAttrs, duration, easing);
|
|
19017
|
+
});
|
|
19018
|
+
const animates = collectTrackedAnimates(this);
|
|
19019
|
+
const exitAnimates = animates.filter(animate => !existingAnimates.includes(animate));
|
|
19020
|
+
if (!exitAnimates.length) {
|
|
19021
|
+
return false;
|
|
19022
|
+
}
|
|
19023
|
+
this.setAttribute('childrenPickable', false);
|
|
19024
|
+
(_c = (_b = this._innerView).removeAllEventListeners) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
19025
|
+
this.releaseStatus = 'willRelease';
|
|
19026
|
+
const pendingAnimates = new Set(exitAnimates);
|
|
19027
|
+
this._exitReleaseState = {
|
|
19028
|
+
pendingAnimates,
|
|
19029
|
+
finalized: false,
|
|
19030
|
+
removeFromParent: !!options.removeFromParent,
|
|
19031
|
+
onComplete: options.onComplete ? [options.onComplete] : []
|
|
19032
|
+
};
|
|
19033
|
+
bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease());
|
|
19034
|
+
return true;
|
|
19035
|
+
}
|
|
19036
|
+
releaseWithExitAnimation(options = {}) {
|
|
19037
|
+
if (this.releaseStatus === 'released') {
|
|
19038
|
+
return false;
|
|
19039
|
+
}
|
|
19040
|
+
return this._runExitAnimationBeforeRelease(options);
|
|
19041
|
+
}
|
|
18289
19042
|
render() {
|
|
19043
|
+
if (this._exitReleaseState) {
|
|
19044
|
+
return;
|
|
19045
|
+
}
|
|
18290
19046
|
this._prepare();
|
|
18291
19047
|
this._prevInnerView = this._innerView && getElMap(this._innerView);
|
|
18292
19048
|
this.removeAllChild(true);
|
|
@@ -18642,11 +19398,10 @@ class AxisBase extends AnimateComponent {
|
|
|
18642
19398
|
var _a;
|
|
18643
19399
|
if (el.type !== 'group' && el.id) {
|
|
18644
19400
|
const oldEl = prevInnerView[el.id];
|
|
18645
|
-
el.setFinalAttributes(el.attribute);
|
|
18646
19401
|
if (oldEl) {
|
|
18647
19402
|
oldEl.release();
|
|
18648
|
-
const oldAttrs = oldEl.attribute;
|
|
18649
|
-
const finalAttrs = el.
|
|
19403
|
+
const oldAttrs = cloneDeep(oldEl.attribute);
|
|
19404
|
+
const finalAttrs = cloneDeep(el.attribute);
|
|
18650
19405
|
const diffAttrs = diff(oldAttrs, finalAttrs);
|
|
18651
19406
|
let hasDiff = Object.keys(diffAttrs).length > 0;
|
|
18652
19407
|
if ('opacity' in oldAttrs && finalAttrs.opacity !== oldAttrs.opacity) {
|
|
@@ -18657,10 +19412,9 @@ class AxisBase extends AnimateComponent {
|
|
|
18657
19412
|
this._newElementAttrMap[el.id] = {
|
|
18658
19413
|
state: 'update',
|
|
18659
19414
|
node: el,
|
|
18660
|
-
attrs:
|
|
19415
|
+
attrs: finalAttrs
|
|
18661
19416
|
};
|
|
18662
|
-
|
|
18663
|
-
el.setAttributes(oldAttrs);
|
|
19417
|
+
commitUpdateAnimationTarget(el, finalAttrs, oldAttrs);
|
|
18664
19418
|
el.applyAnimationState(['update'], [
|
|
18665
19419
|
{
|
|
18666
19420
|
name: 'update',
|
|
@@ -18694,8 +19448,18 @@ class AxisBase extends AnimateComponent {
|
|
|
18694
19448
|
});
|
|
18695
19449
|
}
|
|
18696
19450
|
}
|
|
18697
|
-
release() {
|
|
18698
|
-
|
|
19451
|
+
release(all) {
|
|
19452
|
+
if (this._exitReleaseState) {
|
|
19453
|
+
this._finalizeExitRelease();
|
|
19454
|
+
return;
|
|
19455
|
+
}
|
|
19456
|
+
if (all) {
|
|
19457
|
+
this.removeAllChild(true);
|
|
19458
|
+
}
|
|
19459
|
+
super.release(all);
|
|
19460
|
+
if (all) {
|
|
19461
|
+
this.removeAllChild(true);
|
|
19462
|
+
}
|
|
18699
19463
|
this._prevInnerView = null;
|
|
18700
19464
|
this._innerView = null;
|
|
18701
19465
|
}
|
|
@@ -19387,7 +20151,42 @@ function commonInterpolateUpdate(key, from, to, ratio, step, target) {
|
|
|
19387
20151
|
return !1;
|
|
19388
20152
|
}
|
|
19389
20153
|
|
|
20154
|
+
const animateUpdateContext = {
|
|
20155
|
+
type: AttributeUpdateType.ANIMATE_UPDATE
|
|
20156
|
+
},
|
|
20157
|
+
animateBindContext = {
|
|
20158
|
+
type: AttributeUpdateType.ANIMATE_BIND
|
|
20159
|
+
},
|
|
20160
|
+
animateStartContext = {
|
|
20161
|
+
type: AttributeUpdateType.ANIMATE_START
|
|
20162
|
+
};
|
|
20163
|
+
function getAnimationContext(type) {
|
|
20164
|
+
switch (type) {
|
|
20165
|
+
case AttributeUpdateType.ANIMATE_UPDATE:
|
|
20166
|
+
return animateUpdateContext;
|
|
20167
|
+
case AttributeUpdateType.ANIMATE_BIND:
|
|
20168
|
+
return animateBindContext;
|
|
20169
|
+
case AttributeUpdateType.ANIMATE_START:
|
|
20170
|
+
return animateStartContext;
|
|
20171
|
+
default:
|
|
20172
|
+
return {
|
|
20173
|
+
type: type
|
|
20174
|
+
};
|
|
20175
|
+
}
|
|
20176
|
+
}
|
|
20177
|
+
function applyAnimationTransientAttributes(target, attributes, type = AttributeUpdateType.ANIMATE_UPDATE) {
|
|
20178
|
+
var _a;
|
|
20179
|
+
if (!attributes) return;
|
|
20180
|
+
const context = getAnimationContext(type),
|
|
20181
|
+
transientTarget = target;
|
|
20182
|
+
"function" != typeof transientTarget.applyAnimationTransientAttributes ? "function" != typeof transientTarget.applyTransientAttributes ? "function" != typeof transientTarget.setAttributesAndPreventAnimate ? (transientTarget.attribute || (transientTarget.attribute = {}), Object.assign(transientTarget.attribute, attributes), null === (_a = transientTarget.onAttributeUpdate) || void 0 === _a || _a.call(transientTarget, context)) : transientTarget.setAttributesAndPreventAnimate(attributes, !1, context) : transientTarget.applyTransientAttributes(attributes, !1, context) : transientTarget.applyAnimationTransientAttributes(attributes, !1, context);
|
|
20183
|
+
}
|
|
20184
|
+
|
|
19390
20185
|
function noop() {}
|
|
20186
|
+
function includesKey$1(keys, key) {
|
|
20187
|
+
for (let i = 0; i < keys.length; i++) if (keys[i] === key) return !0;
|
|
20188
|
+
return !1;
|
|
20189
|
+
}
|
|
19391
20190
|
class Step {
|
|
19392
20191
|
constructor(type, props, duration, easing) {
|
|
19393
20192
|
var _a;
|
|
@@ -19443,6 +20242,17 @@ class Step {
|
|
|
19443
20242
|
onBind() {
|
|
19444
20243
|
"glyph" === this.target.type && (this.syncAttributeUpdate = this._syncAttributeUpdate);
|
|
19445
20244
|
}
|
|
20245
|
+
runInterpolateUpdate(fromProps, toProps, ratio) {
|
|
20246
|
+
if (this.animate.interpolateUpdateFunction) return void this.animate.interpolateUpdateFunction(fromProps, toProps, ratio, this, this.target);
|
|
20247
|
+
const funcs = this.interpolateUpdateFunctions,
|
|
20248
|
+
propKeys = this.propKeys;
|
|
20249
|
+
if (funcs && propKeys) for (let index = 0; index < funcs.length; index++) {
|
|
20250
|
+
const key = propKeys[index],
|
|
20251
|
+
fromValue = fromProps[key],
|
|
20252
|
+
toValue = toProps[key];
|
|
20253
|
+
funcs[index](key, fromValue, toValue, ratio, this, this.target);
|
|
20254
|
+
}
|
|
20255
|
+
}
|
|
19446
20256
|
onFirstRun() {}
|
|
19447
20257
|
onStart() {
|
|
19448
20258
|
if (!this._hasFirstRun) {
|
|
@@ -19457,23 +20267,49 @@ class Step {
|
|
|
19457
20267
|
tryPreventConflict() {
|
|
19458
20268
|
var _a, _b;
|
|
19459
20269
|
const animate = this.animate,
|
|
19460
|
-
target = this.target
|
|
19461
|
-
|
|
19462
|
-
|
|
19463
|
-
|
|
19464
|
-
|
|
20270
|
+
target = this.target,
|
|
20271
|
+
forEachTrackedAnimate = null !== (_b = null === (_a = target.forEachTrackedAnimate) || void 0 === _a ? void 0 : _a.bind(target)) && void 0 !== _b ? _b : cb => {
|
|
20272
|
+
var _a;
|
|
20273
|
+
null === (_a = target.animates) || void 0 === _a || _a.forEach(cb);
|
|
20274
|
+
},
|
|
20275
|
+
propKeys = this.propKeys;
|
|
20276
|
+
forEachTrackedAnimate(a => {
|
|
19465
20277
|
if (a === animate || a.priority > animate.priority || a.priority === 1 / 0) return;
|
|
19466
20278
|
const fromProps = a.getStartProps();
|
|
19467
|
-
|
|
19468
|
-
|
|
19469
|
-
|
|
20279
|
+
let conflictKeys = null;
|
|
20280
|
+
for (let i = 0; i < propKeys.length; i++) {
|
|
20281
|
+
const key = propKeys[i];
|
|
20282
|
+
null != fromProps[key] && (null != conflictKeys ? conflictKeys : conflictKeys = []).push(key);
|
|
20283
|
+
}
|
|
20284
|
+
conflictKeys && a.preventAttrs(conflictKeys);
|
|
19470
20285
|
});
|
|
19471
20286
|
}
|
|
20287
|
+
removeKeysFromRecord(record, keys) {
|
|
20288
|
+
if (!record) return record;
|
|
20289
|
+
let hasBlockedKey = !1;
|
|
20290
|
+
for (const key in record) if (Object.prototype.hasOwnProperty.call(record, key) && includesKey$1(keys, key)) {
|
|
20291
|
+
hasBlockedKey = !0;
|
|
20292
|
+
break;
|
|
20293
|
+
}
|
|
20294
|
+
if (!hasBlockedKey) return record;
|
|
20295
|
+
const nextRecord = {};
|
|
20296
|
+
for (const key in record) Object.prototype.hasOwnProperty.call(record, key) && !includesKey$1(keys, key) && (nextRecord[key] = record[key]);
|
|
20297
|
+
return nextRecord;
|
|
20298
|
+
}
|
|
19472
20299
|
deleteSelfAttr(key) {
|
|
20300
|
+
this.deleteSelfAttrs([key]);
|
|
20301
|
+
}
|
|
20302
|
+
deleteSelfAttrs(keys) {
|
|
19473
20303
|
var _a;
|
|
19474
|
-
|
|
19475
|
-
|
|
19476
|
-
|
|
20304
|
+
if ((null == keys ? void 0 : keys.length) && (this.props = this.removeKeysFromRecord(this.props, keys), this.fromProps = this.removeKeysFromRecord(this.fromProps, keys), this.fromParsedProps = this.removeKeysFromRecord(this.fromParsedProps, keys), this.toParsedProps = this.removeKeysFromRecord(this.toParsedProps, keys), null === (_a = this.propKeys) || void 0 === _a ? void 0 : _a.length)) {
|
|
20305
|
+
const funcs = this.interpolateUpdateFunctions;
|
|
20306
|
+
let writeIndex = 0;
|
|
20307
|
+
for (let readIndex = 0; readIndex < this.propKeys.length; readIndex++) {
|
|
20308
|
+
const propKey = this.propKeys[readIndex];
|
|
20309
|
+
includesKey$1(keys, propKey) || (writeIndex !== readIndex && (this.propKeys[writeIndex] = propKey, funcs && (funcs[writeIndex] = funcs[readIndex])), writeIndex++);
|
|
20310
|
+
}
|
|
20311
|
+
this.propKeys.length = writeIndex, funcs && (funcs.length = writeIndex);
|
|
20312
|
+
}
|
|
19477
20313
|
}
|
|
19478
20314
|
trySyncStartProps() {
|
|
19479
20315
|
this.propKeys.forEach(key => {
|
|
@@ -19483,11 +20319,7 @@ class Step {
|
|
|
19483
20319
|
update(end, ratio, out) {
|
|
19484
20320
|
if (this.onStart(), !this.props || !this.propKeys) return;
|
|
19485
20321
|
const easedRatio = this.easing(ratio);
|
|
19486
|
-
this.
|
|
19487
|
-
if (!this.animate.validAttr(this.propKeys[index])) return;
|
|
19488
|
-
const key = this.propKeys[index];
|
|
19489
|
-
func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
|
|
19490
|
-
}), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
|
|
20322
|
+
this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
|
|
19491
20323
|
}
|
|
19492
20324
|
onUpdate(end, ratio, out) {}
|
|
19493
20325
|
onEnd(cb) {
|
|
@@ -19512,7 +20344,7 @@ class WaitStep extends Step {
|
|
|
19512
20344
|
onStart() {
|
|
19513
20345
|
super.onStart();
|
|
19514
20346
|
const fromProps = this.getFromProps();
|
|
19515
|
-
this.target.
|
|
20347
|
+
applyAnimationTransientAttributes(this.target, fromProps, AttributeUpdateType.ANIMATE_START);
|
|
19516
20348
|
}
|
|
19517
20349
|
update(end, ratio, out) {
|
|
19518
20350
|
this.onStart();
|
|
@@ -19652,19 +20484,34 @@ class FromTo extends ACustomAnimate {
|
|
|
19652
20484
|
}), this.applyTransientFromAttributes();
|
|
19653
20485
|
}
|
|
19654
20486
|
deleteSelfAttr(key) {
|
|
19655
|
-
|
|
20487
|
+
this.deleteSelfAttrs([key]);
|
|
20488
|
+
}
|
|
20489
|
+
deleteSelfAttrs(keys) {
|
|
20490
|
+
super.deleteSelfAttrs(keys), this.from = this.removeKeysFromRecord(this.from, keys);
|
|
19656
20491
|
}
|
|
19657
20492
|
update(end, ratio, out) {
|
|
19658
20493
|
if (this.onStart(), !this.props || !this.propKeys) return;
|
|
19659
20494
|
const easedRatio = this.easing(ratio);
|
|
19660
|
-
this.
|
|
19661
|
-
if (!this.animate.validAttr(this.propKeys[index])) return;
|
|
19662
|
-
const key = this.propKeys[index];
|
|
19663
|
-
func(key, this.from[key], this.props[key], easedRatio, this, this.target);
|
|
19664
|
-
}), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
|
|
20495
|
+
this.runInterpolateUpdate(this.from, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
|
|
19665
20496
|
}
|
|
19666
20497
|
}
|
|
19667
20498
|
|
|
20499
|
+
function includesKey(keys, key) {
|
|
20500
|
+
for (let i = 0; i < keys.length; i++) if (keys[i] === key) return !0;
|
|
20501
|
+
return !1;
|
|
20502
|
+
}
|
|
20503
|
+
function removeKeysFromRecord(record, keys) {
|
|
20504
|
+
if (!record) return record;
|
|
20505
|
+
let hasBlockedKey = !1;
|
|
20506
|
+
for (const key in record) if (Object.prototype.hasOwnProperty.call(record, key) && includesKey(keys, key)) {
|
|
20507
|
+
hasBlockedKey = !0;
|
|
20508
|
+
break;
|
|
20509
|
+
}
|
|
20510
|
+
if (!hasBlockedKey) return record;
|
|
20511
|
+
const nextRecord = {};
|
|
20512
|
+
for (const key in record) Object.prototype.hasOwnProperty.call(record, key) && !includesKey(keys, key) && (nextRecord[key] = record[key]);
|
|
20513
|
+
return nextRecord;
|
|
20514
|
+
}
|
|
19668
20515
|
class Animate {
|
|
19669
20516
|
constructor(id = Generator.GenAutoIncrementId(), timeline = defaultTimeline, slience) {
|
|
19670
20517
|
this.id = id, this.status = AnimateStatus.INITIAL, this._timeline = timeline, timeline.addAnimate(this), this.slience = slience, this._startTime = 0, this._duration = 0, this._totalDuration = 0, this._loopCount = 0, this._currentLoop = 0, this._bounce = !1, this._firstStep = null, this._lastStep = null, this._startProps = {}, this._endProps = {}, this._preventAttrs = new Set(), this.currentTime = 0, this.interpolateUpdateFunction = null, this.priority = 0;
|
|
@@ -19687,8 +20534,8 @@ class Animate {
|
|
|
19687
20534
|
bind(target) {
|
|
19688
20535
|
this.target = target;
|
|
19689
20536
|
const trackerTarget = this.target;
|
|
19690
|
-
return "function" == typeof trackerTarget.trackAnimate ? trackerTarget.trackAnimate(this) : (this.target.animates || (this.target.animates = new Map()), this.target.animates.set(this.id, this)), this.onRemove(() => {
|
|
19691
|
-
this.stop(), "function"
|
|
20537
|
+
return "function" == typeof trackerTarget.detachAttributeFromBaseAttributes && trackerTarget.detachAttributeFromBaseAttributes(), "function" == typeof trackerTarget.trackAnimate ? trackerTarget.trackAnimate(this) : (this.target.animates || (this.target.animates = new Map()), this.target.animates.set(this.id, this)), this.onRemove(() => {
|
|
20538
|
+
this.stop(), this.__skipRestoreStaticAttributeOnRemove || "function" != typeof trackerTarget.restoreStaticAttribute || trackerTarget.restoreStaticAttribute(), "function" == typeof trackerTarget.untrackAnimate ? trackerTarget.untrackAnimate(this.id) : this.target.animates.delete(this.id);
|
|
19692
20539
|
}), this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
|
|
19693
20540
|
}
|
|
19694
20541
|
to(props, duration = 300, easing = "linear") {
|
|
@@ -19752,12 +20599,14 @@ class Animate {
|
|
|
19752
20599
|
cb ? (this._onRemove || (this._onRemove = []), this._onRemove.push(cb)) : null === (_a = this._onRemove) || void 0 === _a || _a.forEach(cb => cb());
|
|
19753
20600
|
}
|
|
19754
20601
|
preventAttr(key) {
|
|
19755
|
-
this.
|
|
19756
|
-
let step = this._firstStep;
|
|
19757
|
-
for (; step;) step.deleteSelfAttr(key), step = step.next;
|
|
20602
|
+
this.preventAttrs([key]);
|
|
19758
20603
|
}
|
|
19759
20604
|
preventAttrs(keys) {
|
|
19760
|
-
|
|
20605
|
+
if (!(null == keys ? void 0 : keys.length)) return;
|
|
20606
|
+
for (let i = 0; i < keys.length; i++) this._preventAttrs.add(keys[i]);
|
|
20607
|
+
this._startProps = removeKeysFromRecord(this._startProps, keys), this._endProps = removeKeysFromRecord(this._endProps, keys);
|
|
20608
|
+
let step = this._firstStep;
|
|
20609
|
+
for (; step;) step.deleteSelfAttrs(keys), step = step.next;
|
|
19761
20610
|
}
|
|
19762
20611
|
validAttr(key) {
|
|
19763
20612
|
return !this._preventAttrs.has(key);
|
|
@@ -19824,7 +20673,7 @@ class Animate {
|
|
|
19824
20673
|
if (nextTime >= this._startTime + this._totalDuration) {
|
|
19825
20674
|
null === (_a = this._lastStep) || void 0 === _a || _a.onUpdate(!0, 1, {}), null === (_b = this._lastStep) || void 0 === _b || _b.onEnd(), this.onEnd(), this.status = AnimateStatus.END;
|
|
19826
20675
|
const trackerTarget = this.target;
|
|
19827
|
-
return
|
|
20676
|
+
return "function" == typeof (null == trackerTarget ? void 0 : trackerTarget.restoreStaticAttribute) && trackerTarget.restoreStaticAttribute(), void (this.__skipRestoreStaticAttributeOnRemove = !0);
|
|
19828
20677
|
}
|
|
19829
20678
|
this.status = AnimateStatus.RUNNING, this.currentTime <= this._startTime && this.onStart(), this.currentTime = nextTime;
|
|
19830
20679
|
let cycleTime = nextTime - this._startTime,
|
|
@@ -19835,7 +20684,7 @@ class Animate {
|
|
|
19835
20684
|
const currentLoop = Math.floor((nextTime - this._startTime) / this._duration);
|
|
19836
20685
|
newLoop = currentLoop > this._currentLoop, this._currentLoop = currentLoop, bounceTime = this._bounce && currentLoop % 2 == 1, bounceTime && (cycleTime = this._duration - cycleTime);
|
|
19837
20686
|
}
|
|
19838
|
-
newLoop && !bounceTime && this.target
|
|
20687
|
+
newLoop && !bounceTime && applyAnimationTransientAttributes(this.target, this._startProps, AttributeUpdateType.ANIMATE_START);
|
|
19839
20688
|
let targetStep = null;
|
|
19840
20689
|
if (this._lastStep === this._firstStep) targetStep = this._firstStep;else {
|
|
19841
20690
|
let currentStep = this._firstStep;
|
|
@@ -20070,6 +20919,9 @@ class AnimationTransitionRegistry {
|
|
|
20070
20919
|
})), this.registerTransition("state", "*", () => ({
|
|
20071
20920
|
allowTransition: !0,
|
|
20072
20921
|
stopOriginalTransition: !1
|
|
20922
|
+
})), this.registerTransition("state", "state", () => ({
|
|
20923
|
+
allowTransition: !0,
|
|
20924
|
+
stopOriginalTransition: !0
|
|
20073
20925
|
})), this.registerTransition("state", "disappear", () => ({
|
|
20074
20926
|
allowTransition: !0,
|
|
20075
20927
|
stopOriginalTransition: !0
|
|
@@ -20111,7 +20963,7 @@ class AnimateExecutor {
|
|
|
20111
20963
|
AnimateExecutor.builtInAnimateMap[name] = animate;
|
|
20112
20964
|
}
|
|
20113
20965
|
constructor(target) {
|
|
20114
|
-
this._animates = [], this._startCallbacks = [], this._endCallbacks = [], this._started = !1, this._activeCount = 0, this._target = target;
|
|
20966
|
+
this._animates = [], this._startCallbacks = [], this._endCallbacks = [], this._started = !1, this._activeCount = 0, this._activeConfigList = null, this._target = target;
|
|
20115
20967
|
}
|
|
20116
20968
|
get started() {
|
|
20117
20969
|
return this._started;
|
|
@@ -20126,6 +20978,33 @@ class AnimateExecutor {
|
|
|
20126
20978
|
cb();
|
|
20127
20979
|
});
|
|
20128
20980
|
}
|
|
20981
|
+
getActiveAttrKeys() {
|
|
20982
|
+
const keys = [];
|
|
20983
|
+
for (let i = 0; i < this._animates.length; i++) {
|
|
20984
|
+
const animate = this._animates[i];
|
|
20985
|
+
if (animate.status === AnimateStatus.END) continue;
|
|
20986
|
+
const endProps = animate.getEndProps();
|
|
20987
|
+
if (endProps) for (const key in endProps) Object.prototype.hasOwnProperty.call(endProps, key) && keys.indexOf(key) < 0 && keys.push(key);
|
|
20988
|
+
}
|
|
20989
|
+
return keys;
|
|
20990
|
+
}
|
|
20991
|
+
hasActiveAttrs() {
|
|
20992
|
+
for (let i = 0; i < this._animates.length; i++) {
|
|
20993
|
+
const animate = this._animates[i];
|
|
20994
|
+
if (animate.status === AnimateStatus.END) continue;
|
|
20995
|
+
const endProps = animate.getEndProps();
|
|
20996
|
+
if (endProps) for (const key in endProps) if (Object.prototype.hasOwnProperty.call(endProps, key)) return !0;
|
|
20997
|
+
}
|
|
20998
|
+
return !1;
|
|
20999
|
+
}
|
|
21000
|
+
preventAttrs(keys) {
|
|
21001
|
+
if (!(null == keys ? void 0 : keys.length)) return this.hasActiveAttrs();
|
|
21002
|
+
for (let i = 0; i < this._animates.length; i++) {
|
|
21003
|
+
const animate = this._animates[i];
|
|
21004
|
+
animate.status !== AnimateStatus.END && animate.preventAttrs(keys);
|
|
21005
|
+
}
|
|
21006
|
+
return this.hasActiveAttrs();
|
|
21007
|
+
}
|
|
20129
21008
|
_trackAnimation(animate) {
|
|
20130
21009
|
this._animates.push(animate), this._activeCount++, 1 !== this._activeCount || this._started || (this._started = !0, this.onStart()), animate.onEnd(() => {
|
|
20131
21010
|
this._activeCount--;
|
|
@@ -20193,7 +21072,15 @@ class AnimateExecutor {
|
|
|
20193
21072
|
return parsedParams;
|
|
20194
21073
|
}
|
|
20195
21074
|
execute(params) {
|
|
20196
|
-
Array.isArray(params)
|
|
21075
|
+
if (Array.isArray(params)) {
|
|
21076
|
+
const prevConfigList = this._activeConfigList;
|
|
21077
|
+
this._activeConfigList = params;
|
|
21078
|
+
try {
|
|
21079
|
+
params.forEach(param => this._execute(param));
|
|
21080
|
+
} finally {
|
|
21081
|
+
this._activeConfigList = prevConfigList;
|
|
21082
|
+
}
|
|
21083
|
+
} else this._execute(params);
|
|
20197
21084
|
}
|
|
20198
21085
|
_execute(params) {
|
|
20199
21086
|
if (params.selfOnly) return this._executeItem(params, this._target, 0, 1);
|
|
@@ -20219,6 +21106,7 @@ class AnimateExecutor {
|
|
|
20219
21106
|
}
|
|
20220
21107
|
executeTypeConfigItem(params, graphic, index, count) {
|
|
20221
21108
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
21109
|
+
this.syncFinalAttrsFromContext(graphic);
|
|
20222
21110
|
const {
|
|
20223
21111
|
type = "fromTo",
|
|
20224
21112
|
channel: channel,
|
|
@@ -20248,7 +21136,8 @@ class AnimateExecutor {
|
|
|
20248
21136
|
let parsedFromProps = null,
|
|
20249
21137
|
props = params.to,
|
|
20250
21138
|
from = params.from;
|
|
20251
|
-
|
|
21139
|
+
const commitAttrOutChannel = this.shouldCommitAttrOutChannel(type);
|
|
21140
|
+
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel, this.getAttrOutChannelExcludedKeys(graphic))), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel, this.getAttrOutChannelExcludedKeys(graphic))), from = parsedFromProps.from), parsedFromProps.attrOutChannel && graphic.setAttributes(parsedFromProps.attrOutChannel), this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
20252
21141
|
let totalDelay = 0;
|
|
20253
21142
|
oneByOneDelay && (totalDelay = oneByOneDelay * (count - index - 1));
|
|
20254
21143
|
const delayAfterValue = isFunction(delayAfter) ? delayAfter(null === (_h = null === (_g = graphic.context) || void 0 === _g ? void 0 : _g.data) || void 0 === _h ? void 0 : _h[0], graphic, {}) : delayAfter;
|
|
@@ -20270,6 +21159,7 @@ class AnimateExecutor {
|
|
|
20270
21159
|
}
|
|
20271
21160
|
executeTimelineItem(params, graphic, index, count) {
|
|
20272
21161
|
var _a, _b, _c, _d;
|
|
21162
|
+
this.syncFinalAttrsFromContext(graphic);
|
|
20273
21163
|
const {
|
|
20274
21164
|
timeSlices: timeSlices,
|
|
20275
21165
|
startTime = 0,
|
|
@@ -20311,7 +21201,8 @@ class AnimateExecutor {
|
|
|
20311
21201
|
let parsedFromProps = null,
|
|
20312
21202
|
props = effect.to,
|
|
20313
21203
|
from = effect.from;
|
|
20314
|
-
|
|
21204
|
+
const commitAttrOutChannel = this.shouldCommitAttrOutChannel(type);
|
|
21205
|
+
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel, this.getAttrOutChannelExcludedKeys(graphic))), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel, this.getAttrOutChannelExcludedKeys(graphic))), from = parsedFromProps.from), parsedFromProps.attrOutChannel && graphic.setAttributes(parsedFromProps.attrOutChannel);
|
|
20315
21206
|
const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
|
|
20316
21207
|
customType = effect.custom ? effect.customType : getCustomType(custom);
|
|
20317
21208
|
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
@@ -20325,11 +21216,14 @@ class AnimateExecutor {
|
|
|
20325
21216
|
interpolator(ratio, from, to, step, target, animate.target, customParams);
|
|
20326
21217
|
}, animate.to(props, duration, easing);
|
|
20327
21218
|
}
|
|
21219
|
+
shouldCommitAttrOutChannel(type) {
|
|
21220
|
+
return "update" !== type;
|
|
21221
|
+
}
|
|
20328
21222
|
createCustomAnimation(animate, CustomAnimateConstructor, from, props, duration, easing, customParams) {
|
|
20329
21223
|
const customAnimate = new CustomAnimateConstructor(from, props, duration, easing, customParams);
|
|
20330
21224
|
animate.play(customAnimate);
|
|
20331
21225
|
}
|
|
20332
|
-
createPropsFromChannel(channel, graphic) {
|
|
21226
|
+
createPropsFromChannel(channel, graphic, includeAttrOutChannel = !0, excludedAttrOutKeys) {
|
|
20333
21227
|
var _a;
|
|
20334
21228
|
const props = {};
|
|
20335
21229
|
let from = null;
|
|
@@ -20338,7 +21232,7 @@ class AnimateExecutor {
|
|
|
20338
21232
|
props: props,
|
|
20339
21233
|
attrOutChannel: null
|
|
20340
21234
|
};
|
|
20341
|
-
const attrOutChannel = {};
|
|
21235
|
+
const attrOutChannel = includeAttrOutChannel ? {} : null;
|
|
20342
21236
|
let hasAttrs = !1;
|
|
20343
21237
|
const diffAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs;
|
|
20344
21238
|
if (Array.isArray(channel) && (channel = channel.reduce((res, key) => (void 0 === diffAttrs[key] || (res[key] = {
|
|
@@ -20347,9 +21241,10 @@ class AnimateExecutor {
|
|
|
20347
21241
|
var _a, _b, _c, _d;
|
|
20348
21242
|
const config = channel[key];
|
|
20349
21243
|
void 0 !== config.to && ("function" == typeof config.to ? props[key] = config.to(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : props[key] = config.to), void 0 !== config.from && (from || (from = {}), "function" == typeof config.from ? from[key] = config.from(null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, {}) : from[key] = config.from);
|
|
20350
|
-
}), diffAttrs) for (const key in diffAttrs) {
|
|
21244
|
+
}), diffAttrs && attrOutChannel) for (const key in diffAttrs) {
|
|
20351
21245
|
const value = diffAttrs[key];
|
|
20352
|
-
void 0
|
|
21246
|
+
if (void 0 === value) continue;
|
|
21247
|
+
props.hasOwnProperty(key) || !!(null == from ? void 0 : from.hasOwnProperty(key)) || (null == excludedAttrOutKeys ? void 0 : excludedAttrOutKeys[key]) || (attrOutChannel[key] = value, hasAttrs = !0);
|
|
20353
21248
|
}
|
|
20354
21249
|
return {
|
|
20355
21250
|
from: from,
|
|
@@ -20361,8 +21256,78 @@ class AnimateExecutor {
|
|
|
20361
21256
|
var _a, _b;
|
|
20362
21257
|
return void 0 === value ? defaultValue : "function" == typeof value && graphic ? value(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : value;
|
|
20363
21258
|
}
|
|
21259
|
+
getAttrOutChannelExcludedKeys(graphic) {
|
|
21260
|
+
var _a;
|
|
21261
|
+
const configList = this._activeConfigList,
|
|
21262
|
+
diffAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs;
|
|
21263
|
+
if (!configList || configList.length <= 1 || !diffAttrs) return null;
|
|
21264
|
+
let excludedKeys = null;
|
|
21265
|
+
for (let i = 0; i < configList.length; i++) excludedKeys = this.collectAnimatedDiffKeys(configList[i], graphic, diffAttrs, excludedKeys);
|
|
21266
|
+
return excludedKeys;
|
|
21267
|
+
}
|
|
21268
|
+
collectAnimatedDiffKeys(config, graphic, diffAttrs, keys) {
|
|
21269
|
+
if ("timeSlices" in config) {
|
|
21270
|
+
const slices = Array.isArray(config.timeSlices) ? config.timeSlices : [config.timeSlices];
|
|
21271
|
+
for (let i = 0; i < slices.length; i++) {
|
|
21272
|
+
const effects = Array.isArray(slices[i].effects) ? slices[i].effects : [slices[i].effects];
|
|
21273
|
+
for (let j = 0; j < effects.length; j++) keys = this.collectAnimatedDiffKeysFromEffect(effects[j], graphic, diffAttrs, keys);
|
|
21274
|
+
}
|
|
21275
|
+
return keys;
|
|
21276
|
+
}
|
|
21277
|
+
return this.collectAnimatedDiffKeysFromEffect(config, graphic, diffAttrs, keys);
|
|
21278
|
+
}
|
|
21279
|
+
collectAnimatedDiffKeysFromEffect(effect, graphic, diffAttrs, keys) {
|
|
21280
|
+
var _a;
|
|
21281
|
+
if ("update" === (null !== (_a = effect.type) && void 0 !== _a ? _a : "fromTo")) {
|
|
21282
|
+
const options = this.resolveValue(effect.options, graphic, void 0),
|
|
21283
|
+
excludeChannels = null == options ? void 0 : options.excludeChannels;
|
|
21284
|
+
for (const key in diffAttrs) Object.prototype.hasOwnProperty.call(diffAttrs, key) && void 0 !== diffAttrs[key] && !this.includesChannel(excludeChannels, key) && (null != keys || (keys = {}), keys[key] = !0);
|
|
21285
|
+
return keys;
|
|
21286
|
+
}
|
|
21287
|
+
return keys = this.collectExplicitAnimatedKeys(effect.to, diffAttrs, keys), keys = this.collectExplicitAnimatedKeys(effect.from, diffAttrs, keys), this.collectChannelAnimatedKeys(effect.channel, diffAttrs, keys);
|
|
21288
|
+
}
|
|
21289
|
+
collectExplicitAnimatedKeys(attrs, diffAttrs, keys) {
|
|
21290
|
+
if (!attrs) return keys;
|
|
21291
|
+
for (const key in attrs) Object.prototype.hasOwnProperty.call(attrs, key) && Object.prototype.hasOwnProperty.call(diffAttrs, key) && void 0 !== diffAttrs[key] && (null != keys || (keys = {}), keys[key] = !0);
|
|
21292
|
+
return keys;
|
|
21293
|
+
}
|
|
21294
|
+
collectChannelAnimatedKeys(channel, diffAttrs, keys) {
|
|
21295
|
+
if (!channel) return keys;
|
|
21296
|
+
if (Array.isArray(channel)) {
|
|
21297
|
+
for (let i = 0; i < channel.length; i++) {
|
|
21298
|
+
const key = channel[i];
|
|
21299
|
+
Object.prototype.hasOwnProperty.call(diffAttrs, key) && void 0 !== diffAttrs[key] && (null != keys || (keys = {}), keys[key] = !0);
|
|
21300
|
+
}
|
|
21301
|
+
return keys;
|
|
21302
|
+
}
|
|
21303
|
+
for (const key in channel) if (Object.prototype.hasOwnProperty.call(channel, key) && Object.prototype.hasOwnProperty.call(diffAttrs, key) && void 0 !== diffAttrs[key]) {
|
|
21304
|
+
const config = channel[key];
|
|
21305
|
+
void 0 === config.to && void 0 === config.from || (null != keys || (keys = {}), keys[key] = !0);
|
|
21306
|
+
}
|
|
21307
|
+
return keys;
|
|
21308
|
+
}
|
|
21309
|
+
includesChannel(channels, key) {
|
|
21310
|
+
if (!(null == channels ? void 0 : channels.length)) return !1;
|
|
21311
|
+
for (let i = 0; i < channels.length; i++) if (channels[i] === key) return !0;
|
|
21312
|
+
return !1;
|
|
21313
|
+
}
|
|
21314
|
+
syncFinalAttrsFromContext(graphic) {
|
|
21315
|
+
var _a;
|
|
21316
|
+
const finalAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.finalAttrs,
|
|
21317
|
+
setFinalAttributes = graphic.setFinalAttributes;
|
|
21318
|
+
finalAttrs && "function" == typeof setFinalAttributes && setFinalAttributes.call(graphic, finalAttrs);
|
|
21319
|
+
}
|
|
20364
21320
|
executeItem(params, graphic, index = 0, count = 1) {
|
|
20365
|
-
|
|
21321
|
+
if (Array.isArray(params)) {
|
|
21322
|
+
const prevConfigList = this._activeConfigList;
|
|
21323
|
+
this._activeConfigList = params;
|
|
21324
|
+
try {
|
|
21325
|
+
return params.map(param => this._executeItem(param, graphic, index, count)).filter(Boolean);
|
|
21326
|
+
} finally {
|
|
21327
|
+
this._activeConfigList = prevConfigList;
|
|
21328
|
+
}
|
|
21329
|
+
}
|
|
21330
|
+
return [this._executeItem(params, graphic, index, count)].filter(Boolean);
|
|
20366
21331
|
}
|
|
20367
21332
|
_executeItem(params, graphic, index = 0, count = 1) {
|
|
20368
21333
|
if (!graphic) return null;
|
|
@@ -20374,7 +21339,7 @@ class AnimateExecutor {
|
|
|
20374
21339
|
stop(type, callEnd = !0) {
|
|
20375
21340
|
for (; this._animates.length > 0;) {
|
|
20376
21341
|
const animate = this._animates.pop();
|
|
20377
|
-
!1 === callEnd && (animate.status = AnimateStatus.END), null == animate || animate.stop(type);
|
|
21342
|
+
!1 === callEnd && (animate.status = AnimateStatus.END, animate.__skipRestoreStaticAttributeOnRemove = !0), null == animate || animate.stop(type);
|
|
20378
21343
|
}
|
|
20379
21344
|
this._animates = [], this._activeCount = 0, this._started && (this._started = !1, callEnd && this.onEnd());
|
|
20380
21345
|
}
|
|
@@ -20425,8 +21390,22 @@ class AnimationStateManager {
|
|
|
20425
21390
|
hasTrackedAnimate() {
|
|
20426
21391
|
return this.trackedAnimates.size > 0;
|
|
20427
21392
|
}
|
|
21393
|
+
hasStateInfo(list, target) {
|
|
21394
|
+
for (let i = 0; i < list.length; i++) if (list[i] === target) return !0;
|
|
21395
|
+
return !1;
|
|
21396
|
+
}
|
|
21397
|
+
takeOverUpdateAttrs(nextState, currentStates, shouldStopState) {
|
|
21398
|
+
if (nextState.state !== AnimationStates.UPDATE || !currentStates.length) return;
|
|
21399
|
+
const nextKeys = nextState.executor.getActiveAttrKeys();
|
|
21400
|
+
if (nextKeys.length) for (let i = 0; i < currentStates.length; i++) {
|
|
21401
|
+
const currentState = currentStates[i];
|
|
21402
|
+
currentState.state !== AnimationStates.UPDATE || currentState === nextState || this.hasStateInfo(shouldStopState, currentState) || currentState.executor.preventAttrs(nextKeys) || (currentState.executor.stop(null, !1), shouldStopState.push(currentState));
|
|
21403
|
+
}
|
|
21404
|
+
}
|
|
20428
21405
|
applyState(nextState, animationConfig, callback) {
|
|
21406
|
+
var _a;
|
|
20429
21407
|
const registry = AnimationTransitionRegistry.getInstance(),
|
|
21408
|
+
currentStateList = null !== (_a = this.stateList) && void 0 !== _a ? _a : [],
|
|
20430
21409
|
shouldStopState = [],
|
|
20431
21410
|
shouldApplyState = [];
|
|
20432
21411
|
if (this.stateList && this.stateList.length ? nextState.forEach((state, index) => {
|
|
@@ -20434,14 +21413,14 @@ class AnimationStateManager {
|
|
|
20434
21413
|
allowTransition: !0,
|
|
20435
21414
|
stopOriginalTransition: !0
|
|
20436
21415
|
};
|
|
20437
|
-
|
|
21416
|
+
currentStateList.forEach(currState => {
|
|
20438
21417
|
const _result = registry.isTransitionAllowed(currState.state, state, this.graphic);
|
|
20439
21418
|
result.allowTransition = result.allowTransition && _result.allowTransition;
|
|
20440
21419
|
}), result.allowTransition && (shouldApplyState.push({
|
|
20441
21420
|
state: state,
|
|
20442
21421
|
animationConfig: isArray(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
|
|
20443
21422
|
executor: new AnimateExecutor(this.graphic)
|
|
20444
|
-
}),
|
|
21423
|
+
}), currentStateList.forEach(currState => {
|
|
20445
21424
|
registry.isTransitionAllowed(currState.state, state, this.graphic).stopOriginalTransition && shouldStopState.push(currState);
|
|
20446
21425
|
}));
|
|
20447
21426
|
}) : nextState.forEach((state, index) => {
|
|
@@ -20453,12 +21432,18 @@ class AnimationStateManager {
|
|
|
20453
21432
|
}), shouldStopState.forEach(state => {
|
|
20454
21433
|
state.executor.stop(null, !1);
|
|
20455
21434
|
}), shouldApplyState.length) {
|
|
20456
|
-
shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig);
|
|
21435
|
+
shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig), this.takeOverUpdateAttrs(shouldApplyState[0], currentStateList, shouldStopState);
|
|
20457
21436
|
for (let i = 0; i < shouldApplyState.length; i++) {
|
|
20458
21437
|
const nextState = shouldApplyState[i + 1],
|
|
20459
21438
|
currentState = shouldApplyState[i];
|
|
20460
21439
|
currentState.executor.onEnd(() => {
|
|
20461
|
-
|
|
21440
|
+
var _a;
|
|
21441
|
+
if (nextState) {
|
|
21442
|
+
nextState.executor.execute(nextState.animationConfig);
|
|
21443
|
+
const stoppedStates = [];
|
|
21444
|
+
this.takeOverUpdateAttrs(nextState, null !== (_a = this.stateList) && void 0 !== _a ? _a : [], stoppedStates), stoppedStates.length && this.stateList && (this.stateList = this.stateList.filter(state => !this.hasStateInfo(stoppedStates, state)));
|
|
21445
|
+
}
|
|
21446
|
+
this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
|
|
20462
21447
|
});
|
|
20463
21448
|
}
|
|
20464
21449
|
} else callback && callback(!0);
|
|
@@ -20636,9 +21621,7 @@ class AnimateExtension {
|
|
|
20636
21621
|
return this.initAnimateExecutor(), this._animateExecutor.execute(config), this;
|
|
20637
21622
|
}
|
|
20638
21623
|
executeAnimations(configs) {
|
|
20639
|
-
return this.initAnimateExecutor(),
|
|
20640
|
-
this._animateExecutor.execute(config);
|
|
20641
|
-
}), this;
|
|
21624
|
+
return this.initAnimateExecutor(), this._animateExecutor.execute(configs), this;
|
|
20642
21625
|
}
|
|
20643
21626
|
getFinalAttribute() {
|
|
20644
21627
|
return this.finalAttribute;
|
|
@@ -20701,8 +21684,11 @@ class ComponentAnimator {
|
|
|
20701
21684
|
}), this));
|
|
20702
21685
|
}
|
|
20703
21686
|
deleteSelfAttr(key) {
|
|
21687
|
+
this.deleteSelfAttrs([key]);
|
|
21688
|
+
}
|
|
21689
|
+
deleteSelfAttrs(keys) {
|
|
20704
21690
|
this.tasks.forEach(task => {
|
|
20705
|
-
task.animate && task.animate.forEach(animate => animate.
|
|
21691
|
+
task.animate && task.animate.forEach(animate => animate.preventAttrs(keys));
|
|
20706
21692
|
});
|
|
20707
21693
|
}
|
|
20708
21694
|
stop(type) {
|
|
@@ -20807,7 +21793,9 @@ class IncreaseCount extends ACustomAnimate {
|
|
|
20807
21793
|
const parts = formattedNumber.toString().split(".");
|
|
20808
21794
|
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","), formattedWithBasicFormat = parts.join(".");
|
|
20809
21795
|
} else formattedWithBasicFormat = formattedNumber;
|
|
20810
|
-
formattedText = this.formatTemplate ? this.formatTemplate.replace("{{var}}", formattedWithBasicFormat.toString()) : formattedWithBasicFormat, this.target
|
|
21796
|
+
formattedText = this.formatTemplate ? this.formatTemplate.replace("{{var}}", formattedWithBasicFormat.toString()) : formattedWithBasicFormat, applyAnimationTransientAttributes(this.target, {
|
|
21797
|
+
text: formattedText
|
|
21798
|
+
});
|
|
20811
21799
|
}
|
|
20812
21800
|
}
|
|
20813
21801
|
|
|
@@ -20827,7 +21815,7 @@ class AxisEnter extends AComponentAnimate {
|
|
|
20827
21815
|
const point = getTickCoord(oldValue);
|
|
20828
21816
|
const newX = this.target.attribute.x;
|
|
20829
21817
|
const newY = this.target.attribute.y;
|
|
20830
|
-
this.target
|
|
21818
|
+
commitUpdateAnimationTarget(this.target, { x: newX, y: newY }, { x: point.x, y: point.y });
|
|
20831
21819
|
animator.animate(this.target, {
|
|
20832
21820
|
type: 'to',
|
|
20833
21821
|
to: { x: newX, y: newY },
|
|
@@ -20850,7 +21838,8 @@ class AxisUpdate extends AComponentAnimate {
|
|
|
20850
21838
|
this._animator = animator;
|
|
20851
21839
|
const duration = this.duration;
|
|
20852
21840
|
const easing = this.easing;
|
|
20853
|
-
const {
|
|
21841
|
+
const { diffAttrs } = this.params;
|
|
21842
|
+
commitUpdateAnimationTarget(this.target, Object.assign({}, diffAttrs));
|
|
20854
21843
|
animator.animate(this.target, {
|
|
20855
21844
|
type: 'to',
|
|
20856
21845
|
to: Object.assign({}, diffAttrs),
|
|
@@ -20863,8 +21852,11 @@ class AxisUpdate extends AComponentAnimate {
|
|
|
20863
21852
|
this.completeBind(animator);
|
|
20864
21853
|
}
|
|
20865
21854
|
deleteSelfAttr(key) {
|
|
20866
|
-
|
|
20867
|
-
|
|
21855
|
+
this.deleteSelfAttrs([key]);
|
|
21856
|
+
}
|
|
21857
|
+
deleteSelfAttrs(keys) {
|
|
21858
|
+
super.deleteSelfAttrs(keys);
|
|
21859
|
+
this._animator.deleteSelfAttrs(keys);
|
|
20868
21860
|
}
|
|
20869
21861
|
tryPreventConflict() {
|
|
20870
21862
|
return;
|
|
@@ -21559,8 +22551,8 @@ class LineAxis extends AxisBase {
|
|
|
21559
22551
|
}
|
|
21560
22552
|
return offset;
|
|
21561
22553
|
}
|
|
21562
|
-
release() {
|
|
21563
|
-
super.release();
|
|
22554
|
+
release(all) {
|
|
22555
|
+
super.release(all);
|
|
21564
22556
|
this._breaks = null;
|
|
21565
22557
|
}
|
|
21566
22558
|
}
|
|
@@ -21897,6 +22889,7 @@ class GroupTransition extends ACustomAnimate {
|
|
|
21897
22889
|
this.mode = AnimateMode.NORMAL;
|
|
21898
22890
|
}
|
|
21899
22891
|
onBind() {
|
|
22892
|
+
this._started = false;
|
|
21900
22893
|
const currentInnerView = this.target.getInnerView();
|
|
21901
22894
|
const prevInnerView = this.target.getPrevInnerView();
|
|
21902
22895
|
if (!prevInnerView) {
|
|
@@ -21915,7 +22908,7 @@ class GroupTransition extends ACustomAnimate {
|
|
|
21915
22908
|
node: el,
|
|
21916
22909
|
attrs: Object.assign(Object.assign({}, newProps), { opacity: (_a = newProps.opacity) !== null && _a !== void 0 ? _a : 1, fillOpacity: (_b = newProps.fillOpacity) !== null && _b !== void 0 ? _b : 1, strokeOpacity: (_c = newProps.strokeOpacity) !== null && _c !== void 0 ? _c : 1 })
|
|
21917
22910
|
};
|
|
21918
|
-
el.
|
|
22911
|
+
commitUpdateAnimationTarget(el, this._newElementAttrMap[el.id].attrs, cloneDeep(oldEl.attribute));
|
|
21919
22912
|
}
|
|
21920
22913
|
}
|
|
21921
22914
|
else {
|
|
@@ -21929,7 +22922,7 @@ class GroupTransition extends ACustomAnimate {
|
|
|
21929
22922
|
node: el,
|
|
21930
22923
|
attrs: finalOpacityAttrs
|
|
21931
22924
|
};
|
|
21932
|
-
el
|
|
22925
|
+
commitUpdateAnimationTarget(el, finalOpacityAttrs, {
|
|
21933
22926
|
opacity: 0,
|
|
21934
22927
|
fillOpacity: 0,
|
|
21935
22928
|
strokeOpacity: 0
|
|
@@ -21939,6 +22932,10 @@ class GroupTransition extends ACustomAnimate {
|
|
|
21939
22932
|
});
|
|
21940
22933
|
}
|
|
21941
22934
|
onStart() {
|
|
22935
|
+
if (this._started) {
|
|
22936
|
+
return;
|
|
22937
|
+
}
|
|
22938
|
+
this._started = true;
|
|
21942
22939
|
let duration = this.duration;
|
|
21943
22940
|
let easing = this.easing;
|
|
21944
22941
|
this._newElementAttrMap &&
|
|
@@ -23434,6 +24431,17 @@ function shiftY(texts, option) {
|
|
|
23434
24431
|
}
|
|
23435
24432
|
|
|
23436
24433
|
loadLabelComponent();
|
|
24434
|
+
function cloneAttributeSnapshot(value) {
|
|
24435
|
+
if (!isObject(value) || isArray(value)) {
|
|
24436
|
+
return value;
|
|
24437
|
+
}
|
|
24438
|
+
const snapshot = {};
|
|
24439
|
+
Object.keys(value).forEach(key => {
|
|
24440
|
+
const nextValue = value[key];
|
|
24441
|
+
snapshot[key] = isObject(nextValue) && !isArray(nextValue) ? cloneAttributeSnapshot(nextValue) : nextValue;
|
|
24442
|
+
});
|
|
24443
|
+
return snapshot;
|
|
24444
|
+
}
|
|
23437
24445
|
class LabelBase extends AnimateComponent {
|
|
23438
24446
|
setBitmap(bitmap) {
|
|
23439
24447
|
this._bitmap = bitmap;
|
|
@@ -23522,8 +24530,9 @@ class LabelBase extends AnimateComponent {
|
|
|
23522
24530
|
}, attrs, new CustomPath2D());
|
|
23523
24531
|
};
|
|
23524
24532
|
}
|
|
23525
|
-
|
|
23526
|
-
|
|
24533
|
+
const baseMarkAttrs = baseMark && this.getGraphicFinalLayoutAttributes(baseMark);
|
|
24534
|
+
if (baseMarkAttrs === null || baseMarkAttrs === void 0 ? void 0 : baseMarkAttrs.fill) {
|
|
24535
|
+
lineGraphic.setAttribute('stroke', baseMarkAttrs.fill);
|
|
23527
24536
|
}
|
|
23528
24537
|
if (this.attribute.line && !isEmpty(this.attribute.line.style)) {
|
|
23529
24538
|
lineGraphic.setAttributes(this.attribute.line.style);
|
|
@@ -23532,7 +24541,92 @@ class LabelBase extends AnimateComponent {
|
|
|
23532
24541
|
return lineGraphic;
|
|
23533
24542
|
}
|
|
23534
24543
|
}
|
|
24544
|
+
_finalizeExitRelease() {
|
|
24545
|
+
var _a, _b, _c, _d;
|
|
24546
|
+
const state = this._exitReleaseState;
|
|
24547
|
+
if (state === null || state === void 0 ? void 0 : state.finalized) {
|
|
24548
|
+
return;
|
|
24549
|
+
}
|
|
24550
|
+
if (state) {
|
|
24551
|
+
state.finalized = true;
|
|
24552
|
+
}
|
|
24553
|
+
const parent = this.parent;
|
|
24554
|
+
const removeFromParent = !!(state === null || state === void 0 ? void 0 : state.removeFromParent);
|
|
24555
|
+
const callbacks = (_a = state === null || state === void 0 ? void 0 : state.onComplete) !== null && _a !== void 0 ? _a : [];
|
|
24556
|
+
this._exitReleaseState = undefined;
|
|
24557
|
+
this._graphicToText = new Map();
|
|
24558
|
+
(_b = this._idToGraphic) === null || _b === void 0 ? void 0 : _b.clear();
|
|
24559
|
+
(_c = this._idToPoint) === null || _c === void 0 ? void 0 : _c.clear();
|
|
24560
|
+
this._baseMarks = undefined;
|
|
24561
|
+
this.removeAllChild(true);
|
|
24562
|
+
super.release(true);
|
|
24563
|
+
if (removeFromParent) {
|
|
24564
|
+
(_d = (parent !== null && parent !== void 0 ? parent : this.parent)) === null || _d === void 0 ? void 0 : _d.removeChild(this);
|
|
24565
|
+
}
|
|
24566
|
+
runExitReleaseCallbacks(callbacks);
|
|
24567
|
+
}
|
|
24568
|
+
_runExitAnimationBeforeRelease(options = {}) {
|
|
24569
|
+
var _a, _b;
|
|
24570
|
+
if (this._exitReleaseState && !this._exitReleaseState.finalized) {
|
|
24571
|
+
this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent;
|
|
24572
|
+
appendExitReleaseCallback(this._exitReleaseState, options.onComplete);
|
|
24573
|
+
return true;
|
|
24574
|
+
}
|
|
24575
|
+
if (!this.stage ||
|
|
24576
|
+
this.attribute.animation === false ||
|
|
24577
|
+
this.attribute.animationExit === false ||
|
|
24578
|
+
!((_a = this._graphicToText) === null || _a === void 0 ? void 0 : _a.size)) {
|
|
24579
|
+
return false;
|
|
24580
|
+
}
|
|
24581
|
+
this._prepareAnimate(DefaultLabelAnimation);
|
|
24582
|
+
if (!((_b = this._animationConfig) === null || _b === void 0 ? void 0 : _b.exit)) {
|
|
24583
|
+
return false;
|
|
24584
|
+
}
|
|
24585
|
+
const exitTargets = new Set();
|
|
24586
|
+
this._graphicToText.forEach(label => {
|
|
24587
|
+
(label === null || label === void 0 ? void 0 : label.text) && exitTargets.add(label.text);
|
|
24588
|
+
(label === null || label === void 0 ? void 0 : label.labelLine) && exitTargets.add(label.labelLine);
|
|
24589
|
+
});
|
|
24590
|
+
if (!exitTargets.size) {
|
|
24591
|
+
return false;
|
|
24592
|
+
}
|
|
24593
|
+
const existingAnimates = collectTrackedAnimates(this);
|
|
24594
|
+
exitTargets.forEach(target => {
|
|
24595
|
+
var _a;
|
|
24596
|
+
target.applyAnimationState(['exit'], [
|
|
24597
|
+
{
|
|
24598
|
+
name: 'exit',
|
|
24599
|
+
animation: Object.assign(Object.assign({}, this._animationConfig.exit), { type: (_a = this._animationConfig.exit.type) !== null && _a !== void 0 ? _a : 'fadeOut', selfOnly: true })
|
|
24600
|
+
}
|
|
24601
|
+
]);
|
|
24602
|
+
});
|
|
24603
|
+
const animates = collectTrackedAnimates(this);
|
|
24604
|
+
const exitAnimates = animates.filter(animate => !existingAnimates.includes(animate));
|
|
24605
|
+
if (!exitAnimates.length) {
|
|
24606
|
+
return false;
|
|
24607
|
+
}
|
|
24608
|
+
this.setAttribute('childrenPickable', false);
|
|
24609
|
+
this.releaseStatus = 'willRelease';
|
|
24610
|
+
const pendingAnimates = new Set(exitAnimates);
|
|
24611
|
+
this._exitReleaseState = {
|
|
24612
|
+
pendingAnimates,
|
|
24613
|
+
finalized: false,
|
|
24614
|
+
removeFromParent: !!options.removeFromParent,
|
|
24615
|
+
onComplete: options.onComplete ? [options.onComplete] : []
|
|
24616
|
+
};
|
|
24617
|
+
bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease());
|
|
24618
|
+
return true;
|
|
24619
|
+
}
|
|
24620
|
+
releaseWithExitAnimation(options = {}) {
|
|
24621
|
+
if (this.releaseStatus === 'released') {
|
|
24622
|
+
return false;
|
|
24623
|
+
}
|
|
24624
|
+
return this._runExitAnimationBeforeRelease(options);
|
|
24625
|
+
}
|
|
23535
24626
|
render() {
|
|
24627
|
+
if (this._exitReleaseState) {
|
|
24628
|
+
return;
|
|
24629
|
+
}
|
|
23536
24630
|
this._prepare();
|
|
23537
24631
|
if (isNil(this._idToGraphic) || (this._isCollectionBase && isNil(this._idToPoint))) {
|
|
23538
24632
|
return;
|
|
@@ -23540,8 +24634,8 @@ class LabelBase extends AnimateComponent {
|
|
|
23540
24634
|
const markAttributeList = [];
|
|
23541
24635
|
if (this._enableAnimation !== false) {
|
|
23542
24636
|
this._baseMarks.forEach(mark => {
|
|
23543
|
-
markAttributeList.push(mark.attribute);
|
|
23544
|
-
mark.initAttributes(
|
|
24637
|
+
markAttributeList.push(cloneAttributeSnapshot(mark.attribute));
|
|
24638
|
+
mark.initAttributes(this.getGraphicFinalLayoutAttributes(mark));
|
|
23545
24639
|
});
|
|
23546
24640
|
}
|
|
23547
24641
|
const { overlap, smartInvert, dataFilter, customLayoutFunc, customOverlapFunc } = this.attribute;
|
|
@@ -23710,6 +24804,14 @@ class LabelBase extends AnimateComponent {
|
|
|
23710
24804
|
getRelatedGraphic(item) {
|
|
23711
24805
|
return this._idToGraphic.get(item.id);
|
|
23712
24806
|
}
|
|
24807
|
+
getGraphicFinalLayoutAttributes(graphic) {
|
|
24808
|
+
var _a, _b;
|
|
24809
|
+
return ((_b = (_a = graphic.context) === null || _a === void 0 ? void 0 : _a.finalAttrs) !== null && _b !== void 0 ? _b : graphic.getAttributes(true));
|
|
24810
|
+
}
|
|
24811
|
+
hasGraphicContextFinalLayoutAttributes(graphic) {
|
|
24812
|
+
var _a;
|
|
24813
|
+
return !!((_a = graphic === null || graphic === void 0 ? void 0 : graphic.context) === null || _a === void 0 ? void 0 : _a.finalAttrs);
|
|
24814
|
+
}
|
|
23713
24815
|
_initText(data = []) {
|
|
23714
24816
|
const { textStyle = {} } = this.attribute;
|
|
23715
24817
|
const labels = [];
|
|
@@ -23719,7 +24821,7 @@ class LabelBase extends AnimateComponent {
|
|
|
23719
24821
|
if (!baseMark) {
|
|
23720
24822
|
continue;
|
|
23721
24823
|
}
|
|
23722
|
-
const graphicAttribute =
|
|
24824
|
+
const graphicAttribute = this.getGraphicFinalLayoutAttributes(baseMark);
|
|
23723
24825
|
const labelAttribute = Object.assign(Object.assign({ fill: this._isCollectionBase
|
|
23724
24826
|
? isArray(graphicAttribute.stroke)
|
|
23725
24827
|
? graphicAttribute.stroke.find(entry => !!entry && entry !== true)
|
|
@@ -23971,9 +25073,9 @@ class LabelBase extends AnimateComponent {
|
|
|
23971
25073
|
var _a;
|
|
23972
25074
|
if (graphic) {
|
|
23973
25075
|
if (graphic.attribute.visible !== false) {
|
|
23974
|
-
if ((_a = graphic.context) === null || _a === void 0 ? void 0 : _a.animationState) {
|
|
25076
|
+
if (((_a = graphic.context) === null || _a === void 0 ? void 0 : _a.animationState) || this.hasGraphicContextFinalLayoutAttributes(graphic)) {
|
|
23975
25077
|
const clonedGraphic = graphic.clone();
|
|
23976
|
-
Object.assign(clonedGraphic.attribute,
|
|
25078
|
+
Object.assign(clonedGraphic.attribute, this.getGraphicFinalLayoutAttributes(graphic));
|
|
23977
25079
|
return clonedGraphic.AABBBounds;
|
|
23978
25080
|
}
|
|
23979
25081
|
return graphic.AABBBounds;
|
|
@@ -24054,6 +25156,8 @@ class LabelBase extends AnimateComponent {
|
|
|
24054
25156
|
_runUpdateAnimation(prevLabel, currentLabel) {
|
|
24055
25157
|
const { text: prevText, labelLine: prevLabelLine } = prevLabel;
|
|
24056
25158
|
const { text: curText, labelLine: curLabelLine } = currentLabel;
|
|
25159
|
+
commitUpdateAnimationTarget(prevText, curText === null || curText === void 0 ? void 0 : curText.attribute);
|
|
25160
|
+
commitUpdateAnimationTarget(prevLabelLine, curLabelLine === null || curLabelLine === void 0 ? void 0 : curLabelLine.attribute);
|
|
24057
25161
|
prevText.applyAnimationState(['update'], [
|
|
24058
25162
|
{
|
|
24059
25163
|
name: 'update',
|
|
@@ -24085,7 +25189,7 @@ class LabelBase extends AnimateComponent {
|
|
|
24085
25189
|
this.runEnterAnimation(text, labelLine);
|
|
24086
25190
|
}
|
|
24087
25191
|
_updateLabel(prevLabel, currentLabel) {
|
|
24088
|
-
const {
|
|
25192
|
+
const { labelLine: prevLabelLine } = prevLabel;
|
|
24089
25193
|
const { text: curText, labelLine: curLabelLine } = currentLabel;
|
|
24090
25194
|
if (this._enableAnimation === false || this._animationConfig.update === false) {
|
|
24091
25195
|
prevLabel.text.setAttributes(curText.attribute);
|
|
@@ -24160,8 +25264,9 @@ class LabelBase extends AnimateComponent {
|
|
|
24160
25264
|
continue;
|
|
24161
25265
|
}
|
|
24162
25266
|
const baseMark = this.getRelatedGraphic(label.attribute);
|
|
24163
|
-
|
|
24164
|
-
|
|
25267
|
+
const baseMarkAttrs = this.getGraphicFinalLayoutAttributes(baseMark);
|
|
25268
|
+
let backgroundColor = baseMarkAttrs.fill;
|
|
25269
|
+
const backgroundOpacity = baseMarkAttrs.fillOpacity;
|
|
24165
25270
|
let foregroundColor = label.attribute.fill;
|
|
24166
25271
|
if (isObject(backgroundColor) && backgroundColor.gradient) {
|
|
24167
25272
|
const firstStopColor = (_g = (_f = backgroundColor.stops) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.color;
|
|
@@ -24220,6 +25325,21 @@ class LabelBase extends AnimateComponent {
|
|
|
24220
25325
|
}
|
|
24221
25326
|
return shapeBound.encloses(textBound);
|
|
24222
25327
|
}
|
|
25328
|
+
release(all) {
|
|
25329
|
+
var _a, _b;
|
|
25330
|
+
if (this._exitReleaseState) {
|
|
25331
|
+
this._finalizeExitRelease();
|
|
25332
|
+
return;
|
|
25333
|
+
}
|
|
25334
|
+
if (all) {
|
|
25335
|
+
this.removeAllChild(true);
|
|
25336
|
+
}
|
|
25337
|
+
super.release(all);
|
|
25338
|
+
this._graphicToText = new Map();
|
|
25339
|
+
(_a = this._idToGraphic) === null || _a === void 0 ? void 0 : _a.clear();
|
|
25340
|
+
(_b = this._idToPoint) === null || _b === void 0 ? void 0 : _b.clear();
|
|
25341
|
+
this._baseMarks = undefined;
|
|
25342
|
+
}
|
|
24223
25343
|
setLocation(point) {
|
|
24224
25344
|
this.translateTo(point.x, point.y);
|
|
24225
25345
|
}
|
|
@@ -24487,15 +25607,16 @@ class ArcLabel extends LabelBase {
|
|
|
24487
25607
|
this._arcRight.clear();
|
|
24488
25608
|
this._ellipsisWidth = ellipsisWidth;
|
|
24489
25609
|
let maxRadius = 0;
|
|
24490
|
-
currentMarks.forEach(
|
|
24491
|
-
|
|
24492
|
-
|
|
25610
|
+
currentMarks.forEach(currentMark => {
|
|
25611
|
+
const graphicAttribute = this.getGraphicFinalLayoutAttributes(currentMark);
|
|
25612
|
+
if (graphicAttribute.outerRadius > maxRadius) {
|
|
25613
|
+
maxRadius = graphicAttribute.outerRadius;
|
|
24493
25614
|
}
|
|
24494
25615
|
});
|
|
24495
25616
|
data.forEach((d, index) => {
|
|
24496
25617
|
var _a, _b;
|
|
24497
25618
|
const currentMark = this._idToGraphic.get(d.id);
|
|
24498
|
-
const graphicAttribute =
|
|
25619
|
+
const graphicAttribute = this.getGraphicFinalLayoutAttributes(currentMark);
|
|
24499
25620
|
const center = { x: (_a = graphicAttribute === null || graphicAttribute === void 0 ? void 0 : graphicAttribute.x) !== null && _a !== void 0 ? _a : 0, y: (_b = graphicAttribute === null || graphicAttribute === void 0 ? void 0 : graphicAttribute.y) !== null && _b !== void 0 ? _b : 0 };
|
|
24500
25621
|
if (!isNil(data[index]) && !isNil(textBoundsArray[index])) {
|
|
24501
25622
|
const item = data[index] ? data[index] : null;
|
|
@@ -24680,8 +25801,9 @@ class ArcLabel extends LabelBase {
|
|
|
24680
25801
|
};
|
|
24681
25802
|
let maxRadius = 0;
|
|
24682
25803
|
currentMarks.forEach((currentMark) => {
|
|
24683
|
-
|
|
24684
|
-
|
|
25804
|
+
const graphicAttribute = this.getGraphicFinalLayoutAttributes(currentMark);
|
|
25805
|
+
if (graphicAttribute.outerRadius > maxRadius) {
|
|
25806
|
+
maxRadius = graphicAttribute.outerRadius;
|
|
24685
25807
|
}
|
|
24686
25808
|
});
|
|
24687
25809
|
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
|
|
@@ -24914,8 +26036,9 @@ class ArcLabel extends LabelBase {
|
|
|
24914
26036
|
const labelConfig = attribute;
|
|
24915
26037
|
let maxRadius = 0;
|
|
24916
26038
|
currentMarks.forEach((currentMark) => {
|
|
24917
|
-
|
|
24918
|
-
|
|
26039
|
+
const graphicAttribute = this.getGraphicFinalLayoutAttributes(currentMark);
|
|
26040
|
+
if (graphicAttribute.outerRadius > maxRadius) {
|
|
26041
|
+
maxRadius = graphicAttribute.outerRadius;
|
|
24919
26042
|
}
|
|
24920
26043
|
});
|
|
24921
26044
|
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
|
|
@@ -24957,8 +26080,9 @@ class ArcLabel extends LabelBase {
|
|
|
24957
26080
|
const plotRect = { width: center.x * 2, height: center.y * 2 };
|
|
24958
26081
|
let maxRadius = 0;
|
|
24959
26082
|
currentMarks.forEach((currentMark) => {
|
|
24960
|
-
|
|
24961
|
-
|
|
26083
|
+
const graphicAttribute = this.getGraphicFinalLayoutAttributes(currentMark);
|
|
26084
|
+
if (graphicAttribute.outerRadius > maxRadius) {
|
|
26085
|
+
maxRadius = graphicAttribute.outerRadius;
|
|
24962
26086
|
}
|
|
24963
26087
|
});
|
|
24964
26088
|
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
|
|
@@ -25029,8 +26153,9 @@ class ArcLabel extends LabelBase {
|
|
|
25029
26153
|
const line1MinLength = labelConfig.line.line1MinLength;
|
|
25030
26154
|
let maxRadius = 0;
|
|
25031
26155
|
currentMarks.forEach((currentMark) => {
|
|
25032
|
-
|
|
25033
|
-
|
|
26156
|
+
const graphicAttribute = this.getGraphicFinalLayoutAttributes(currentMark);
|
|
26157
|
+
if (graphicAttribute.outerRadius > maxRadius) {
|
|
26158
|
+
maxRadius = graphicAttribute.outerRadius;
|
|
25034
26159
|
}
|
|
25035
26160
|
});
|
|
25036
26161
|
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
|
|
@@ -25118,7 +26243,7 @@ class ArcLabel extends LabelBase {
|
|
|
25118
26243
|
});
|
|
25119
26244
|
}
|
|
25120
26245
|
if (baseMark.type === 'arc3d' && baseMark) {
|
|
25121
|
-
const { beta, x, y } =
|
|
26246
|
+
const { beta, x, y } = this.getGraphicFinalLayoutAttributes(baseMark);
|
|
25122
26247
|
lineGraphic.setAttributes({
|
|
25123
26248
|
beta,
|
|
25124
26249
|
anchor3d: [x, y]
|
|
@@ -25180,6 +26305,9 @@ class DataLabel extends AbstractComponent {
|
|
|
25180
26305
|
}
|
|
25181
26306
|
render() {
|
|
25182
26307
|
var _a;
|
|
26308
|
+
if (this._exitReleaseState) {
|
|
26309
|
+
return;
|
|
26310
|
+
}
|
|
25183
26311
|
const { dataLabels, size } = this.attribute;
|
|
25184
26312
|
if (!dataLabels || dataLabels.length === 0) {
|
|
25185
26313
|
return;
|
|
@@ -25228,6 +26356,101 @@ class DataLabel extends AbstractComponent {
|
|
|
25228
26356
|
});
|
|
25229
26357
|
this._componentMap = currentComponentMap;
|
|
25230
26358
|
}
|
|
26359
|
+
_finalizeExitRelease() {
|
|
26360
|
+
var _a, _b, _c;
|
|
26361
|
+
const state = this._exitReleaseState;
|
|
26362
|
+
if (state === null || state === void 0 ? void 0 : state.finalized) {
|
|
26363
|
+
return;
|
|
26364
|
+
}
|
|
26365
|
+
if (state) {
|
|
26366
|
+
state.finalized = true;
|
|
26367
|
+
}
|
|
26368
|
+
const parent = this.parent;
|
|
26369
|
+
const removeFromParent = !!(state === null || state === void 0 ? void 0 : state.removeFromParent);
|
|
26370
|
+
const callbacks = (_a = state === null || state === void 0 ? void 0 : state.onComplete) !== null && _a !== void 0 ? _a : [];
|
|
26371
|
+
this._exitReleaseState = undefined;
|
|
26372
|
+
(_b = this._componentMap) === null || _b === void 0 ? void 0 : _b.clear();
|
|
26373
|
+
this.removeAllChild(true);
|
|
26374
|
+
super.release(true);
|
|
26375
|
+
if (removeFromParent) {
|
|
26376
|
+
(_c = (parent !== null && parent !== void 0 ? parent : this.parent)) === null || _c === void 0 ? void 0 : _c.removeChild(this);
|
|
26377
|
+
}
|
|
26378
|
+
runExitReleaseCallbacks(callbacks);
|
|
26379
|
+
}
|
|
26380
|
+
releaseWithExitAnimation(options = {}) {
|
|
26381
|
+
var _a;
|
|
26382
|
+
if (this.releaseStatus === 'released') {
|
|
26383
|
+
return false;
|
|
26384
|
+
}
|
|
26385
|
+
if (this._exitReleaseState && !this._exitReleaseState.finalized) {
|
|
26386
|
+
this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent;
|
|
26387
|
+
appendExitReleaseCallback(this._exitReleaseState, options.onComplete);
|
|
26388
|
+
return true;
|
|
26389
|
+
}
|
|
26390
|
+
if (!this.stage || !((_a = this._componentMap) === null || _a === void 0 ? void 0 : _a.size)) {
|
|
26391
|
+
return false;
|
|
26392
|
+
}
|
|
26393
|
+
const state = {
|
|
26394
|
+
pendingCount: 0,
|
|
26395
|
+
finalized: false,
|
|
26396
|
+
removeFromParent: !!options.removeFromParent,
|
|
26397
|
+
onComplete: options.onComplete ? [options.onComplete] : []
|
|
26398
|
+
};
|
|
26399
|
+
const exitingComponents = [];
|
|
26400
|
+
const fallbackComponents = [];
|
|
26401
|
+
let initializing = true;
|
|
26402
|
+
const finish = () => {
|
|
26403
|
+
if (state.finalized) {
|
|
26404
|
+
return;
|
|
26405
|
+
}
|
|
26406
|
+
state.pendingCount -= 1;
|
|
26407
|
+
if (state.pendingCount <= 0 && !initializing) {
|
|
26408
|
+
this._finalizeExitRelease();
|
|
26409
|
+
}
|
|
26410
|
+
};
|
|
26411
|
+
this._exitReleaseState = state;
|
|
26412
|
+
this._componentMap.forEach(component => {
|
|
26413
|
+
state.pendingCount += 1;
|
|
26414
|
+
const releasedWithExit = component.releaseWithExitAnimation({
|
|
26415
|
+
removeFromParent: false,
|
|
26416
|
+
onComplete: finish
|
|
26417
|
+
});
|
|
26418
|
+
if (releasedWithExit) {
|
|
26419
|
+
exitingComponents.push(component);
|
|
26420
|
+
}
|
|
26421
|
+
else {
|
|
26422
|
+
state.pendingCount -= 1;
|
|
26423
|
+
fallbackComponents.push(component);
|
|
26424
|
+
}
|
|
26425
|
+
});
|
|
26426
|
+
if (!exitingComponents.length) {
|
|
26427
|
+
this._exitReleaseState = undefined;
|
|
26428
|
+
return false;
|
|
26429
|
+
}
|
|
26430
|
+
fallbackComponents.forEach(component => {
|
|
26431
|
+
component.release(true);
|
|
26432
|
+
this.removeChild(component);
|
|
26433
|
+
});
|
|
26434
|
+
this.setAttribute('childrenPickable', false);
|
|
26435
|
+
this.releaseStatus = 'willRelease';
|
|
26436
|
+
initializing = false;
|
|
26437
|
+
if (state.pendingCount <= 0) {
|
|
26438
|
+
this._finalizeExitRelease();
|
|
26439
|
+
}
|
|
26440
|
+
return true;
|
|
26441
|
+
}
|
|
26442
|
+
release(all) {
|
|
26443
|
+
var _a;
|
|
26444
|
+
if (this._exitReleaseState) {
|
|
26445
|
+
this._finalizeExitRelease();
|
|
26446
|
+
return;
|
|
26447
|
+
}
|
|
26448
|
+
if (all) {
|
|
26449
|
+
this.removeAllChild(true);
|
|
26450
|
+
}
|
|
26451
|
+
super.release(all);
|
|
26452
|
+
(_a = this._componentMap) === null || _a === void 0 ? void 0 : _a.clear();
|
|
26453
|
+
}
|
|
25231
26454
|
setLocation(point) {
|
|
25232
26455
|
this.translateTo(point.x, point.y);
|
|
25233
26456
|
}
|
|
@@ -26937,15 +28160,95 @@ class Marker extends AbstractComponent {
|
|
|
26937
28160
|
y: clipInRange ? -((_b = limitRect.y) !== null && _b !== void 0 ? _b : 0) : 0
|
|
26938
28161
|
});
|
|
26939
28162
|
}
|
|
26940
|
-
|
|
28163
|
+
_finalizeExitRelease() {
|
|
28164
|
+
var _a, _b;
|
|
28165
|
+
const state = this._exitReleaseState;
|
|
28166
|
+
if (state === null || state === void 0 ? void 0 : state.finalized) {
|
|
28167
|
+
return;
|
|
28168
|
+
}
|
|
28169
|
+
if (state) {
|
|
28170
|
+
state.finalized = true;
|
|
28171
|
+
}
|
|
28172
|
+
const parent = this.parent;
|
|
28173
|
+
const removeFromParent = !!(state === null || state === void 0 ? void 0 : state.removeFromParent);
|
|
28174
|
+
const releaseSelf = !!(state === null || state === void 0 ? void 0 : state.releaseSelf);
|
|
28175
|
+
const callbacks = (_a = state === null || state === void 0 ? void 0 : state.onComplete) !== null && _a !== void 0 ? _a : [];
|
|
28176
|
+
this._exitReleaseState = undefined;
|
|
28177
|
+
this._releaseEvent();
|
|
28178
|
+
this._container = null;
|
|
28179
|
+
this._containerClip = null;
|
|
28180
|
+
this.removeAllChild(true);
|
|
28181
|
+
if (releaseSelf) {
|
|
28182
|
+
super.release(true);
|
|
28183
|
+
if (removeFromParent) {
|
|
28184
|
+
(_b = (parent !== null && parent !== void 0 ? parent : this.parent)) === null || _b === void 0 ? void 0 : _b.removeChild(this);
|
|
28185
|
+
}
|
|
28186
|
+
}
|
|
28187
|
+
runExitReleaseCallbacks(callbacks);
|
|
28188
|
+
}
|
|
28189
|
+
_runExitAnimationBeforeCleanup(options = {}) {
|
|
26941
28190
|
var _a;
|
|
28191
|
+
const releaseSelf = !!options.releaseSelf;
|
|
28192
|
+
if (this._exitReleaseState && !this._exitReleaseState.finalized) {
|
|
28193
|
+
this._exitReleaseState.releaseSelf = this._exitReleaseState.releaseSelf || releaseSelf;
|
|
28194
|
+
this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent;
|
|
28195
|
+
appendExitReleaseCallback(this._exitReleaseState, options.onComplete);
|
|
28196
|
+
return true;
|
|
28197
|
+
}
|
|
28198
|
+
if (!this.stage ||
|
|
28199
|
+
this.attribute.animation === false ||
|
|
28200
|
+
this.attribute.animationExit === false ||
|
|
28201
|
+
!this._container) {
|
|
28202
|
+
return false;
|
|
28203
|
+
}
|
|
28204
|
+
this.transAnimationConfig();
|
|
28205
|
+
if (!((_a = this._animationConfig) === null || _a === void 0 ? void 0 : _a.exit)) {
|
|
28206
|
+
return false;
|
|
28207
|
+
}
|
|
28208
|
+
const existingAnimates = collectTrackedAnimates(this);
|
|
28209
|
+
this.markerAnimate('exit');
|
|
28210
|
+
const animates = collectTrackedAnimates(this);
|
|
28211
|
+
const exitAnimates = animates.filter(animate => !existingAnimates.includes(animate));
|
|
28212
|
+
if (!exitAnimates.length) {
|
|
28213
|
+
return false;
|
|
28214
|
+
}
|
|
28215
|
+
this._releaseEvent();
|
|
28216
|
+
this.setAttribute('childrenPickable', false);
|
|
28217
|
+
if (releaseSelf) {
|
|
28218
|
+
this.releaseStatus = 'willRelease';
|
|
28219
|
+
}
|
|
28220
|
+
const pendingAnimates = new Set(exitAnimates);
|
|
28221
|
+
this._exitReleaseState = {
|
|
28222
|
+
pendingAnimates,
|
|
28223
|
+
finalized: false,
|
|
28224
|
+
releaseSelf,
|
|
28225
|
+
removeFromParent: !!options.removeFromParent,
|
|
28226
|
+
onComplete: options.onComplete ? [options.onComplete] : []
|
|
28227
|
+
};
|
|
28228
|
+
bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease());
|
|
28229
|
+
return true;
|
|
28230
|
+
}
|
|
28231
|
+
releaseWithExitAnimation(options = {}) {
|
|
28232
|
+
if (this.releaseStatus === 'released') {
|
|
28233
|
+
return false;
|
|
28234
|
+
}
|
|
28235
|
+
return this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({}, options), { releaseSelf: true }));
|
|
28236
|
+
}
|
|
28237
|
+
render() {
|
|
28238
|
+
var _a, _b;
|
|
28239
|
+
if ((_a = this._exitReleaseState) === null || _a === void 0 ? void 0 : _a.releaseSelf) {
|
|
28240
|
+
return;
|
|
28241
|
+
}
|
|
26942
28242
|
this.transAnimationConfig();
|
|
26943
28243
|
this.setAttribute('pickable', false);
|
|
26944
|
-
const markerVisible = (
|
|
28244
|
+
const markerVisible = (_b = this.attribute.visible) !== null && _b !== void 0 ? _b : true;
|
|
26945
28245
|
if (this.attribute.interactive === false) {
|
|
26946
28246
|
this.setAttribute('childrenPickable', false);
|
|
26947
28247
|
}
|
|
26948
28248
|
if (markerVisible && this.isValidPoints()) {
|
|
28249
|
+
if (this._exitReleaseState) {
|
|
28250
|
+
this._finalizeExitRelease();
|
|
28251
|
+
}
|
|
26949
28252
|
if (!this._container) {
|
|
26950
28253
|
this._initContainer();
|
|
26951
28254
|
this.initMarker(this._container);
|
|
@@ -26958,18 +28261,30 @@ class Marker extends AbstractComponent {
|
|
|
26958
28261
|
}
|
|
26959
28262
|
}
|
|
26960
28263
|
else {
|
|
26961
|
-
this.
|
|
26962
|
-
|
|
26963
|
-
|
|
28264
|
+
if (!this._runExitAnimationBeforeCleanup()) {
|
|
28265
|
+
this._container = null;
|
|
28266
|
+
this._containerClip = null;
|
|
28267
|
+
this.removeAllChild(true);
|
|
28268
|
+
}
|
|
26964
28269
|
}
|
|
26965
28270
|
this._releaseEvent();
|
|
26966
28271
|
this._bindEvent();
|
|
26967
28272
|
}
|
|
26968
|
-
release() {
|
|
26969
|
-
this.
|
|
26970
|
-
|
|
28273
|
+
release(all) {
|
|
28274
|
+
if (this._exitReleaseState) {
|
|
28275
|
+
this._finalizeExitRelease();
|
|
28276
|
+
return;
|
|
28277
|
+
}
|
|
28278
|
+
if (this.attribute.animation !== false && this.attribute.animationExit !== false) {
|
|
28279
|
+
this.markerAnimate('exit');
|
|
28280
|
+
}
|
|
28281
|
+
if (all) {
|
|
28282
|
+
this.removeAllChild(true);
|
|
28283
|
+
}
|
|
28284
|
+
super.release(all);
|
|
26971
28285
|
this._releaseEvent();
|
|
26972
28286
|
this._container = null;
|
|
28287
|
+
this._containerClip = null;
|
|
26973
28288
|
}
|
|
26974
28289
|
}
|
|
26975
28290
|
|
|
@@ -26981,7 +28296,10 @@ function graphicFadeIn(graphic, delay, duration, easing) {
|
|
|
26981
28296
|
(_a = graphic === null || graphic === void 0 ? void 0 : graphic.animates) === null || _a === void 0 ? void 0 : _a.forEach(a => a.stop('end'));
|
|
26982
28297
|
const fillOpacityConfig = (_c = (_b = graphic.attribute) === null || _b === void 0 ? void 0 : _b.fillOpacity) !== null && _c !== void 0 ? _c : 1;
|
|
26983
28298
|
const strokeOpacityConfig = (_e = (_d = graphic.attribute) === null || _d === void 0 ? void 0 : _d.strokeOpacity) !== null && _e !== void 0 ? _e : 1;
|
|
26984
|
-
graphic
|
|
28299
|
+
commitUpdateAnimationTarget(graphic, {
|
|
28300
|
+
fillOpacity: fillOpacityConfig,
|
|
28301
|
+
strokeOpacity: strokeOpacityConfig
|
|
28302
|
+
}, {
|
|
26985
28303
|
fillOpacity: 0,
|
|
26986
28304
|
strokeOpacity: 0
|
|
26987
28305
|
});
|
|
@@ -27011,7 +28329,10 @@ function graphicFadeOut(graphic, delay, duration, easing) {
|
|
|
27011
28329
|
if (!graphic) {
|
|
27012
28330
|
return;
|
|
27013
28331
|
}
|
|
27014
|
-
graphic
|
|
28332
|
+
commitUpdateAnimationTarget(graphic, {
|
|
28333
|
+
fillOpacity: 0,
|
|
28334
|
+
strokeOpacity: 0
|
|
28335
|
+
}, {
|
|
27015
28336
|
fillOpacity: (_b = (_a = graphic.attribute) === null || _a === void 0 ? void 0 : _a.fillOpacity) !== null && _b !== void 0 ? _b : 1,
|
|
27016
28337
|
strokeOpacity: (_d = (_c = graphic.attribute) === null || _c === void 0 ? void 0 : _c.strokeOpacity) !== null && _d !== void 0 ? _d : 1
|
|
27017
28338
|
});
|
|
@@ -27040,7 +28361,7 @@ function commonLineClipIn(line, label, duration, delay, easing) {
|
|
|
27040
28361
|
const endSymbolDuration = 0.1 * duration;
|
|
27041
28362
|
const labelDuration = 0.1 * duration;
|
|
27042
28363
|
graphicFadeIn(line.startSymbol, delay, startSymbolDuration, easing);
|
|
27043
|
-
line.lines.forEach(line => line
|
|
28364
|
+
line.lines.forEach(line => commitUpdateAnimationTarget(line, { clipRange: 1 }, { clipRange: 0 }));
|
|
27044
28365
|
line.lines.forEach((l, index) => {
|
|
27045
28366
|
const stepDuration = lineDuration / line.lines.length;
|
|
27046
28367
|
l.animate()
|
|
@@ -27123,7 +28444,7 @@ function pointCallIn(itemLine, decorativeLine, item, duration, delay, easing) {
|
|
|
27123
28444
|
const endSymbolDuration = 0.1 * duration;
|
|
27124
28445
|
const labelDuration = 0.1 * duration;
|
|
27125
28446
|
graphicFadeIn(itemLine.startSymbol, delay, startSymbolDuration, easing);
|
|
27126
|
-
itemLine.lines.forEach(line => line
|
|
28447
|
+
itemLine.lines.forEach(line => commitUpdateAnimationTarget(line, { clipRange: 1 }, { clipRange: 0 }));
|
|
27127
28448
|
itemLine.lines.forEach((l, index) => {
|
|
27128
28449
|
const stepDuration = lineDuration / itemLine.lines.length;
|
|
27129
28450
|
l.animate()
|
|
@@ -29470,8 +30791,10 @@ class DiscreteLegend extends LegendBase {
|
|
|
29470
30791
|
? this.attribute.item.width
|
|
29471
30792
|
: innerGroupWidth + parsedPadding[1] + parsedPadding[3];
|
|
29472
30793
|
const itemGroupHeight = this._itemHeightByUser || innerGroupHeight + parsedPadding[0] + parsedPadding[2];
|
|
29473
|
-
itemGroup.
|
|
29474
|
-
|
|
30794
|
+
itemGroup.setAttributes({
|
|
30795
|
+
width: itemGroupWidth,
|
|
30796
|
+
height: itemGroupHeight
|
|
30797
|
+
});
|
|
29475
30798
|
focusShape && focusShape.setAttribute('visible', false);
|
|
29476
30799
|
innerGroup.translateTo(-innerGroupBounds.x1 + parsedPadding[3], -innerGroupBounds.y1 + parsedPadding[0]);
|
|
29477
30800
|
return itemGroup;
|
|
@@ -29622,9 +30945,9 @@ class DiscreteLegend extends LegendBase {
|
|
|
29622
30945
|
}
|
|
29623
30946
|
if (!this._itemContext.isScrollbar) {
|
|
29624
30947
|
if (animation) {
|
|
29625
|
-
|
|
29626
|
-
|
|
29627
|
-
|
|
30948
|
+
const attrs = { [channel]: -(newPage - 1) * pageSize };
|
|
30949
|
+
commitUpdateAnimationTarget(this._itemsContainer, attrs);
|
|
30950
|
+
this._itemsContainer.animate().to(attrs, animationDuration, animationEasing);
|
|
29628
30951
|
}
|
|
29629
30952
|
else {
|
|
29630
30953
|
this._itemsContainer.setAttribute(channel, -(newPage - 1) * pageSize);
|
|
@@ -29642,7 +30965,9 @@ class DiscreteLegend extends LegendBase {
|
|
|
29642
30965
|
const startOffset = containerSize * start;
|
|
29643
30966
|
this.updateScrollMask();
|
|
29644
30967
|
if (animation) {
|
|
29645
|
-
|
|
30968
|
+
const attrs = { [channel]: -startOffset };
|
|
30969
|
+
commitUpdateAnimationTarget(this._itemsContainer, attrs);
|
|
30970
|
+
this._itemsContainer.animate().to(attrs, animationDuration, animationEasing);
|
|
29646
30971
|
}
|
|
29647
30972
|
else {
|
|
29648
30973
|
this._itemsContainer.setAttribute(channel, -startOffset);
|
|
@@ -31455,9 +32780,11 @@ class Title extends AbstractComponent {
|
|
|
31455
32780
|
totalHeight = maxHeight;
|
|
31456
32781
|
}
|
|
31457
32782
|
}
|
|
31458
|
-
group.
|
|
31459
|
-
|
|
31460
|
-
|
|
32783
|
+
group.setAttributes({
|
|
32784
|
+
width: totalWidth,
|
|
32785
|
+
height: totalHeight,
|
|
32786
|
+
boundsPadding: parsedPadding
|
|
32787
|
+
});
|
|
31461
32788
|
if (this._mainTitle) {
|
|
31462
32789
|
if (isValid(align) || isValid(textStyle.align)) {
|
|
31463
32790
|
const mainTitleAlign = textStyle.align ? textStyle.align : align;
|
|
@@ -33595,6 +34922,7 @@ class Timeline extends AbstractComponent {
|
|
|
33595
34922
|
setActive(symbolGroup, activeSymbolStyle);
|
|
33596
34923
|
}
|
|
33597
34924
|
appearAnimate(animateConfig) {
|
|
34925
|
+
var _a;
|
|
33598
34926
|
const { duration = 1000, easing = 'quadOut' } = animateConfig;
|
|
33599
34927
|
const { activeLabelStyle, activeSymbolStyle } = this.attribute;
|
|
33600
34928
|
const percent = duration / 1000;
|
|
@@ -33605,30 +34933,33 @@ class Timeline extends AbstractComponent {
|
|
|
33605
34933
|
const symbolDelay = percent * 100;
|
|
33606
34934
|
const symbolNormalDelay = percent * 600;
|
|
33607
34935
|
if (this._line) {
|
|
33608
|
-
this._line
|
|
34936
|
+
commitUpdateAnimationTarget(this._line, { clipRange: 1 }, { clipRange: 0 });
|
|
33609
34937
|
this._line.animate().to({ clipRange: 1 }, lineDuration, easing);
|
|
33610
34938
|
}
|
|
33611
34939
|
if (this._activeLine) {
|
|
33612
|
-
this._activeLine.
|
|
34940
|
+
const opacity = (_a = this._activeLine.attribute.opacity) !== null && _a !== void 0 ? _a : 1;
|
|
34941
|
+
commitUpdateAnimationTarget(this._activeLine, { opacity }, { opacity: 0 });
|
|
33613
34942
|
this._activeLine
|
|
33614
34943
|
.animate()
|
|
33615
34944
|
.wait(500)
|
|
33616
|
-
.to({ opacity
|
|
34945
|
+
.to({ opacity }, activeLineDuration, easing);
|
|
33617
34946
|
}
|
|
33618
34947
|
if (this._symbolGroup) {
|
|
33619
34948
|
const size = this._symbolGroup.count - 1;
|
|
33620
34949
|
const delay = percent * (size === 1 ? 0 : (500 - 100) / (size - 1));
|
|
33621
34950
|
const delayNormal = percent * (size === 1 ? 0 : (400 - 160) / (size - 1));
|
|
33622
34951
|
this._symbolGroup.forEachChildren((symbol, i) => {
|
|
34952
|
+
var _a;
|
|
33623
34953
|
const originAttrs = {};
|
|
33624
34954
|
Object.keys(activeSymbolStyle).forEach(k => {
|
|
33625
34955
|
originAttrs[k] = symbol.attribute[k];
|
|
33626
34956
|
});
|
|
33627
|
-
symbol.
|
|
34957
|
+
const opacity = (_a = symbol.attribute.opacity) !== null && _a !== void 0 ? _a : 1;
|
|
34958
|
+
commitUpdateAnimationTarget(symbol, { opacity }, { opacity: 0 });
|
|
33628
34959
|
symbol
|
|
33629
34960
|
.animate()
|
|
33630
34961
|
.wait(symbolDelay + delay * i)
|
|
33631
|
-
.to({ opacity
|
|
34962
|
+
.to({ opacity }, perSymbolDuration, easing);
|
|
33632
34963
|
symbol
|
|
33633
34964
|
.animate()
|
|
33634
34965
|
.wait(symbolNormalDelay + delayNormal * i)
|
|
@@ -33641,15 +34972,17 @@ class Timeline extends AbstractComponent {
|
|
|
33641
34972
|
const delay = percent * (size === 1 ? 0 : (500 - 100) / (size - 1));
|
|
33642
34973
|
const delayNormal = percent * (size === 1 ? 0 : (400 - 160) / (size - 1));
|
|
33643
34974
|
this._labelGroup.forEachChildren((label, i) => {
|
|
34975
|
+
var _a;
|
|
33644
34976
|
const originAttrs = {};
|
|
33645
34977
|
Object.keys(activeLabelStyle).forEach(k => {
|
|
33646
34978
|
originAttrs[k] = label.attribute[k];
|
|
33647
34979
|
});
|
|
33648
|
-
label.
|
|
34980
|
+
const opacity = (_a = label.attribute.opacity) !== null && _a !== void 0 ? _a : 1;
|
|
34981
|
+
commitUpdateAnimationTarget(label, { opacity }, { opacity: 0 });
|
|
33649
34982
|
label
|
|
33650
34983
|
.animate()
|
|
33651
34984
|
.wait(symbolDelay + delay * i)
|
|
33652
|
-
.to({ opacity
|
|
34985
|
+
.to({ opacity }, perSymbolDuration, easing);
|
|
33653
34986
|
label
|
|
33654
34987
|
.animate()
|
|
33655
34988
|
.wait(symbolNormalDelay + delayNormal * i)
|
|
@@ -33689,6 +35022,7 @@ class Timeline extends AbstractComponent {
|
|
|
33689
35022
|
const nextClipRange = flag > 0 ? this._timesPercent[i] || 1 : this._timesPercent[i - 1] || 0;
|
|
33690
35023
|
if (animation) {
|
|
33691
35024
|
const { duration = 1000, easing = 'quadOut' } = animateConfig;
|
|
35025
|
+
commitUpdateAnimationTarget(this, { clipRange: nextClipRange }, { clipRange });
|
|
33692
35026
|
this.animate().to({ clipRange: nextClipRange }, duration, easing);
|
|
33693
35027
|
}
|
|
33694
35028
|
else {
|
|
@@ -35535,6 +36869,6 @@ TableSeriesNumber.defaultAttributes = {
|
|
|
35535
36869
|
select: true
|
|
35536
36870
|
};
|
|
35537
36871
|
|
|
35538
|
-
const version = "1.1.0-alpha.
|
|
36872
|
+
const version = "1.1.0-alpha.21";
|
|
35539
36873
|
|
|
35540
36874
|
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 };
|