@visactor/vrender-components 1.1.0-alpha.16 → 1.1.0-alpha.18
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/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/axis/base.d.ts +6 -2
- package/cjs/axis/base.js +60 -6
- 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/brush.js +2 -1
- package/cjs/core/type.d.ts +7 -0
- package/cjs/core/type.js.map +1 -1
- package/cjs/crosshair/base.js +1 -1
- package/cjs/crosshair/circle.js +1 -1
- package/cjs/crosshair/index.js +1 -1
- package/cjs/crosshair/line.js +1 -1
- package/cjs/crosshair/polygon-sector.js +1 -2
- package/cjs/crosshair/polygon.js +1 -1
- package/cjs/crosshair/rect.js +1 -1
- package/cjs/crosshair/register.js +1 -1
- package/cjs/crosshair/sector.js +1 -1
- package/cjs/crosshair/type.js +1 -1
- package/cjs/data-zoom/renderer.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/jsx/index.js +1 -1
- package/cjs/label/arc.js +1 -1
- package/cjs/label/base.d.ts +6 -1
- package/cjs/label/base.js +67 -3
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/data-label-register.js +2 -1
- package/cjs/label/dataLabel.d.ts +5 -1
- package/cjs/label/dataLabel.js +47 -2
- package/cjs/label/dataLabel.js.map +1 -1
- package/cjs/label/index.js +1 -1
- package/cjs/label/line.js +1 -1
- package/cjs/label/polygon.js +1 -1
- package/cjs/label/rect.js +1 -1
- package/cjs/label/register.js +1 -1
- package/cjs/label/symbol.js +1 -1
- package/cjs/legend/discrete/discrete.js +4 -2
- package/cjs/legend/discrete/discrete.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/title/title.js +5 -2
- package/cjs/title/title.js.map +1 -1
- package/dist/index.es.js +1178 -193
- 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/axis/base.d.ts +6 -2
- package/es/axis/base.js +59 -4
- 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/brush.js +2 -1
- package/es/core/type.d.ts +7 -0
- package/es/core/type.js.map +1 -1
- package/es/crosshair/base.js +1 -1
- package/es/crosshair/circle.js +1 -1
- package/es/crosshair/index.js +1 -1
- package/es/crosshair/line.js +1 -1
- package/es/crosshair/polygon-sector.js +1 -2
- package/es/crosshair/polygon.js +1 -1
- package/es/crosshair/rect.js +1 -1
- package/es/crosshair/register.js +1 -1
- package/es/crosshair/sector.js +1 -1
- package/es/crosshair/type.js +1 -1
- package/es/data-zoom/renderer.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/jsx/index.js +1 -1
- package/es/label/arc.js +1 -1
- package/es/label/base.d.ts +6 -1
- package/es/label/base.js +67 -2
- package/es/label/base.js.map +1 -1
- package/es/label/data-label-register.js +2 -1
- package/es/label/dataLabel.d.ts +5 -1
- package/es/label/dataLabel.js +47 -1
- package/es/label/dataLabel.js.map +1 -1
- package/es/label/index.js +1 -1
- package/es/label/line.js +1 -1
- package/es/label/polygon.js +1 -1
- package/es/label/rect.js +1 -1
- package/es/label/register.js +1 -1
- package/es/label/symbol.js +1 -1
- package/es/legend/discrete/discrete.js +4 -2
- package/es/legend/discrete/discrete.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/title/title.js +5 -2
- package/es/title/title.js.map +1 -1
- package/package.json +4 -4
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) {
|
|
@@ -5338,7 +5475,7 @@ function rebuildSharedStateScope(scope) {
|
|
|
5338
5475
|
}
|
|
5339
5476
|
function ensureSharedStateScopeFresh(scope) {
|
|
5340
5477
|
var _a;
|
|
5341
|
-
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;
|
|
5342
5479
|
}
|
|
5343
5480
|
function collectSharedStateScopeChain(scope) {
|
|
5344
5481
|
const chain = [];
|
|
@@ -5349,7 +5486,7 @@ function collectSharedStateScopeChain(scope) {
|
|
|
5349
5486
|
|
|
5350
5487
|
function scheduleStageSharedStateRefresh(stage) {
|
|
5351
5488
|
var _a;
|
|
5352
|
-
stage && "released" !== stage.releaseStatus && (null === (_a =
|
|
5489
|
+
stage && "released" !== stage.releaseStatus && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordRefresh("renderScheduled"), stage.renderNextFrame());
|
|
5353
5490
|
}
|
|
5354
5491
|
function enqueueGraphicSharedStateRefresh(stage, graphic) {
|
|
5355
5492
|
var _a;
|
|
@@ -5357,7 +5494,7 @@ function enqueueGraphicSharedStateRefresh(stage, graphic) {
|
|
|
5357
5494
|
const pending = null !== (_a = stage._pendingSharedStateRefreshGraphics) && void 0 !== _a ? _a : stage._pendingSharedStateRefreshGraphics = new Set();
|
|
5358
5495
|
if (!pending.has(graphic)) {
|
|
5359
5496
|
pending.add(graphic);
|
|
5360
|
-
const perfMonitor =
|
|
5497
|
+
const perfMonitor = getActiveStageStatePerfMonitor(stage);
|
|
5361
5498
|
null == perfMonitor || perfMonitor.recordRefresh("queuedGraphics"), null == perfMonitor || perfMonitor.recordAllocation("refreshQueuePushes");
|
|
5362
5499
|
}
|
|
5363
5500
|
}
|
|
@@ -5377,9 +5514,12 @@ const tempConstantXYKey = ["x", "y"],
|
|
|
5377
5514
|
tempConstantScaleXYKey = ["scaleX", "scaleY"],
|
|
5378
5515
|
tempConstantAngleKey = ["angle"],
|
|
5379
5516
|
builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
|
|
5380
|
-
|
|
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;
|
|
5381
5521
|
function isPlainObjectValue(value) {
|
|
5382
|
-
return "object" == typeof value && null != value && !isArray(value);
|
|
5522
|
+
return "object" == typeof value && null != value && !Array.isArray(value);
|
|
5383
5523
|
}
|
|
5384
5524
|
function cloneAttributeValue(value) {
|
|
5385
5525
|
if (!isPlainObjectValue(value)) return value;
|
|
@@ -5390,12 +5530,6 @@ function cloneAttributeValue(value) {
|
|
|
5390
5530
|
clone[key] = isPlainObjectValue(nextValue) ? cloneAttributeValue(nextValue) : nextValue;
|
|
5391
5531
|
}), clone;
|
|
5392
5532
|
}
|
|
5393
|
-
function cloneSimpleAttributeRecord(value) {
|
|
5394
|
-
return isPlainObjectValue(value) ? Object.assign({}, value) : value;
|
|
5395
|
-
}
|
|
5396
|
-
function shouldUseSimpleAttributeFastPath(value) {
|
|
5397
|
-
return !!isPlainObjectValue(value) && !Object.keys(value).some(key => isPlainObjectValue(value[key]));
|
|
5398
|
-
}
|
|
5399
5533
|
function cloneAttributeSurface(value) {
|
|
5400
5534
|
if (!isPlainObjectValue(value)) return value;
|
|
5401
5535
|
const source = value,
|
|
@@ -5405,6 +5539,9 @@ function cloneAttributeSurface(value) {
|
|
|
5405
5539
|
clone[key] = isPlainObjectValue(nextValue) ? Object.assign({}, nextValue) : nextValue;
|
|
5406
5540
|
}), clone;
|
|
5407
5541
|
}
|
|
5542
|
+
function areAttributeValuesEqual(left, right) {
|
|
5543
|
+
return left === right || !!(isPlainObjectValue(left) || isPlainObjectValue(right) || Array.isArray(left) || Array.isArray(right)) && isEqual(left, right);
|
|
5544
|
+
}
|
|
5408
5545
|
function deepMergeAttributeValue(base, value) {
|
|
5409
5546
|
var _a;
|
|
5410
5547
|
const result = null !== (_a = cloneAttributeValue(base)) && void 0 !== _a ? _a : {};
|
|
@@ -5467,18 +5604,24 @@ class Graphic extends Node {
|
|
|
5467
5604
|
get globalTransMatrix() {
|
|
5468
5605
|
return this.tryUpdateGlobalTransMatrix(!0);
|
|
5469
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
|
+
}
|
|
5470
5614
|
constructor(params = {}) {
|
|
5471
5615
|
var _a;
|
|
5472
|
-
super(), this.
|
|
5473
|
-
const useSimpleAttributeFastPath = shouldUseSimpleAttributeFastPath(params),
|
|
5474
|
-
initialBaseAttributes = useSimpleAttributeFastPath ? cloneSimpleAttributeRecord(params) : cloneAttributeValue(params);
|
|
5475
|
-
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);
|
|
5476
5617
|
}
|
|
5477
5618
|
get normalAttrs() {
|
|
5478
5619
|
return this.baseAttributes;
|
|
5479
5620
|
}
|
|
5480
|
-
set normalAttrs(
|
|
5481
|
-
|
|
5621
|
+
set normalAttrs(_value) {}
|
|
5622
|
+
getBaseAttributesStorage() {
|
|
5623
|
+
var _a;
|
|
5624
|
+
return null !== (_a = this._baseAttributes) && void 0 !== _a ? _a : this.attribute;
|
|
5482
5625
|
}
|
|
5483
5626
|
getGraphicService() {
|
|
5484
5627
|
var _a, _b;
|
|
@@ -5509,10 +5652,18 @@ class Graphic extends Node {
|
|
|
5509
5652
|
const nextScope = this.resolveBoundSharedStateScope();
|
|
5510
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);
|
|
5511
5654
|
}
|
|
5512
|
-
|
|
5655
|
+
syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
|
|
5513
5656
|
var _a, _b;
|
|
5514
|
-
|
|
5515
|
-
|
|
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 => {
|
|
5516
5667
|
nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
|
|
5517
5668
|
}), nextScopes.forEach(scope => {
|
|
5518
5669
|
scope.subtreeActiveDescendants.add(this);
|
|
@@ -5528,15 +5679,13 @@ class Graphic extends Node {
|
|
|
5528
5679
|
this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
|
|
5529
5680
|
}
|
|
5530
5681
|
onParentSharedStateTreeChanged(stage, layer) {
|
|
5531
|
-
this.stage === stage && this.layer === layer ? this.
|
|
5682
|
+
this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
|
|
5532
5683
|
}
|
|
5533
5684
|
refreshSharedStateBeforeRender() {
|
|
5534
5685
|
var _a;
|
|
5535
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({
|
|
5536
5687
|
type: AttributeUpdateType.STATE
|
|
5537
|
-
}), this.
|
|
5538
|
-
type: AttributeUpdateType.STATE
|
|
5539
|
-
}), this.sharedStateDirty = !1) : this.sharedStateDirty = !1;
|
|
5688
|
+
}), this.emitStateUpdateEvent(), this.sharedStateDirty = !1) : this.sharedStateDirty = !1;
|
|
5540
5689
|
}
|
|
5541
5690
|
getLocalStatesVersion() {
|
|
5542
5691
|
var _a, _b;
|
|
@@ -5594,7 +5743,7 @@ class Graphic extends Node {
|
|
|
5594
5743
|
const transition = stateModel.useStates(this.currentStates),
|
|
5595
5744
|
effectiveStates = null !== (_d = transition.effectiveStates) && void 0 !== _d ? _d : transition.states,
|
|
5596
5745
|
resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
|
|
5597
|
-
this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch =
|
|
5746
|
+
this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.syncSharedStateActiveRegistrations();
|
|
5598
5747
|
}
|
|
5599
5748
|
buildStaticAttributeSnapshot() {
|
|
5600
5749
|
var _a;
|
|
@@ -5633,16 +5782,17 @@ class Graphic extends Node {
|
|
|
5633
5782
|
next: void 0
|
|
5634
5783
|
}), delete target[key]));
|
|
5635
5784
|
const nextValue = snapshot[key];
|
|
5636
|
-
|
|
5785
|
+
areAttributeValuesEqual(previousValue, nextValue) || (delta.set(key, {
|
|
5637
5786
|
prev: previousValue,
|
|
5638
5787
|
next: nextValue
|
|
5639
5788
|
}), target[key] = cloneAttributeValue(nextValue));
|
|
5640
5789
|
}), delta;
|
|
5641
5790
|
}
|
|
5642
5791
|
_syncAttribute() {
|
|
5792
|
+
this.attribute === this.baseAttributes && this.resolvedStatePatch && this.detachAttributeFromBaseAttributes();
|
|
5643
5793
|
const snapshot = this.buildStaticAttributeSnapshot(),
|
|
5644
5794
|
delta = this.syncObjectToSnapshot(this.attribute, snapshot);
|
|
5645
|
-
return this.valid = this.isValid(), delta;
|
|
5795
|
+
return this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, delta;
|
|
5646
5796
|
}
|
|
5647
5797
|
_syncFinalAttributeFromStaticTruth() {
|
|
5648
5798
|
const target = this.finalAttribute;
|
|
@@ -5650,47 +5800,146 @@ class Graphic extends Node {
|
|
|
5650
5800
|
const snapshot = this.buildStaticAttributeSnapshot();
|
|
5651
5801
|
this.syncObjectToSnapshot(target, snapshot);
|
|
5652
5802
|
}
|
|
5653
|
-
|
|
5803
|
+
mergeAttributeDeltaCategory(category, key, prev, next) {
|
|
5804
|
+
var _a;
|
|
5805
|
+
let nextCategory = "stroke" === key || "shadowBlur" === key ? classifyAttributeDelta(key, prev, next) : null !== (_a = ATTRIBUTE_CATEGORY[key]) && void 0 !== _a ? _a : UpdateCategory.PAINT;
|
|
5806
|
+
return nextCategory & UpdateCategory.PICK && (nextCategory |= UpdateCategory.BOUNDS), nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key) && (nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS), category | nextCategory;
|
|
5807
|
+
}
|
|
5808
|
+
submitUpdateByCategory(category, forceUpdateTag = !1) {
|
|
5654
5809
|
var _a;
|
|
5655
5810
|
if (forceUpdateTag) return this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), void this.addUpdateLayoutTag();
|
|
5811
|
+
if (category !== UpdateCategory.NONE) {
|
|
5812
|
+
const stage = this.stage;
|
|
5813
|
+
stage && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordCategory(category));
|
|
5814
|
+
}
|
|
5815
|
+
(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();
|
|
5816
|
+
}
|
|
5817
|
+
submitUpdateByDelta(delta, forceUpdateTag = !1) {
|
|
5656
5818
|
let category = UpdateCategory.NONE;
|
|
5657
5819
|
delta.forEach((entry, key) => {
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5820
|
+
category = this.mergeAttributeDeltaCategory(category, key, entry.prev, entry.next);
|
|
5821
|
+
}), this.submitUpdateByCategory(category, forceUpdateTag);
|
|
5822
|
+
}
|
|
5823
|
+
submitTouchedKeyUpdate(keys, forceUpdateTag = !1) {
|
|
5824
|
+
this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTags(keys));
|
|
5825
|
+
}
|
|
5826
|
+
submitTouchedUpdate(needsShapeAndBounds) {
|
|
5827
|
+
!this.updateShapeAndBoundsTagSetted() && needsShapeAndBounds ? this.addUpdateShapeAndBoundsTag() : this.addUpdateBoundTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag();
|
|
5661
5828
|
}
|
|
5662
5829
|
commitBaseAttributeMutation(forceUpdateTag = !1, context) {
|
|
5663
|
-
var _a, _b;
|
|
5664
|
-
(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && (this.resolverEpoch
|
|
5830
|
+
var _a, _b, _c;
|
|
5831
|
+
(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());
|
|
5665
5832
|
const delta = this._syncAttribute();
|
|
5666
5833
|
this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
|
|
5667
5834
|
}
|
|
5835
|
+
canCommitBaseAttributesByTouchedKeys() {
|
|
5836
|
+
var _a, _b;
|
|
5837
|
+
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());
|
|
5838
|
+
}
|
|
5839
|
+
detachAttributeFromBaseAttributes() {
|
|
5840
|
+
this.attribute === this.baseAttributes && (this._baseAttributes = this.attribute, this.attribute = cloneAttributeSurface(this.attribute));
|
|
5841
|
+
}
|
|
5842
|
+
commitInternalBaseAttributes(params, context) {
|
|
5843
|
+
params && Object.keys(params).length && (this.canCommitBaseAttributesByTouchedKeys() ? this.commitBaseAttributesByTouchedKeys(params, !1, context) : (this.detachAttributeFromBaseAttributes(), this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context)));
|
|
5844
|
+
}
|
|
5845
|
+
commitBaseAttributesByTouchedKeys(params, forceUpdateTag = !1, context) {
|
|
5846
|
+
const source = params,
|
|
5847
|
+
baseAttributes = this.getBaseAttributesStorage();
|
|
5848
|
+
let hasKeys = !1,
|
|
5849
|
+
needsShapeAndBounds = forceUpdateTag;
|
|
5850
|
+
for (const key in source) Object.prototype.hasOwnProperty.call(source, key) && (hasKeys = !0, baseAttributes[key] = source[key], !needsShapeAndBounds && this.needUpdateTag(key) && (needsShapeAndBounds = !0));
|
|
5851
|
+
hasKeys && (this.attribute = baseAttributes, this._baseAttributes = void 0, this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, this.submitTouchedUpdate(needsShapeAndBounds), this.onAttributeUpdate(context));
|
|
5852
|
+
}
|
|
5853
|
+
commitBaseAttributeBySingleKey(key, value, forceUpdateTag = !1, context) {
|
|
5854
|
+
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);
|
|
5855
|
+
}
|
|
5668
5856
|
applyBaseAttributes(params) {
|
|
5669
5857
|
const keys = Object.keys(params);
|
|
5670
5858
|
for (let i = 0; i < keys.length; i++) {
|
|
5671
5859
|
const key = keys[i];
|
|
5672
|
-
this.
|
|
5860
|
+
this.getBaseAttributesStorage()[key] = params[key];
|
|
5673
5861
|
}
|
|
5674
5862
|
}
|
|
5863
|
+
applyAnimationTransientAttributes(params, forceUpdateTag = !1, context) {
|
|
5864
|
+
const source = params;
|
|
5865
|
+
let target,
|
|
5866
|
+
needsShapeAndBounds = forceUpdateTag;
|
|
5867
|
+
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));
|
|
5868
|
+
target && (this.attributeMayContainTransientAttrs = !0, this.valid = this.isValid(), this.submitTouchedUpdate(needsShapeAndBounds), this.onAttributeUpdate(context));
|
|
5869
|
+
}
|
|
5675
5870
|
applyTransientAttributes(params, forceUpdateTag = !1, context) {
|
|
5871
|
+
this.detachAttributeFromBaseAttributes();
|
|
5676
5872
|
const delta = new Map(),
|
|
5677
5873
|
keys = Object.keys(params);
|
|
5678
5874
|
for (let i = 0; i < keys.length; i++) {
|
|
5679
5875
|
const key = keys[i],
|
|
5680
5876
|
previousValue = this.attribute[key],
|
|
5681
5877
|
nextValue = params[key];
|
|
5682
|
-
|
|
5878
|
+
areAttributeValuesEqual(previousValue, nextValue) || (delta.set(key, {
|
|
5683
5879
|
prev: previousValue,
|
|
5684
5880
|
next: nextValue
|
|
5685
|
-
}), this.attribute[key] =
|
|
5881
|
+
}), this.attribute[key] = nextValue);
|
|
5686
5882
|
}
|
|
5687
|
-
this.valid = this.isValid(), this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
|
|
5883
|
+
delta.size && (this.attributeMayContainTransientAttrs = !0), this.valid = this.isValid(), this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
|
|
5688
5884
|
}
|
|
5689
5885
|
_restoreAttributeFromStaticTruth(context) {
|
|
5690
5886
|
this._syncFinalAttributeFromStaticTruth();
|
|
5691
5887
|
const delta = this._syncAttribute();
|
|
5692
5888
|
this.submitUpdateByDelta(delta), this.onAttributeUpdate(context);
|
|
5693
5889
|
}
|
|
5890
|
+
collectStatePatchDeltaKeys(previousPatch, nextPatch) {
|
|
5891
|
+
const keys = previousPatch ? Object.keys(previousPatch) : [];
|
|
5892
|
+
if (!nextPatch) return keys;
|
|
5893
|
+
for (const key in nextPatch) Object.prototype.hasOwnProperty.call(nextPatch, key) && !Object.prototype.hasOwnProperty.call(null != previousPatch ? previousPatch : {}, key) && keys.push(key);
|
|
5894
|
+
return keys;
|
|
5895
|
+
}
|
|
5896
|
+
getStaticTruthValueForStateKey(key, nextPatch) {
|
|
5897
|
+
var _a;
|
|
5898
|
+
const baseAttributes = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : {},
|
|
5899
|
+
patch = nextPatch;
|
|
5900
|
+
if (patch && Object.prototype.hasOwnProperty.call(patch, key)) {
|
|
5901
|
+
const patchValue = patch[key],
|
|
5902
|
+
baseValue = baseAttributes[key];
|
|
5903
|
+
return "deep" === this.stateMergeMode && isPlainObjectValue(baseValue) && isPlainObjectValue(patchValue) ? {
|
|
5904
|
+
hasValue: !0,
|
|
5905
|
+
value: deepMergeAttributeValue(baseValue, patchValue)
|
|
5906
|
+
} : {
|
|
5907
|
+
hasValue: !0,
|
|
5908
|
+
value: patchValue
|
|
5909
|
+
};
|
|
5910
|
+
}
|
|
5911
|
+
return Object.prototype.hasOwnProperty.call(baseAttributes, key) ? {
|
|
5912
|
+
hasValue: !0,
|
|
5913
|
+
value: baseAttributes[key]
|
|
5914
|
+
} : {
|
|
5915
|
+
hasValue: !1,
|
|
5916
|
+
value: void 0
|
|
5917
|
+
};
|
|
5918
|
+
}
|
|
5919
|
+
syncStatePatchDeltaToTarget(target, keys, nextPatch, collectCategory = !1) {
|
|
5920
|
+
let category = UpdateCategory.NONE;
|
|
5921
|
+
for (let i = 0; i < keys.length; i++) {
|
|
5922
|
+
const key = keys[i],
|
|
5923
|
+
previousValue = target[key],
|
|
5924
|
+
next = this.getStaticTruthValueForStateKey(key, nextPatch);
|
|
5925
|
+
if (!next.hasValue) {
|
|
5926
|
+
Object.prototype.hasOwnProperty.call(target, key) && (delete target[key], collectCategory && (category = this.mergeAttributeDeltaCategory(category, key, previousValue, void 0)));
|
|
5927
|
+
continue;
|
|
5928
|
+
}
|
|
5929
|
+
if (areAttributeValuesEqual(previousValue, next.value)) continue;
|
|
5930
|
+
const nextValue = cloneAttributeValue(next.value);
|
|
5931
|
+
target[key] = nextValue, collectCategory && (category = this.mergeAttributeDeltaCategory(category, key, previousValue, nextValue));
|
|
5932
|
+
}
|
|
5933
|
+
return category;
|
|
5934
|
+
}
|
|
5935
|
+
restoreAttributeFromStatePatchDelta(previousPatch, nextPatch, context) {
|
|
5936
|
+
this.detachAttributeFromBaseAttributes();
|
|
5937
|
+
const keys = this.collectStatePatchDeltaKeys(previousPatch, nextPatch),
|
|
5938
|
+
finalAttribute = this.finalAttribute;
|
|
5939
|
+
finalAttribute && this.syncStatePatchDeltaToTarget(finalAttribute, keys, nextPatch, !1);
|
|
5940
|
+
const category = this.syncStatePatchDeltaToTarget(this.attribute, keys, nextPatch, !0);
|
|
5941
|
+
this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, this.submitUpdateByCategory(category), this.onAttributeUpdate(context);
|
|
5942
|
+
}
|
|
5694
5943
|
setMode(mode) {
|
|
5695
5944
|
"3d" === mode ? this.set3dMode() : this.set2dMode();
|
|
5696
5945
|
}
|
|
@@ -5713,7 +5962,7 @@ class Graphic extends Node {
|
|
|
5713
5962
|
return point;
|
|
5714
5963
|
}
|
|
5715
5964
|
onAnimateBind(animate) {
|
|
5716
|
-
this._emitCustomEvent("animate-bind", animate);
|
|
5965
|
+
this.detachAttributeFromBaseAttributes(), this._emitCustomEvent("animate-bind", animate);
|
|
5717
5966
|
}
|
|
5718
5967
|
visitTrackedAnimates(cb) {
|
|
5719
5968
|
const hook = this.forEachTrackedAnimate;
|
|
@@ -5726,8 +5975,22 @@ class Graphic extends Node {
|
|
|
5726
5975
|
const getTrackedAnimates = this.getTrackedAnimates;
|
|
5727
5976
|
return "function" == typeof getTrackedAnimates ? getTrackedAnimates.call(this).size > 0 : !!(null === (_a = this.animates) || void 0 === _a ? void 0 : _a.size);
|
|
5728
5977
|
}
|
|
5978
|
+
mayHaveTrackedAnimates() {
|
|
5979
|
+
var _a;
|
|
5980
|
+
return !!(null === (_a = this.animates) || void 0 === _a ? void 0 : _a.size) || !!this._animationStateManager;
|
|
5981
|
+
}
|
|
5729
5982
|
tryUpdateAABBBounds() {
|
|
5983
|
+
if (!(this.shadowRoot || this._updateTag & UpdateTag.UPDATE_BOUNDS)) return this._AABBBounds;
|
|
5730
5984
|
const full = "imprecise" === this.attribute.boundsMode;
|
|
5985
|
+
if (!this.shadowRoot) {
|
|
5986
|
+
const graphicService = this.getGraphicService(),
|
|
5987
|
+
graphicTheme = this.getGraphicTheme();
|
|
5988
|
+
if (!graphicService.validCheck(this.attribute, graphicTheme, this._AABBBounds, this)) return this._AABBBounds;
|
|
5989
|
+
if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
|
|
5990
|
+
graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
5991
|
+
const bounds = this.doUpdateAABBBounds(full, graphicTheme);
|
|
5992
|
+
return graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
5993
|
+
}
|
|
5731
5994
|
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
5732
5995
|
if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
|
|
5733
5996
|
this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
@@ -5800,14 +6063,14 @@ class Graphic extends Node {
|
|
|
5800
6063
|
const _parsedPath = new CustomSymbolClass(symbolType, cache);
|
|
5801
6064
|
return Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
|
|
5802
6065
|
}
|
|
5803
|
-
doUpdateAABBBounds(full) {
|
|
6066
|
+
doUpdateAABBBounds(full, graphicTheme) {
|
|
5804
6067
|
this.updateAABBBoundsStamp++;
|
|
5805
|
-
const
|
|
6068
|
+
const resolvedGraphicTheme = null != graphicTheme ? graphicTheme : this.getGraphicTheme();
|
|
5806
6069
|
this._AABBBounds.clear();
|
|
5807
6070
|
const attribute = this.attribute,
|
|
5808
|
-
bounds = this.updateAABBBounds(attribute,
|
|
6071
|
+
bounds = this.updateAABBBounds(attribute, resolvedGraphicTheme, this._AABBBounds, full),
|
|
5809
6072
|
{
|
|
5810
|
-
boundsPadding =
|
|
6073
|
+
boundsPadding = resolvedGraphicTheme.boundsPadding
|
|
5811
6074
|
} = attribute,
|
|
5812
6075
|
paddingArray = parsePadding(boundsPadding);
|
|
5813
6076
|
return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
|
|
@@ -5916,18 +6179,22 @@ class Graphic extends Node {
|
|
|
5916
6179
|
return fromAttrs;
|
|
5917
6180
|
}
|
|
5918
6181
|
setAttributes(params, forceUpdateTag = !1, context) {
|
|
5919
|
-
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));
|
|
6182
|
+
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));
|
|
5920
6183
|
}
|
|
5921
6184
|
_setAttributes(params, forceUpdateTag = !1, context) {
|
|
5922
|
-
this.applyBaseAttributes(params), this.commitBaseAttributeMutation(forceUpdateTag, context);
|
|
6185
|
+
this.canCommitBaseAttributesByTouchedKeys() ? this.commitBaseAttributesByTouchedKeys(params, forceUpdateTag, context) : (this.detachAttributeFromBaseAttributes(), this.applyBaseAttributes(params), this.commitBaseAttributeMutation(forceUpdateTag, context));
|
|
5923
6186
|
}
|
|
5924
6187
|
setAttribute(key, value, forceUpdateTag, context) {
|
|
5925
6188
|
const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
|
|
5926
6189
|
[key]: value
|
|
5927
6190
|
}, this.attribute, key, context);
|
|
5928
|
-
params
|
|
5929
|
-
|
|
5930
|
-
|
|
6191
|
+
if (params) this._setAttributes(params, forceUpdateTag, context);else if (this.canCommitBaseAttributesByTouchedKeys()) this.commitBaseAttributeBySingleKey(key, value, !!forceUpdateTag, context);else {
|
|
6192
|
+
const nextAttrs = {
|
|
6193
|
+
[key]: value
|
|
6194
|
+
};
|
|
6195
|
+
this.applyBaseAttributes(nextAttrs), this.commitBaseAttributeMutation(!!forceUpdateTag, context);
|
|
6196
|
+
}
|
|
6197
|
+
"background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
|
|
5931
6198
|
}
|
|
5932
6199
|
needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
|
|
5933
6200
|
for (let i = 0; i < k.length; i++) {
|
|
@@ -5946,7 +6213,7 @@ class Graphic extends Node {
|
|
|
5946
6213
|
const context = {
|
|
5947
6214
|
type: AttributeUpdateType.INIT
|
|
5948
6215
|
};
|
|
5949
|
-
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.
|
|
6216
|
+
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);
|
|
5950
6217
|
}
|
|
5951
6218
|
translate(x, y) {
|
|
5952
6219
|
var _a, _b;
|
|
@@ -5958,10 +6225,15 @@ class Graphic extends Node {
|
|
|
5958
6225
|
x: x,
|
|
5959
6226
|
y: y
|
|
5960
6227
|
}, this.attribute, tempConstantXYKey, context);
|
|
5961
|
-
params && (x = params.x, y = params.y, delete params.x, delete params.y
|
|
6228
|
+
params && (x = params.x, y = params.y, delete params.x, delete params.y);
|
|
5962
6229
|
const attribute = this.baseAttributes,
|
|
5963
|
-
postMatrix = attribute.postMatrix
|
|
5964
|
-
|
|
6230
|
+
postMatrix = attribute.postMatrix,
|
|
6231
|
+
nextAttrs = params || {};
|
|
6232
|
+
if (postMatrix) {
|
|
6233
|
+
const nextPostMatrix = postMatrix.clone();
|
|
6234
|
+
application.transformUtil.fromMatrix(nextPostMatrix, nextPostMatrix).translate(x, y), nextAttrs.postMatrix = nextPostMatrix;
|
|
6235
|
+
} 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;
|
|
6236
|
+
return this.commitInternalBaseAttributes(nextAttrs, context), this;
|
|
5965
6237
|
}
|
|
5966
6238
|
translateTo(x, y) {
|
|
5967
6239
|
const attribute = this.baseAttributes;
|
|
@@ -5973,7 +6245,10 @@ class Graphic extends Node {
|
|
|
5973
6245
|
x: x,
|
|
5974
6246
|
y: y
|
|
5975
6247
|
}, this.attribute, tempConstantXYKey, context);
|
|
5976
|
-
return params ? (this.
|
|
6248
|
+
return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
|
|
6249
|
+
x: x,
|
|
6250
|
+
y: y
|
|
6251
|
+
}, context), this);
|
|
5977
6252
|
}
|
|
5978
6253
|
scale(scaleX, scaleY, scaleCenter) {
|
|
5979
6254
|
var _a, _b;
|
|
@@ -5986,15 +6261,16 @@ class Graphic extends Node {
|
|
|
5986
6261
|
scaleY: scaleY,
|
|
5987
6262
|
scaleCenter: scaleCenter
|
|
5988
6263
|
}, this.attribute, tempConstantScaleXYKey, context);
|
|
5989
|
-
params && (scaleX = params.scaleX, scaleY = params.scaleY, delete params.scaleX, delete params.scaleY
|
|
5990
|
-
const attribute = this.baseAttributes
|
|
6264
|
+
params && (scaleX = params.scaleX, scaleY = params.scaleY, delete params.scaleX, delete params.scaleY);
|
|
6265
|
+
const attribute = this.baseAttributes,
|
|
6266
|
+
nextAttrs = params || {};
|
|
5991
6267
|
if (scaleCenter) {
|
|
5992
6268
|
let {
|
|
5993
6269
|
postMatrix: postMatrix
|
|
5994
|
-
} = this.
|
|
5995
|
-
postMatrix
|
|
5996
|
-
} else
|
|
5997
|
-
return this.
|
|
6270
|
+
} = this.baseAttributes;
|
|
6271
|
+
postMatrix = postMatrix ? postMatrix.clone() : new Matrix(), application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter), nextAttrs.postMatrix = postMatrix;
|
|
6272
|
+
} 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;
|
|
6273
|
+
return this.commitInternalBaseAttributes(nextAttrs, context), this;
|
|
5998
6274
|
}
|
|
5999
6275
|
scaleTo(scaleX, scaleY) {
|
|
6000
6276
|
const attribute = this.baseAttributes;
|
|
@@ -6006,7 +6282,10 @@ class Graphic extends Node {
|
|
|
6006
6282
|
scaleX: scaleX,
|
|
6007
6283
|
scaleY: scaleY
|
|
6008
6284
|
}, this.attribute, tempConstantScaleXYKey, context);
|
|
6009
|
-
return params ? (this.
|
|
6285
|
+
return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
|
|
6286
|
+
scaleX: scaleX,
|
|
6287
|
+
scaleY: scaleY
|
|
6288
|
+
}, context), this);
|
|
6010
6289
|
}
|
|
6011
6290
|
rotate(angle, rotateCenter) {
|
|
6012
6291
|
var _a;
|
|
@@ -6018,24 +6297,26 @@ class Graphic extends Node {
|
|
|
6018
6297
|
angle: angle,
|
|
6019
6298
|
rotateCenter: rotateCenter
|
|
6020
6299
|
}, this.attribute, tempConstantAngleKey, context);
|
|
6021
|
-
params &&
|
|
6022
|
-
const attribute = this.baseAttributes
|
|
6300
|
+
params && delete params.angle;
|
|
6301
|
+
const attribute = this.baseAttributes,
|
|
6302
|
+
nextAttrs = params || {};
|
|
6023
6303
|
if (rotateCenter) {
|
|
6024
6304
|
let {
|
|
6025
6305
|
postMatrix: postMatrix
|
|
6026
6306
|
} = this.baseAttributes;
|
|
6027
|
-
postMatrix
|
|
6028
|
-
} else
|
|
6029
|
-
return this.
|
|
6307
|
+
postMatrix = postMatrix ? postMatrix.clone() : new Matrix(), application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter), nextAttrs.postMatrix = postMatrix;
|
|
6308
|
+
} else nextAttrs.angle = (null !== (_a = attribute.angle) && void 0 !== _a ? _a : DefaultTransform.angle) + angle;
|
|
6309
|
+
return this.commitInternalBaseAttributes(nextAttrs, context), this;
|
|
6030
6310
|
}
|
|
6031
6311
|
rotateTo(angle) {
|
|
6032
|
-
|
|
6033
|
-
if (attribute.angle === angle) return this;
|
|
6312
|
+
if (this.baseAttributes.angle === angle) return this;
|
|
6034
6313
|
const context = {
|
|
6035
6314
|
type: AttributeUpdateType.ROTATE_TO
|
|
6036
6315
|
},
|
|
6037
6316
|
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(angle, this.attribute, tempConstantAngleKey, context);
|
|
6038
|
-
return params ? (this.
|
|
6317
|
+
return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
|
|
6318
|
+
angle: angle
|
|
6319
|
+
}, context), this);
|
|
6039
6320
|
}
|
|
6040
6321
|
skewTo(b, c) {
|
|
6041
6322
|
return this;
|
|
@@ -6074,6 +6355,131 @@ class Graphic extends Node {
|
|
|
6074
6355
|
stateEngine: this.stateEngine
|
|
6075
6356
|
});
|
|
6076
6357
|
}
|
|
6358
|
+
resolveSimpleLocalStateTransition(states, previousStates) {
|
|
6359
|
+
var _a;
|
|
6360
|
+
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;
|
|
6361
|
+
if (1 === states.length) {
|
|
6362
|
+
const stateName = states[0],
|
|
6363
|
+
hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName),
|
|
6364
|
+
nextStates = [stateName],
|
|
6365
|
+
changed = !this.sameStateNames(previousStates, nextStates),
|
|
6366
|
+
resolvedStateAttrs = {};
|
|
6367
|
+
if (hasDefinition) {
|
|
6368
|
+
const attrs = this.states[stateName];
|
|
6369
|
+
if (null != attrs) {
|
|
6370
|
+
if (!isPlainObjectValue(attrs)) return null;
|
|
6371
|
+
const keys = Object.keys(attrs);
|
|
6372
|
+
for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
|
|
6373
|
+
const key = keys[keyIndex];
|
|
6374
|
+
if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
|
|
6375
|
+
const attrValue = attrs[key];
|
|
6376
|
+
resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
|
|
6377
|
+
}
|
|
6378
|
+
}
|
|
6379
|
+
}
|
|
6380
|
+
return {
|
|
6381
|
+
changed: changed,
|
|
6382
|
+
states: nextStates,
|
|
6383
|
+
effectiveStates: nextStates,
|
|
6384
|
+
resolvedStateAttrs: resolvedStateAttrs
|
|
6385
|
+
};
|
|
6386
|
+
}
|
|
6387
|
+
const uniqueStates = Array.from(new Set(states)),
|
|
6388
|
+
withDefinition = [],
|
|
6389
|
+
withoutDefinition = [];
|
|
6390
|
+
for (let i = 0; i < uniqueStates.length; i++) {
|
|
6391
|
+
const stateName = uniqueStates[i];
|
|
6392
|
+
Object.prototype.hasOwnProperty.call(this.states, stateName) ? withDefinition.push(stateName) : withoutDefinition.push(stateName);
|
|
6393
|
+
}
|
|
6394
|
+
withDefinition.sort((left, right) => left.localeCompare(right));
|
|
6395
|
+
const nextStates = withDefinition.concat(withoutDefinition),
|
|
6396
|
+
changed = !this.sameStateNames(previousStates, nextStates),
|
|
6397
|
+
resolvedStateAttrs = {};
|
|
6398
|
+
for (let i = 0; i < nextStates.length; i++) {
|
|
6399
|
+
const stateName = nextStates[i];
|
|
6400
|
+
if (!Object.prototype.hasOwnProperty.call(this.states, stateName)) continue;
|
|
6401
|
+
const attrs = this.states[stateName];
|
|
6402
|
+
if (null == attrs) continue;
|
|
6403
|
+
if (!isPlainObjectValue(attrs)) return null;
|
|
6404
|
+
const keys = Object.keys(attrs);
|
|
6405
|
+
for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
|
|
6406
|
+
const key = keys[keyIndex];
|
|
6407
|
+
if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
|
|
6408
|
+
const attrValue = attrs[key];
|
|
6409
|
+
resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
|
|
6410
|
+
}
|
|
6411
|
+
}
|
|
6412
|
+
return {
|
|
6413
|
+
changed: changed,
|
|
6414
|
+
states: nextStates,
|
|
6415
|
+
effectiveStates: nextStates,
|
|
6416
|
+
resolvedStateAttrs: resolvedStateAttrs
|
|
6417
|
+
};
|
|
6418
|
+
}
|
|
6419
|
+
resolveGraphicStateTransition(states, previousStates, forceResolverRefresh = !1) {
|
|
6420
|
+
var _a, _b, _c, _d;
|
|
6421
|
+
let transition = this.resolveSimpleLocalStateTransition(states, previousStates);
|
|
6422
|
+
const isSimpleLocalTransition = !!transition;
|
|
6423
|
+
let resolvedStateAttrs;
|
|
6424
|
+
if (transition) resolvedStateAttrs = transition.resolvedStateAttrs;else {
|
|
6425
|
+
const stateResolveBaseAttrs = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute,
|
|
6426
|
+
stateModel = this.createStateModel();
|
|
6427
|
+
null === (_b = this.stateEngine) || void 0 === _b || _b.setResolveContext(this, stateResolveBaseAttrs), forceResolverRefresh && (null === (_c = this.stateEngine) || void 0 === _c || _c.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);
|
|
6428
|
+
}
|
|
6429
|
+
return {
|
|
6430
|
+
transition: transition,
|
|
6431
|
+
effectiveStates: null !== (_d = transition.effectiveStates) && void 0 !== _d ? _d : transition.states,
|
|
6432
|
+
resolvedStateAttrs: resolvedStateAttrs,
|
|
6433
|
+
isSimpleLocalTransition: isSimpleLocalTransition
|
|
6434
|
+
};
|
|
6435
|
+
}
|
|
6436
|
+
normalizeSetStatesOptions(options) {
|
|
6437
|
+
return options && "object" == typeof options ? {
|
|
6438
|
+
hasAnimation: options.animate,
|
|
6439
|
+
animateSameStatePatchChange: !0 === options.animateSameStatePatchChange,
|
|
6440
|
+
shouldRefreshSameStatePatch: !0
|
|
6441
|
+
} : {
|
|
6442
|
+
hasAnimation: "boolean" == typeof options ? options : void 0,
|
|
6443
|
+
animateSameStatePatchChange: !1,
|
|
6444
|
+
shouldRefreshSameStatePatch: !1
|
|
6445
|
+
};
|
|
6446
|
+
}
|
|
6447
|
+
sameStatePatches(left, right) {
|
|
6448
|
+
const leftRecord = null != left ? left : {},
|
|
6449
|
+
rightRecord = null != right ? right : {},
|
|
6450
|
+
keys = new Set([...Object.keys(leftRecord), ...Object.keys(rightRecord)]);
|
|
6451
|
+
for (const key of keys) {
|
|
6452
|
+
if (Object.prototype.hasOwnProperty.call(leftRecord, key) !== Object.prototype.hasOwnProperty.call(rightRecord, key)) return !1;
|
|
6453
|
+
if (!areAttributeValuesEqual(leftRecord[key], rightRecord[key])) return !1;
|
|
6454
|
+
}
|
|
6455
|
+
return !0;
|
|
6456
|
+
}
|
|
6457
|
+
commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = !1) {
|
|
6458
|
+
var _a;
|
|
6459
|
+
const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
|
|
6460
|
+
previousResolvedStatePatch = this.resolvedStatePatch,
|
|
6461
|
+
{
|
|
6462
|
+
transition: transition,
|
|
6463
|
+
effectiveStates: effectiveStates,
|
|
6464
|
+
resolvedStateAttrs: resolvedStateAttrs,
|
|
6465
|
+
isSimpleLocalTransition: isSimpleLocalTransition
|
|
6466
|
+
} = this.resolveGraphicStateTransition(states, previousStates, !0),
|
|
6467
|
+
patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
|
|
6468
|
+
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)) {
|
|
6469
|
+
if (this.stage) {
|
|
6470
|
+
const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
|
|
6471
|
+
null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
|
|
6472
|
+
graphicId: this._uid,
|
|
6473
|
+
targetStates: [...transition.states]
|
|
6474
|
+
});
|
|
6475
|
+
}
|
|
6476
|
+
hasAnimation && animateSameStatePatchChange ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
6477
|
+
type: AttributeUpdateType.STATE
|
|
6478
|
+
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
6479
|
+
type: AttributeUpdateType.STATE
|
|
6480
|
+
}), this.emitStateUpdateEvent());
|
|
6481
|
+
}
|
|
6482
|
+
}
|
|
6077
6483
|
resolveStateAnimateConfig(animateConfig) {
|
|
6078
6484
|
var _a, _b, _c;
|
|
6079
6485
|
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;
|
|
@@ -6094,9 +6500,7 @@ class Graphic extends Node {
|
|
|
6094
6500
|
});
|
|
6095
6501
|
this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
|
|
6096
6502
|
}
|
|
6097
|
-
updateNormalAttrs(
|
|
6098
|
-
this._deprecatedNormalAttrsView = cloneAttributeValue(this.baseAttributes);
|
|
6099
|
-
}
|
|
6503
|
+
updateNormalAttrs(_stateAttrs) {}
|
|
6100
6504
|
getStateTransitionDefaultAttribute(key, targetAttrs) {
|
|
6101
6505
|
return this.getDefaultAttribute(key);
|
|
6102
6506
|
}
|
|
@@ -6106,6 +6510,7 @@ class Graphic extends Node {
|
|
|
6106
6510
|
stopStateAnimates(type = "end") {
|
|
6107
6511
|
const stopAnimationState = this.stopAnimationState;
|
|
6108
6512
|
if ("function" == typeof stopAnimationState) return void stopAnimationState.call(this, "state", type);
|
|
6513
|
+
if (!this.mayHaveTrackedAnimates()) return;
|
|
6109
6514
|
const stateAnimates = [];
|
|
6110
6515
|
this.visitTrackedAnimates(animate => {
|
|
6111
6516
|
animate.stateNames && stateAnimates.push(animate);
|
|
@@ -6118,19 +6523,25 @@ class Graphic extends Node {
|
|
|
6118
6523
|
}
|
|
6119
6524
|
clearStates(hasAnimation) {
|
|
6120
6525
|
var _a, _b, _c;
|
|
6121
|
-
const previousStates =
|
|
6122
|
-
previousResolvedStatePatch = this.resolvedStatePatch
|
|
6526
|
+
const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
|
|
6527
|
+
previousResolvedStatePatch = this.resolvedStatePatch,
|
|
6123
6528
|
transition = this.createStateModel().clearStates();
|
|
6124
6529
|
if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
|
|
6125
|
-
const resolvedStateAttrs = cloneAttributeValue(null !== (
|
|
6126
|
-
transition.changed
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6530
|
+
const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
|
|
6531
|
+
if (!transition.changed || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0)) {
|
|
6532
|
+
if (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(), this.stage) {
|
|
6533
|
+
const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
|
|
6534
|
+
null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
|
|
6535
|
+
graphicId: this._uid,
|
|
6536
|
+
targetStates: []
|
|
6537
|
+
});
|
|
6538
|
+
}
|
|
6539
|
+
hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
6540
|
+
type: AttributeUpdateType.STATE
|
|
6541
|
+
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
|
|
6542
|
+
type: AttributeUpdateType.STATE
|
|
6543
|
+
}), this.emitStateUpdateEvent());
|
|
6544
|
+
}
|
|
6134
6545
|
}
|
|
6135
6546
|
removeState(stateName, hasAnimation) {
|
|
6136
6547
|
const transition = this.createStateModel().removeState(stateName);
|
|
@@ -6144,39 +6555,59 @@ class Graphic extends Node {
|
|
|
6144
6555
|
const transition = this.createStateModel().addState(stateName, keepCurrentStates);
|
|
6145
6556
|
transition.changed && this.useStates(transition.states, hasAnimation);
|
|
6146
6557
|
}
|
|
6558
|
+
setStates(states, options) {
|
|
6559
|
+
var _a, _b, _c;
|
|
6560
|
+
const {
|
|
6561
|
+
hasAnimation: hasAnimation,
|
|
6562
|
+
animateSameStatePatchChange: animateSameStatePatchChange,
|
|
6563
|
+
shouldRefreshSameStatePatch: shouldRefreshSameStatePatch
|
|
6564
|
+
} = this.normalizeSetStatesOptions(options),
|
|
6565
|
+
nextStates = (null == states ? void 0 : states.length) ? states : EMPTY_STATE_NAMES,
|
|
6566
|
+
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));
|
|
6567
|
+
if (nextStates.length) {
|
|
6568
|
+
if (this.sameStateNames(this.currentStates, nextStates)) return shouldRefreshSameStatePatch ? void this.commitSameStatePatchRefresh(nextStates, hasAnimation, animateSameStatePatchChange) : void (this.sharedStateDirty && this.refreshSharedStateBeforeRender());
|
|
6569
|
+
this.useStates(nextStates, hasAnimation);
|
|
6570
|
+
} else {
|
|
6571
|
+
if (!hasCurrentState && !this.sharedStateDirty) return;
|
|
6572
|
+
this.clearStates(hasAnimation);
|
|
6573
|
+
}
|
|
6574
|
+
}
|
|
6147
6575
|
useStates(states, hasAnimation) {
|
|
6148
|
-
var _a
|
|
6576
|
+
var _a;
|
|
6149
6577
|
if (!states.length) return void this.clearStates(hasAnimation);
|
|
6150
|
-
const previousStates =
|
|
6151
|
-
previousResolvedStatePatch = this.resolvedStatePatch
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6578
|
+
const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
|
|
6579
|
+
previousResolvedStatePatch = this.resolvedStatePatch,
|
|
6580
|
+
{
|
|
6581
|
+
transition: transition,
|
|
6582
|
+
effectiveStates: effectiveStates,
|
|
6583
|
+
resolvedStateAttrs: resolvedStateAttrs,
|
|
6584
|
+
isSimpleLocalTransition: isSimpleLocalTransition
|
|
6585
|
+
} = this.resolveGraphicStateTransition(states, previousStates);
|
|
6586
|
+
if ((transition.changed || !this.sameStateNames(previousStates, transition.states)) && this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) {
|
|
6587
|
+
if (this.currentStates = transition.states, this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stage) {
|
|
6588
|
+
const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
|
|
6589
|
+
null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
|
|
6590
|
+
graphicId: this._uid,
|
|
6591
|
+
targetStates: [...transition.states]
|
|
6592
|
+
});
|
|
6593
|
+
}
|
|
6594
|
+
hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
6595
|
+
type: AttributeUpdateType.STATE
|
|
6596
|
+
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
6597
|
+
type: AttributeUpdateType.STATE
|
|
6598
|
+
}), this.emitStateUpdateEvent());
|
|
6599
|
+
}
|
|
6167
6600
|
}
|
|
6168
6601
|
invalidateResolver() {
|
|
6169
|
-
var _a, _b;
|
|
6602
|
+
var _a, _b, _c;
|
|
6170
6603
|
if (!this.stateEngine || !(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.compiledStateDefinitions) return;
|
|
6171
6604
|
const stateResolveBaseAttrs = null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : this.attribute;
|
|
6172
|
-
this.stateEngine.setResolveContext(this, stateResolveBaseAttrs), this.resolverEpoch
|
|
6605
|
+
this.stateEngine.setResolveContext(this, stateResolveBaseAttrs), this.resolverEpoch = (null !== (_c = this.resolverEpoch) && void 0 !== _c ? _c : 0) + 1, this.stateEngine.invalidateResolverCache();
|
|
6173
6606
|
const transition = this.stateEngine.applyStates(this.currentStates),
|
|
6174
6607
|
resolvedStateAttrs = Object.assign({}, this.stateEngine.resolvedPatch);
|
|
6175
|
-
this.effectiveStates = [...transition.effectiveStates], this.resolvedStatePatch =
|
|
6176
|
-
type: AttributeUpdateType.STATE
|
|
6177
|
-
}), this._emitCustomEvent("afterStateUpdate", {
|
|
6608
|
+
this.effectiveStates = [...transition.effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
|
|
6178
6609
|
type: AttributeUpdateType.STATE
|
|
6179
|
-
});
|
|
6610
|
+
}), this.emitStateUpdateEvent();
|
|
6180
6611
|
}
|
|
6181
6612
|
sameStateNames(left, right) {
|
|
6182
6613
|
const normalizedLeft = null != left ? left : [],
|
|
@@ -6197,6 +6628,9 @@ class Graphic extends Node {
|
|
|
6197
6628
|
addUpdateShapeAndBoundsTag() {
|
|
6198
6629
|
this._updateTag |= UpdateTag.UPDATE_SHAPE_AND_BOUNDS, this.parent && this.parent.addChildUpdateBoundTag(), this.glyphHost && this.glyphHost.addUpdateBoundTag();
|
|
6199
6630
|
}
|
|
6631
|
+
addBroadUpdateTag() {
|
|
6632
|
+
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();
|
|
6633
|
+
}
|
|
6200
6634
|
updateShapeAndBoundsTagSetted() {
|
|
6201
6635
|
return (this._updateTag & UpdateTag.UPDATE_SHAPE_AND_BOUNDS) === UpdateTag.UPDATE_SHAPE_AND_BOUNDS;
|
|
6202
6636
|
}
|
|
@@ -6284,13 +6718,13 @@ class Graphic extends Node {
|
|
|
6284
6718
|
}
|
|
6285
6719
|
}
|
|
6286
6720
|
setStage(stage, layer) {
|
|
6287
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6721
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
6288
6722
|
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,
|
|
6289
6723
|
previousStage = this.stage;
|
|
6290
6724
|
if (this.stage !== stage || this.layer !== layer) {
|
|
6291
|
-
if (this.stage = stage, this.layer = layer,
|
|
6292
|
-
const previousTimeline = null === (
|
|
6293
|
-
nextTimeline = null === (
|
|
6725
|
+
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()) {
|
|
6726
|
+
const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
|
|
6727
|
+
nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
|
|
6294
6728
|
detachedStageAnimates = [];
|
|
6295
6729
|
this.visitTrackedAnimates(a => {
|
|
6296
6730
|
(!!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)));
|
|
@@ -6303,9 +6737,13 @@ class Graphic extends Node {
|
|
|
6303
6737
|
type: AttributeUpdateType.ANIMATE_END
|
|
6304
6738
|
}));
|
|
6305
6739
|
}
|
|
6306
|
-
return this._onSetStage && this._onSetStage(this, stage, layer), void (null === (
|
|
6740
|
+
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));
|
|
6307
6741
|
}
|
|
6308
|
-
|
|
6742
|
+
((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);
|
|
6743
|
+
}
|
|
6744
|
+
detachStageForRelease() {
|
|
6745
|
+
var _a, _b, _c;
|
|
6746
|
+
(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));
|
|
6309
6747
|
}
|
|
6310
6748
|
setStageToShadowRoot(stage, layer) {
|
|
6311
6749
|
this.shadowRoot && this.shadowRoot.setStage(stage, layer);
|
|
@@ -6372,6 +6810,7 @@ class Graphic extends Node {
|
|
|
6372
6810
|
res && (res.state = "fail", cb && cb());
|
|
6373
6811
|
}
|
|
6374
6812
|
_stopAnimates() {
|
|
6813
|
+
if (!this.mayHaveTrackedAnimates()) return;
|
|
6375
6814
|
const animates = [];
|
|
6376
6815
|
this.visitTrackedAnimates(animate => {
|
|
6377
6816
|
animates.push(animate);
|
|
@@ -6385,14 +6824,17 @@ class Graphic extends Node {
|
|
|
6385
6824
|
});
|
|
6386
6825
|
}
|
|
6387
6826
|
release() {
|
|
6388
|
-
var _a, _b, _c;
|
|
6389
|
-
this.releaseStatus = "released", this.clearSharedStateActiveRegistrations(), this.stopAnimates();
|
|
6390
|
-
const graphicService = null !== (
|
|
6391
|
-
null === (
|
|
6827
|
+
var _a, _b, _c, _d;
|
|
6828
|
+
this.releaseStatus = "released", (null === (_a = this.registeredActiveScopes) || void 0 === _a ? void 0 : _a.size) && this.clearSharedStateActiveRegistrations(), (this.mayHaveTrackedAnimates() || this.shadowRoot) && this.stopAnimates();
|
|
6829
|
+
const graphicService = null !== (_c = null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService;
|
|
6830
|
+
null === (_d = null == graphicService ? void 0 : graphicService.onRelease) || void 0 === _d || _d.call(graphicService, this), super.release();
|
|
6831
|
+
}
|
|
6832
|
+
hasCustomEvent(type) {
|
|
6833
|
+
return !!this._events && type in this._events;
|
|
6392
6834
|
}
|
|
6393
6835
|
_dispatchCustomEvent(type, context) {
|
|
6394
6836
|
var _a, _b;
|
|
6395
|
-
if (this.
|
|
6837
|
+
if (this.hasCustomEvent(type)) {
|
|
6396
6838
|
const changeEvent = new CustomEvent(type, context);
|
|
6397
6839
|
changeEvent.bubbles = !1;
|
|
6398
6840
|
const manager = null === (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem) || void 0 === _b ? void 0 : _b.manager;
|
|
@@ -6401,7 +6843,7 @@ class Graphic extends Node {
|
|
|
6401
6843
|
return !0;
|
|
6402
6844
|
}
|
|
6403
6845
|
beforeStateUpdate(attrs, prevStates, nextStates, hasAnimation, isClear) {
|
|
6404
|
-
return this._dispatchCustomEvent("beforeStateUpdate", {
|
|
6846
|
+
return !this.hasCustomEvent("beforeStateUpdate") || this._dispatchCustomEvent("beforeStateUpdate", {
|
|
6405
6847
|
type: AttributeUpdateType.STATE,
|
|
6406
6848
|
attrs: Object.assign({}, attrs),
|
|
6407
6849
|
prevStates: prevStates.slice(),
|
|
@@ -6410,6 +6852,11 @@ class Graphic extends Node {
|
|
|
6410
6852
|
isClear: !!isClear
|
|
6411
6853
|
});
|
|
6412
6854
|
}
|
|
6855
|
+
emitStateUpdateEvent() {
|
|
6856
|
+
this.hasCustomEvent("afterStateUpdate") && this._emitCustomEvent("afterStateUpdate", {
|
|
6857
|
+
type: AttributeUpdateType.STATE
|
|
6858
|
+
});
|
|
6859
|
+
}
|
|
6413
6860
|
_emitCustomEvent(type, context) {
|
|
6414
6861
|
this._dispatchCustomEvent(type, context);
|
|
6415
6862
|
}
|
|
@@ -9096,13 +9543,15 @@ var GroupUpdateAABBBoundsMode;
|
|
|
9096
9543
|
}(GroupUpdateAABBBoundsMode || (GroupUpdateAABBBoundsMode = {}));
|
|
9097
9544
|
class Group extends Graphic {
|
|
9098
9545
|
constructor(params) {
|
|
9099
|
-
super(params), this.type = "group", this.parent = null, this.isContainer = !0, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
|
|
9546
|
+
super(params), this.type = "group", this.parent = null, this.isContainer = !0, this._hasSharedStateDefinitions = !1, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
|
|
9100
9547
|
}
|
|
9101
9548
|
get sharedStateDefinitions() {
|
|
9102
9549
|
return this._sharedStateDefinitions;
|
|
9103
9550
|
}
|
|
9104
9551
|
set sharedStateDefinitions(value) {
|
|
9105
|
-
|
|
9552
|
+
if (this._sharedStateDefinitions === value) return;
|
|
9553
|
+
const previousScope = this.sharedStateScope;
|
|
9554
|
+
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();
|
|
9106
9555
|
}
|
|
9107
9556
|
setMode(mode) {
|
|
9108
9557
|
"3d" === mode ? this.set3dMode() : this.set2dMode();
|
|
@@ -9227,9 +9676,10 @@ class Group extends Graphic {
|
|
|
9227
9676
|
insertInto(newNode, idx) {
|
|
9228
9677
|
return this._updateChildToStage(super.insertInto(newNode, idx));
|
|
9229
9678
|
}
|
|
9230
|
-
removeChild(child) {
|
|
9679
|
+
removeChild(child, highPerformance = !1) {
|
|
9680
|
+
var _a;
|
|
9231
9681
|
const data = super.removeChild(child);
|
|
9232
|
-
return this.getGraphicService().onRemove(child), child.setStage(null, null), this.addUpdateBoundTag(), data;
|
|
9682
|
+
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;
|
|
9233
9683
|
}
|
|
9234
9684
|
removeAllChild(deep = !1) {
|
|
9235
9685
|
const children = this.children.slice();
|
|
@@ -9241,11 +9691,13 @@ class Group extends Graphic {
|
|
|
9241
9691
|
}
|
|
9242
9692
|
setStage(stage, layer) {
|
|
9243
9693
|
var _a, _b, _c, _d, _e, _f;
|
|
9244
|
-
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
|
|
9245
|
-
|
|
9694
|
+
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,
|
|
9695
|
+
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;
|
|
9696
|
+
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 => {
|
|
9246
9697
|
item.setStage(stage, this.layer);
|
|
9247
9698
|
});
|
|
9248
|
-
|
|
9699
|
+
const layerChanged = this.layer !== layer;
|
|
9700
|
+
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.forEachChildren(item => {
|
|
9249
9701
|
item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(stage, this.layer);
|
|
9250
9702
|
});
|
|
9251
9703
|
}
|
|
@@ -9292,15 +9744,29 @@ class Group extends Graphic {
|
|
|
9292
9744
|
g.release(all);
|
|
9293
9745
|
}), super.release();
|
|
9294
9746
|
}
|
|
9747
|
+
detachStageForRelease() {
|
|
9748
|
+
super.detachStageForRelease(), this.sharedStateScope = void 0, this.forEachChildren(item => {
|
|
9749
|
+
var _a;
|
|
9750
|
+
null === (_a = item.detachStageForRelease) || void 0 === _a || _a.call(item);
|
|
9751
|
+
});
|
|
9752
|
+
}
|
|
9295
9753
|
ensureSharedStateScopeBound() {
|
|
9296
9754
|
var _a, _b, _c;
|
|
9755
|
+
if (!this.hasSharedStateDefinitions()) return void (this.sharedStateScope = void 0);
|
|
9297
9756
|
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;
|
|
9298
9757
|
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);
|
|
9299
9758
|
}
|
|
9759
|
+
hasSharedStateDefinitions() {
|
|
9760
|
+
return this._hasSharedStateDefinitions;
|
|
9761
|
+
}
|
|
9762
|
+
notifyChildrenSharedStateTreeChanged() {
|
|
9763
|
+
this.forEachChildren(item => {
|
|
9764
|
+
item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(this.stage, this.layer);
|
|
9765
|
+
});
|
|
9766
|
+
}
|
|
9300
9767
|
onParentSharedStateTreeChanged(stage, layer) {
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
})) : this.setStage(stage, layer);
|
|
9768
|
+
var _a;
|
|
9769
|
+
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);
|
|
9304
9770
|
}
|
|
9305
9771
|
}
|
|
9306
9772
|
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
@@ -9488,7 +9954,10 @@ class DefaultGraphicService {
|
|
|
9488
9954
|
beforeUpdateAABBBounds: new SyncHook(["graphic", "stage", "willUpdate", "aabbBounds"]),
|
|
9489
9955
|
afterUpdateAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds", "globalAABBBounds", "selfChange"]),
|
|
9490
9956
|
clearAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds"])
|
|
9491
|
-
}, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds()
|
|
9957
|
+
}, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds(), this.tempAABBBoundsResult = {
|
|
9958
|
+
tb1: this.tempAABBBounds1,
|
|
9959
|
+
tb2: this.tempAABBBounds2
|
|
9960
|
+
};
|
|
9492
9961
|
}
|
|
9493
9962
|
onAttributeUpdate(graphic) {
|
|
9494
9963
|
this.hooks.onAttributeUpdate.taps.length && this.hooks.onAttributeUpdate.call(graphic);
|
|
@@ -9588,10 +10057,7 @@ class DefaultGraphicService {
|
|
|
9588
10057
|
updateTempAABBBounds(aabbBounds) {
|
|
9589
10058
|
const tb1 = this.tempAABBBounds1,
|
|
9590
10059
|
tb2 = this.tempAABBBounds2;
|
|
9591
|
-
return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2),
|
|
9592
|
-
tb1: tb1,
|
|
9593
|
-
tb2: tb2
|
|
9594
|
-
};
|
|
10060
|
+
return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.tempAABBBoundsResult;
|
|
9595
10061
|
}
|
|
9596
10062
|
}
|
|
9597
10063
|
|
|
@@ -12981,7 +13447,11 @@ const result = {
|
|
|
12981
13447
|
};
|
|
12982
13448
|
class BaseRender {
|
|
12983
13449
|
init(contributions) {
|
|
12984
|
-
|
|
13450
|
+
this.builtinContributions || (this.builtinContributions = []), this._renderContribitions = contributions ? contributions.getContributions().slice() : [];
|
|
13451
|
+
const addContribution = item => {
|
|
13452
|
+
this._renderContribitions.includes(item) || this._renderContribitions.push(item);
|
|
13453
|
+
};
|
|
13454
|
+
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 = []);
|
|
12985
13455
|
}
|
|
12986
13456
|
reInit() {
|
|
12987
13457
|
this.init(this.graphicRenderContributions);
|
|
@@ -18378,6 +18848,47 @@ function commitUpdateAnimationTarget(graphic, targetAttrs, startAttrs) {
|
|
|
18378
18848
|
});
|
|
18379
18849
|
}
|
|
18380
18850
|
|
|
18851
|
+
function collectTrackedAnimates(graphic, animates = [], visited = new Set()) {
|
|
18852
|
+
var _a, _b, _c, _d, _e;
|
|
18853
|
+
const trackedAnimates = (_c = (_b = (_a = graphic).getTrackedAnimates) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : graphic.animates;
|
|
18854
|
+
trackedAnimates === null || trackedAnimates === void 0 ? void 0 : trackedAnimates.forEach((animate) => {
|
|
18855
|
+
if (animate && !visited.has(animate)) {
|
|
18856
|
+
visited.add(animate);
|
|
18857
|
+
animates.push(animate);
|
|
18858
|
+
}
|
|
18859
|
+
});
|
|
18860
|
+
(_e = (_d = graphic).forEachChildren) === null || _e === void 0 ? void 0 : _e.call(_d, (child) => {
|
|
18861
|
+
collectTrackedAnimates(child, animates, visited);
|
|
18862
|
+
});
|
|
18863
|
+
return animates;
|
|
18864
|
+
}
|
|
18865
|
+
function appendExitReleaseCallback(state, callback) {
|
|
18866
|
+
if (callback) {
|
|
18867
|
+
state === null || state === void 0 ? void 0 : state.onComplete.push(callback);
|
|
18868
|
+
}
|
|
18869
|
+
}
|
|
18870
|
+
function runExitReleaseCallbacks(callbacks) {
|
|
18871
|
+
callbacks.forEach(callback => {
|
|
18872
|
+
callback();
|
|
18873
|
+
});
|
|
18874
|
+
}
|
|
18875
|
+
function bindExitReleaseAnimates(exitAnimates, getState, finalize) {
|
|
18876
|
+
const finish = (animate) => {
|
|
18877
|
+
const state = getState();
|
|
18878
|
+
if (!state || state.finalized || !state.pendingAnimates.has(animate)) {
|
|
18879
|
+
return;
|
|
18880
|
+
}
|
|
18881
|
+
state.pendingAnimates.delete(animate);
|
|
18882
|
+
if (!state.pendingAnimates.size) {
|
|
18883
|
+
finalize();
|
|
18884
|
+
}
|
|
18885
|
+
};
|
|
18886
|
+
exitAnimates.forEach(animate => {
|
|
18887
|
+
animate.onEnd(() => finish(animate));
|
|
18888
|
+
animate.onRemove(() => finish(animate));
|
|
18889
|
+
});
|
|
18890
|
+
}
|
|
18891
|
+
|
|
18381
18892
|
const DefaultAxisAnimation = {
|
|
18382
18893
|
type: 'default',
|
|
18383
18894
|
duration: 300,
|
|
@@ -18423,7 +18934,101 @@ class AxisBase extends AnimateComponent {
|
|
|
18423
18934
|
this.attribute = currentAttribute;
|
|
18424
18935
|
return offscreenGroup.AABBBounds;
|
|
18425
18936
|
}
|
|
18937
|
+
_finalizeExitRelease() {
|
|
18938
|
+
var _a, _b;
|
|
18939
|
+
const state = this._exitReleaseState;
|
|
18940
|
+
if (state === null || state === void 0 ? void 0 : state.finalized) {
|
|
18941
|
+
return;
|
|
18942
|
+
}
|
|
18943
|
+
if (state) {
|
|
18944
|
+
state.finalized = true;
|
|
18945
|
+
}
|
|
18946
|
+
const parent = this.parent;
|
|
18947
|
+
const removeFromParent = !!(state === null || state === void 0 ? void 0 : state.removeFromParent);
|
|
18948
|
+
const callbacks = (_a = state === null || state === void 0 ? void 0 : state.onComplete) !== null && _a !== void 0 ? _a : [];
|
|
18949
|
+
this._exitReleaseState = undefined;
|
|
18950
|
+
this._prevInnerView = null;
|
|
18951
|
+
this._innerView = null;
|
|
18952
|
+
this.axisLabelsContainer = null;
|
|
18953
|
+
this.axisContainer = null;
|
|
18954
|
+
this.removeAllChild(true);
|
|
18955
|
+
super.release(true);
|
|
18956
|
+
if (removeFromParent) {
|
|
18957
|
+
(_b = (parent !== null && parent !== void 0 ? parent : this.parent)) === null || _b === void 0 ? void 0 : _b.removeChild(this);
|
|
18958
|
+
}
|
|
18959
|
+
runExitReleaseCallbacks(callbacks);
|
|
18960
|
+
}
|
|
18961
|
+
_runExitAnimationBeforeRelease(options = {}) {
|
|
18962
|
+
var _a, _b, _c;
|
|
18963
|
+
if (this._exitReleaseState && !this._exitReleaseState.finalized) {
|
|
18964
|
+
this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent;
|
|
18965
|
+
appendExitReleaseCallback(this._exitReleaseState, options.onComplete);
|
|
18966
|
+
return true;
|
|
18967
|
+
}
|
|
18968
|
+
if (!this.stage ||
|
|
18969
|
+
this.attribute.animation === false ||
|
|
18970
|
+
this.attribute.animationExit === false ||
|
|
18971
|
+
!this._innerView) {
|
|
18972
|
+
return false;
|
|
18973
|
+
}
|
|
18974
|
+
this._prepare();
|
|
18975
|
+
if (!((_a = this._animationConfig) === null || _a === void 0 ? void 0 : _a.exit)) {
|
|
18976
|
+
return false;
|
|
18977
|
+
}
|
|
18978
|
+
const exitTargets = new Set();
|
|
18979
|
+
traverseGroup(this._innerView, (el) => {
|
|
18980
|
+
if (el.type !== 'group') {
|
|
18981
|
+
exitTargets.add(el);
|
|
18982
|
+
}
|
|
18983
|
+
});
|
|
18984
|
+
if (!exitTargets.size) {
|
|
18985
|
+
return false;
|
|
18986
|
+
}
|
|
18987
|
+
const existingAnimates = collectTrackedAnimates(this);
|
|
18988
|
+
const { delay = 0, duration = DefaultAxisAnimation.duration, easing = DefaultAxisAnimation.easing } = this._animationConfig.exit;
|
|
18989
|
+
exitTargets.forEach(target => {
|
|
18990
|
+
var _a, _b, _c;
|
|
18991
|
+
const startAttrs = {
|
|
18992
|
+
opacity: (_a = target.attribute.opacity) !== null && _a !== void 0 ? _a : 1,
|
|
18993
|
+
fillOpacity: (_b = target.attribute.fillOpacity) !== null && _b !== void 0 ? _b : 1,
|
|
18994
|
+
strokeOpacity: (_c = target.attribute.strokeOpacity) !== null && _c !== void 0 ? _c : 1
|
|
18995
|
+
};
|
|
18996
|
+
const endAttrs = {
|
|
18997
|
+
opacity: 0,
|
|
18998
|
+
fillOpacity: 0,
|
|
18999
|
+
strokeOpacity: 0
|
|
19000
|
+
};
|
|
19001
|
+
commitUpdateAnimationTarget(target, endAttrs, startAttrs);
|
|
19002
|
+
target.animate().wait(delay).to(endAttrs, duration, easing);
|
|
19003
|
+
});
|
|
19004
|
+
const animates = collectTrackedAnimates(this);
|
|
19005
|
+
const exitAnimates = animates.filter(animate => !existingAnimates.includes(animate));
|
|
19006
|
+
if (!exitAnimates.length) {
|
|
19007
|
+
return false;
|
|
19008
|
+
}
|
|
19009
|
+
this.setAttribute('childrenPickable', false);
|
|
19010
|
+
(_c = (_b = this._innerView).removeAllEventListeners) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
19011
|
+
this.releaseStatus = 'willRelease';
|
|
19012
|
+
const pendingAnimates = new Set(exitAnimates);
|
|
19013
|
+
this._exitReleaseState = {
|
|
19014
|
+
pendingAnimates,
|
|
19015
|
+
finalized: false,
|
|
19016
|
+
removeFromParent: !!options.removeFromParent,
|
|
19017
|
+
onComplete: options.onComplete ? [options.onComplete] : []
|
|
19018
|
+
};
|
|
19019
|
+
bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease());
|
|
19020
|
+
return true;
|
|
19021
|
+
}
|
|
19022
|
+
releaseWithExitAnimation(options = {}) {
|
|
19023
|
+
if (this.releaseStatus === 'released') {
|
|
19024
|
+
return false;
|
|
19025
|
+
}
|
|
19026
|
+
return this._runExitAnimationBeforeRelease(options);
|
|
19027
|
+
}
|
|
18426
19028
|
render() {
|
|
19029
|
+
if (this._exitReleaseState) {
|
|
19030
|
+
return;
|
|
19031
|
+
}
|
|
18427
19032
|
this._prepare();
|
|
18428
19033
|
this._prevInnerView = this._innerView && getElMap(this._innerView);
|
|
18429
19034
|
this.removeAllChild(true);
|
|
@@ -18829,8 +19434,18 @@ class AxisBase extends AnimateComponent {
|
|
|
18829
19434
|
});
|
|
18830
19435
|
}
|
|
18831
19436
|
}
|
|
18832
|
-
release() {
|
|
18833
|
-
|
|
19437
|
+
release(all) {
|
|
19438
|
+
if (this._exitReleaseState) {
|
|
19439
|
+
this._finalizeExitRelease();
|
|
19440
|
+
return;
|
|
19441
|
+
}
|
|
19442
|
+
if (all) {
|
|
19443
|
+
this.removeAllChild(true);
|
|
19444
|
+
}
|
|
19445
|
+
super.release(all);
|
|
19446
|
+
if (all) {
|
|
19447
|
+
this.removeAllChild(true);
|
|
19448
|
+
}
|
|
18834
19449
|
this._prevInnerView = null;
|
|
18835
19450
|
this._innerView = null;
|
|
18836
19451
|
}
|
|
@@ -19522,17 +20137,35 @@ function commonInterpolateUpdate(key, from, to, ratio, step, target) {
|
|
|
19522
20137
|
return !1;
|
|
19523
20138
|
}
|
|
19524
20139
|
|
|
19525
|
-
|
|
19526
|
-
|
|
19527
|
-
}
|
|
20140
|
+
const animateUpdateContext = {
|
|
20141
|
+
type: AttributeUpdateType.ANIMATE_UPDATE
|
|
20142
|
+
},
|
|
20143
|
+
animateBindContext = {
|
|
20144
|
+
type: AttributeUpdateType.ANIMATE_BIND
|
|
20145
|
+
},
|
|
20146
|
+
animateStartContext = {
|
|
20147
|
+
type: AttributeUpdateType.ANIMATE_START
|
|
20148
|
+
};
|
|
20149
|
+
function getAnimationContext(type) {
|
|
20150
|
+
switch (type) {
|
|
20151
|
+
case AttributeUpdateType.ANIMATE_UPDATE:
|
|
20152
|
+
return animateUpdateContext;
|
|
20153
|
+
case AttributeUpdateType.ANIMATE_BIND:
|
|
20154
|
+
return animateBindContext;
|
|
20155
|
+
case AttributeUpdateType.ANIMATE_START:
|
|
20156
|
+
return animateStartContext;
|
|
20157
|
+
default:
|
|
20158
|
+
return {
|
|
20159
|
+
type: type
|
|
20160
|
+
};
|
|
20161
|
+
}
|
|
20162
|
+
}
|
|
19528
20163
|
function applyAnimationTransientAttributes(target, attributes, type = AttributeUpdateType.ANIMATE_UPDATE) {
|
|
19529
20164
|
var _a;
|
|
19530
20165
|
if (!attributes) return;
|
|
19531
|
-
const context =
|
|
19532
|
-
type: type
|
|
19533
|
-
},
|
|
20166
|
+
const context = getAnimationContext(type),
|
|
19534
20167
|
transientTarget = target;
|
|
19535
|
-
"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);
|
|
20168
|
+
"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);
|
|
19536
20169
|
}
|
|
19537
20170
|
|
|
19538
20171
|
function noop() {}
|
|
@@ -19887,7 +20520,7 @@ class Animate {
|
|
|
19887
20520
|
bind(target) {
|
|
19888
20521
|
this.target = target;
|
|
19889
20522
|
const trackerTarget = this.target;
|
|
19890
|
-
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(() => {
|
|
20523
|
+
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(() => {
|
|
19891
20524
|
this.stop(), this.__skipRestoreStaticAttributeOnRemove || "function" != typeof trackerTarget.restoreStaticAttribute || trackerTarget.restoreStaticAttribute(), "function" == typeof trackerTarget.untrackAnimate ? trackerTarget.untrackAnimate(this.id) : this.target.animates.delete(this.id);
|
|
19892
20525
|
}), this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
|
|
19893
20526
|
}
|
|
@@ -20331,6 +20964,33 @@ class AnimateExecutor {
|
|
|
20331
20964
|
cb();
|
|
20332
20965
|
});
|
|
20333
20966
|
}
|
|
20967
|
+
getActiveAttrKeys() {
|
|
20968
|
+
const keys = [];
|
|
20969
|
+
for (let i = 0; i < this._animates.length; i++) {
|
|
20970
|
+
const animate = this._animates[i];
|
|
20971
|
+
if (animate.status === AnimateStatus.END) continue;
|
|
20972
|
+
const endProps = animate.getEndProps();
|
|
20973
|
+
if (endProps) for (const key in endProps) Object.prototype.hasOwnProperty.call(endProps, key) && keys.indexOf(key) < 0 && keys.push(key);
|
|
20974
|
+
}
|
|
20975
|
+
return keys;
|
|
20976
|
+
}
|
|
20977
|
+
hasActiveAttrs() {
|
|
20978
|
+
for (let i = 0; i < this._animates.length; i++) {
|
|
20979
|
+
const animate = this._animates[i];
|
|
20980
|
+
if (animate.status === AnimateStatus.END) continue;
|
|
20981
|
+
const endProps = animate.getEndProps();
|
|
20982
|
+
if (endProps) for (const key in endProps) if (Object.prototype.hasOwnProperty.call(endProps, key)) return !0;
|
|
20983
|
+
}
|
|
20984
|
+
return !1;
|
|
20985
|
+
}
|
|
20986
|
+
preventAttrs(keys) {
|
|
20987
|
+
if (!(null == keys ? void 0 : keys.length)) return this.hasActiveAttrs();
|
|
20988
|
+
for (let i = 0; i < this._animates.length; i++) {
|
|
20989
|
+
const animate = this._animates[i];
|
|
20990
|
+
animate.status !== AnimateStatus.END && animate.preventAttrs(keys);
|
|
20991
|
+
}
|
|
20992
|
+
return this.hasActiveAttrs();
|
|
20993
|
+
}
|
|
20334
20994
|
_trackAnimation(animate) {
|
|
20335
20995
|
this._animates.push(animate), this._activeCount++, 1 !== this._activeCount || this._started || (this._started = !0, this.onStart()), animate.onEnd(() => {
|
|
20336
20996
|
this._activeCount--;
|
|
@@ -20636,8 +21296,22 @@ class AnimationStateManager {
|
|
|
20636
21296
|
hasTrackedAnimate() {
|
|
20637
21297
|
return this.trackedAnimates.size > 0;
|
|
20638
21298
|
}
|
|
21299
|
+
hasStateInfo(list, target) {
|
|
21300
|
+
for (let i = 0; i < list.length; i++) if (list[i] === target) return !0;
|
|
21301
|
+
return !1;
|
|
21302
|
+
}
|
|
21303
|
+
takeOverUpdateAttrs(nextState, currentStates, shouldStopState) {
|
|
21304
|
+
if (nextState.state !== AnimationStates.UPDATE || !currentStates.length) return;
|
|
21305
|
+
const nextKeys = nextState.executor.getActiveAttrKeys();
|
|
21306
|
+
if (nextKeys.length) for (let i = 0; i < currentStates.length; i++) {
|
|
21307
|
+
const currentState = currentStates[i];
|
|
21308
|
+
currentState.state !== AnimationStates.UPDATE || currentState === nextState || this.hasStateInfo(shouldStopState, currentState) || currentState.executor.preventAttrs(nextKeys) || (currentState.executor.stop(null, !1), shouldStopState.push(currentState));
|
|
21309
|
+
}
|
|
21310
|
+
}
|
|
20639
21311
|
applyState(nextState, animationConfig, callback) {
|
|
21312
|
+
var _a;
|
|
20640
21313
|
const registry = AnimationTransitionRegistry.getInstance(),
|
|
21314
|
+
currentStateList = null !== (_a = this.stateList) && void 0 !== _a ? _a : [],
|
|
20641
21315
|
shouldStopState = [],
|
|
20642
21316
|
shouldApplyState = [];
|
|
20643
21317
|
if (this.stateList && this.stateList.length ? nextState.forEach((state, index) => {
|
|
@@ -20645,14 +21319,14 @@ class AnimationStateManager {
|
|
|
20645
21319
|
allowTransition: !0,
|
|
20646
21320
|
stopOriginalTransition: !0
|
|
20647
21321
|
};
|
|
20648
|
-
|
|
21322
|
+
currentStateList.forEach(currState => {
|
|
20649
21323
|
const _result = registry.isTransitionAllowed(currState.state, state, this.graphic);
|
|
20650
21324
|
result.allowTransition = result.allowTransition && _result.allowTransition;
|
|
20651
21325
|
}), result.allowTransition && (shouldApplyState.push({
|
|
20652
21326
|
state: state,
|
|
20653
21327
|
animationConfig: isArray(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
|
|
20654
21328
|
executor: new AnimateExecutor(this.graphic)
|
|
20655
|
-
}),
|
|
21329
|
+
}), currentStateList.forEach(currState => {
|
|
20656
21330
|
registry.isTransitionAllowed(currState.state, state, this.graphic).stopOriginalTransition && shouldStopState.push(currState);
|
|
20657
21331
|
}));
|
|
20658
21332
|
}) : nextState.forEach((state, index) => {
|
|
@@ -20664,12 +21338,18 @@ class AnimationStateManager {
|
|
|
20664
21338
|
}), shouldStopState.forEach(state => {
|
|
20665
21339
|
state.executor.stop(null, !1);
|
|
20666
21340
|
}), shouldApplyState.length) {
|
|
20667
|
-
shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig);
|
|
21341
|
+
shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig), this.takeOverUpdateAttrs(shouldApplyState[0], currentStateList, shouldStopState);
|
|
20668
21342
|
for (let i = 0; i < shouldApplyState.length; i++) {
|
|
20669
21343
|
const nextState = shouldApplyState[i + 1],
|
|
20670
21344
|
currentState = shouldApplyState[i];
|
|
20671
21345
|
currentState.executor.onEnd(() => {
|
|
20672
|
-
|
|
21346
|
+
var _a;
|
|
21347
|
+
if (nextState) {
|
|
21348
|
+
nextState.executor.execute(nextState.animationConfig);
|
|
21349
|
+
const stoppedStates = [];
|
|
21350
|
+
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)));
|
|
21351
|
+
}
|
|
21352
|
+
this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
|
|
20673
21353
|
});
|
|
20674
21354
|
}
|
|
20675
21355
|
} else callback && callback(!0);
|
|
@@ -21779,8 +22459,8 @@ class LineAxis extends AxisBase {
|
|
|
21779
22459
|
}
|
|
21780
22460
|
return offset;
|
|
21781
22461
|
}
|
|
21782
|
-
release() {
|
|
21783
|
-
super.release();
|
|
22462
|
+
release(all) {
|
|
22463
|
+
super.release(all);
|
|
21784
22464
|
this._breaks = null;
|
|
21785
22465
|
}
|
|
21786
22466
|
}
|
|
@@ -23659,6 +24339,17 @@ function shiftY(texts, option) {
|
|
|
23659
24339
|
}
|
|
23660
24340
|
|
|
23661
24341
|
loadLabelComponent();
|
|
24342
|
+
function cloneAttributeSnapshot(value) {
|
|
24343
|
+
if (!isObject(value) || isArray(value)) {
|
|
24344
|
+
return value;
|
|
24345
|
+
}
|
|
24346
|
+
const snapshot = {};
|
|
24347
|
+
Object.keys(value).forEach(key => {
|
|
24348
|
+
const nextValue = value[key];
|
|
24349
|
+
snapshot[key] = isObject(nextValue) && !isArray(nextValue) ? cloneAttributeSnapshot(nextValue) : nextValue;
|
|
24350
|
+
});
|
|
24351
|
+
return snapshot;
|
|
24352
|
+
}
|
|
23662
24353
|
class LabelBase extends AnimateComponent {
|
|
23663
24354
|
setBitmap(bitmap) {
|
|
23664
24355
|
this._bitmap = bitmap;
|
|
@@ -23757,7 +24448,92 @@ class LabelBase extends AnimateComponent {
|
|
|
23757
24448
|
return lineGraphic;
|
|
23758
24449
|
}
|
|
23759
24450
|
}
|
|
24451
|
+
_finalizeExitRelease() {
|
|
24452
|
+
var _a, _b, _c, _d;
|
|
24453
|
+
const state = this._exitReleaseState;
|
|
24454
|
+
if (state === null || state === void 0 ? void 0 : state.finalized) {
|
|
24455
|
+
return;
|
|
24456
|
+
}
|
|
24457
|
+
if (state) {
|
|
24458
|
+
state.finalized = true;
|
|
24459
|
+
}
|
|
24460
|
+
const parent = this.parent;
|
|
24461
|
+
const removeFromParent = !!(state === null || state === void 0 ? void 0 : state.removeFromParent);
|
|
24462
|
+
const callbacks = (_a = state === null || state === void 0 ? void 0 : state.onComplete) !== null && _a !== void 0 ? _a : [];
|
|
24463
|
+
this._exitReleaseState = undefined;
|
|
24464
|
+
this._graphicToText = new Map();
|
|
24465
|
+
(_b = this._idToGraphic) === null || _b === void 0 ? void 0 : _b.clear();
|
|
24466
|
+
(_c = this._idToPoint) === null || _c === void 0 ? void 0 : _c.clear();
|
|
24467
|
+
this._baseMarks = undefined;
|
|
24468
|
+
this.removeAllChild(true);
|
|
24469
|
+
super.release(true);
|
|
24470
|
+
if (removeFromParent) {
|
|
24471
|
+
(_d = (parent !== null && parent !== void 0 ? parent : this.parent)) === null || _d === void 0 ? void 0 : _d.removeChild(this);
|
|
24472
|
+
}
|
|
24473
|
+
runExitReleaseCallbacks(callbacks);
|
|
24474
|
+
}
|
|
24475
|
+
_runExitAnimationBeforeRelease(options = {}) {
|
|
24476
|
+
var _a, _b;
|
|
24477
|
+
if (this._exitReleaseState && !this._exitReleaseState.finalized) {
|
|
24478
|
+
this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent;
|
|
24479
|
+
appendExitReleaseCallback(this._exitReleaseState, options.onComplete);
|
|
24480
|
+
return true;
|
|
24481
|
+
}
|
|
24482
|
+
if (!this.stage ||
|
|
24483
|
+
this.attribute.animation === false ||
|
|
24484
|
+
this.attribute.animationExit === false ||
|
|
24485
|
+
!((_a = this._graphicToText) === null || _a === void 0 ? void 0 : _a.size)) {
|
|
24486
|
+
return false;
|
|
24487
|
+
}
|
|
24488
|
+
this._prepareAnimate(DefaultLabelAnimation);
|
|
24489
|
+
if (!((_b = this._animationConfig) === null || _b === void 0 ? void 0 : _b.exit)) {
|
|
24490
|
+
return false;
|
|
24491
|
+
}
|
|
24492
|
+
const exitTargets = new Set();
|
|
24493
|
+
this._graphicToText.forEach(label => {
|
|
24494
|
+
(label === null || label === void 0 ? void 0 : label.text) && exitTargets.add(label.text);
|
|
24495
|
+
(label === null || label === void 0 ? void 0 : label.labelLine) && exitTargets.add(label.labelLine);
|
|
24496
|
+
});
|
|
24497
|
+
if (!exitTargets.size) {
|
|
24498
|
+
return false;
|
|
24499
|
+
}
|
|
24500
|
+
const existingAnimates = collectTrackedAnimates(this);
|
|
24501
|
+
exitTargets.forEach(target => {
|
|
24502
|
+
var _a;
|
|
24503
|
+
target.applyAnimationState(['exit'], [
|
|
24504
|
+
{
|
|
24505
|
+
name: 'exit',
|
|
24506
|
+
animation: Object.assign(Object.assign({}, this._animationConfig.exit), { type: (_a = this._animationConfig.exit.type) !== null && _a !== void 0 ? _a : 'fadeOut', selfOnly: true })
|
|
24507
|
+
}
|
|
24508
|
+
]);
|
|
24509
|
+
});
|
|
24510
|
+
const animates = collectTrackedAnimates(this);
|
|
24511
|
+
const exitAnimates = animates.filter(animate => !existingAnimates.includes(animate));
|
|
24512
|
+
if (!exitAnimates.length) {
|
|
24513
|
+
return false;
|
|
24514
|
+
}
|
|
24515
|
+
this.setAttribute('childrenPickable', false);
|
|
24516
|
+
this.releaseStatus = 'willRelease';
|
|
24517
|
+
const pendingAnimates = new Set(exitAnimates);
|
|
24518
|
+
this._exitReleaseState = {
|
|
24519
|
+
pendingAnimates,
|
|
24520
|
+
finalized: false,
|
|
24521
|
+
removeFromParent: !!options.removeFromParent,
|
|
24522
|
+
onComplete: options.onComplete ? [options.onComplete] : []
|
|
24523
|
+
};
|
|
24524
|
+
bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease());
|
|
24525
|
+
return true;
|
|
24526
|
+
}
|
|
24527
|
+
releaseWithExitAnimation(options = {}) {
|
|
24528
|
+
if (this.releaseStatus === 'released') {
|
|
24529
|
+
return false;
|
|
24530
|
+
}
|
|
24531
|
+
return this._runExitAnimationBeforeRelease(options);
|
|
24532
|
+
}
|
|
23760
24533
|
render() {
|
|
24534
|
+
if (this._exitReleaseState) {
|
|
24535
|
+
return;
|
|
24536
|
+
}
|
|
23761
24537
|
this._prepare();
|
|
23762
24538
|
if (isNil(this._idToGraphic) || (this._isCollectionBase && isNil(this._idToPoint))) {
|
|
23763
24539
|
return;
|
|
@@ -23765,7 +24541,7 @@ class LabelBase extends AnimateComponent {
|
|
|
23765
24541
|
const markAttributeList = [];
|
|
23766
24542
|
if (this._enableAnimation !== false) {
|
|
23767
24543
|
this._baseMarks.forEach(mark => {
|
|
23768
|
-
markAttributeList.push(mark.attribute);
|
|
24544
|
+
markAttributeList.push(cloneAttributeSnapshot(mark.attribute));
|
|
23769
24545
|
mark.initAttributes(mark.getAttributes(true));
|
|
23770
24546
|
});
|
|
23771
24547
|
}
|
|
@@ -24447,6 +25223,21 @@ class LabelBase extends AnimateComponent {
|
|
|
24447
25223
|
}
|
|
24448
25224
|
return shapeBound.encloses(textBound);
|
|
24449
25225
|
}
|
|
25226
|
+
release(all) {
|
|
25227
|
+
var _a, _b;
|
|
25228
|
+
if (this._exitReleaseState) {
|
|
25229
|
+
this._finalizeExitRelease();
|
|
25230
|
+
return;
|
|
25231
|
+
}
|
|
25232
|
+
if (all) {
|
|
25233
|
+
this.removeAllChild(true);
|
|
25234
|
+
}
|
|
25235
|
+
super.release(all);
|
|
25236
|
+
this._graphicToText = new Map();
|
|
25237
|
+
(_a = this._idToGraphic) === null || _a === void 0 ? void 0 : _a.clear();
|
|
25238
|
+
(_b = this._idToPoint) === null || _b === void 0 ? void 0 : _b.clear();
|
|
25239
|
+
this._baseMarks = undefined;
|
|
25240
|
+
}
|
|
24450
25241
|
setLocation(point) {
|
|
24451
25242
|
this.translateTo(point.x, point.y);
|
|
24452
25243
|
}
|
|
@@ -25407,6 +26198,9 @@ class DataLabel extends AbstractComponent {
|
|
|
25407
26198
|
}
|
|
25408
26199
|
render() {
|
|
25409
26200
|
var _a;
|
|
26201
|
+
if (this._exitReleaseState) {
|
|
26202
|
+
return;
|
|
26203
|
+
}
|
|
25410
26204
|
const { dataLabels, size } = this.attribute;
|
|
25411
26205
|
if (!dataLabels || dataLabels.length === 0) {
|
|
25412
26206
|
return;
|
|
@@ -25455,6 +26249,101 @@ class DataLabel extends AbstractComponent {
|
|
|
25455
26249
|
});
|
|
25456
26250
|
this._componentMap = currentComponentMap;
|
|
25457
26251
|
}
|
|
26252
|
+
_finalizeExitRelease() {
|
|
26253
|
+
var _a, _b, _c;
|
|
26254
|
+
const state = this._exitReleaseState;
|
|
26255
|
+
if (state === null || state === void 0 ? void 0 : state.finalized) {
|
|
26256
|
+
return;
|
|
26257
|
+
}
|
|
26258
|
+
if (state) {
|
|
26259
|
+
state.finalized = true;
|
|
26260
|
+
}
|
|
26261
|
+
const parent = this.parent;
|
|
26262
|
+
const removeFromParent = !!(state === null || state === void 0 ? void 0 : state.removeFromParent);
|
|
26263
|
+
const callbacks = (_a = state === null || state === void 0 ? void 0 : state.onComplete) !== null && _a !== void 0 ? _a : [];
|
|
26264
|
+
this._exitReleaseState = undefined;
|
|
26265
|
+
(_b = this._componentMap) === null || _b === void 0 ? void 0 : _b.clear();
|
|
26266
|
+
this.removeAllChild(true);
|
|
26267
|
+
super.release(true);
|
|
26268
|
+
if (removeFromParent) {
|
|
26269
|
+
(_c = (parent !== null && parent !== void 0 ? parent : this.parent)) === null || _c === void 0 ? void 0 : _c.removeChild(this);
|
|
26270
|
+
}
|
|
26271
|
+
runExitReleaseCallbacks(callbacks);
|
|
26272
|
+
}
|
|
26273
|
+
releaseWithExitAnimation(options = {}) {
|
|
26274
|
+
var _a;
|
|
26275
|
+
if (this.releaseStatus === 'released') {
|
|
26276
|
+
return false;
|
|
26277
|
+
}
|
|
26278
|
+
if (this._exitReleaseState && !this._exitReleaseState.finalized) {
|
|
26279
|
+
this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent;
|
|
26280
|
+
appendExitReleaseCallback(this._exitReleaseState, options.onComplete);
|
|
26281
|
+
return true;
|
|
26282
|
+
}
|
|
26283
|
+
if (!this.stage || !((_a = this._componentMap) === null || _a === void 0 ? void 0 : _a.size)) {
|
|
26284
|
+
return false;
|
|
26285
|
+
}
|
|
26286
|
+
const state = {
|
|
26287
|
+
pendingCount: 0,
|
|
26288
|
+
finalized: false,
|
|
26289
|
+
removeFromParent: !!options.removeFromParent,
|
|
26290
|
+
onComplete: options.onComplete ? [options.onComplete] : []
|
|
26291
|
+
};
|
|
26292
|
+
const exitingComponents = [];
|
|
26293
|
+
const fallbackComponents = [];
|
|
26294
|
+
let initializing = true;
|
|
26295
|
+
const finish = () => {
|
|
26296
|
+
if (state.finalized) {
|
|
26297
|
+
return;
|
|
26298
|
+
}
|
|
26299
|
+
state.pendingCount -= 1;
|
|
26300
|
+
if (state.pendingCount <= 0 && !initializing) {
|
|
26301
|
+
this._finalizeExitRelease();
|
|
26302
|
+
}
|
|
26303
|
+
};
|
|
26304
|
+
this._exitReleaseState = state;
|
|
26305
|
+
this._componentMap.forEach(component => {
|
|
26306
|
+
state.pendingCount += 1;
|
|
26307
|
+
const releasedWithExit = component.releaseWithExitAnimation({
|
|
26308
|
+
removeFromParent: false,
|
|
26309
|
+
onComplete: finish
|
|
26310
|
+
});
|
|
26311
|
+
if (releasedWithExit) {
|
|
26312
|
+
exitingComponents.push(component);
|
|
26313
|
+
}
|
|
26314
|
+
else {
|
|
26315
|
+
state.pendingCount -= 1;
|
|
26316
|
+
fallbackComponents.push(component);
|
|
26317
|
+
}
|
|
26318
|
+
});
|
|
26319
|
+
if (!exitingComponents.length) {
|
|
26320
|
+
this._exitReleaseState = undefined;
|
|
26321
|
+
return false;
|
|
26322
|
+
}
|
|
26323
|
+
fallbackComponents.forEach(component => {
|
|
26324
|
+
component.release(true);
|
|
26325
|
+
this.removeChild(component);
|
|
26326
|
+
});
|
|
26327
|
+
this.setAttribute('childrenPickable', false);
|
|
26328
|
+
this.releaseStatus = 'willRelease';
|
|
26329
|
+
initializing = false;
|
|
26330
|
+
if (state.pendingCount <= 0) {
|
|
26331
|
+
this._finalizeExitRelease();
|
|
26332
|
+
}
|
|
26333
|
+
return true;
|
|
26334
|
+
}
|
|
26335
|
+
release(all) {
|
|
26336
|
+
var _a;
|
|
26337
|
+
if (this._exitReleaseState) {
|
|
26338
|
+
this._finalizeExitRelease();
|
|
26339
|
+
return;
|
|
26340
|
+
}
|
|
26341
|
+
if (all) {
|
|
26342
|
+
this.removeAllChild(true);
|
|
26343
|
+
}
|
|
26344
|
+
super.release(all);
|
|
26345
|
+
(_a = this._componentMap) === null || _a === void 0 ? void 0 : _a.clear();
|
|
26346
|
+
}
|
|
25458
26347
|
setLocation(point) {
|
|
25459
26348
|
this.translateTo(point.x, point.y);
|
|
25460
26349
|
}
|
|
@@ -27164,15 +28053,95 @@ class Marker extends AbstractComponent {
|
|
|
27164
28053
|
y: clipInRange ? -((_b = limitRect.y) !== null && _b !== void 0 ? _b : 0) : 0
|
|
27165
28054
|
});
|
|
27166
28055
|
}
|
|
27167
|
-
|
|
28056
|
+
_finalizeExitRelease() {
|
|
28057
|
+
var _a, _b;
|
|
28058
|
+
const state = this._exitReleaseState;
|
|
28059
|
+
if (state === null || state === void 0 ? void 0 : state.finalized) {
|
|
28060
|
+
return;
|
|
28061
|
+
}
|
|
28062
|
+
if (state) {
|
|
28063
|
+
state.finalized = true;
|
|
28064
|
+
}
|
|
28065
|
+
const parent = this.parent;
|
|
28066
|
+
const removeFromParent = !!(state === null || state === void 0 ? void 0 : state.removeFromParent);
|
|
28067
|
+
const releaseSelf = !!(state === null || state === void 0 ? void 0 : state.releaseSelf);
|
|
28068
|
+
const callbacks = (_a = state === null || state === void 0 ? void 0 : state.onComplete) !== null && _a !== void 0 ? _a : [];
|
|
28069
|
+
this._exitReleaseState = undefined;
|
|
28070
|
+
this._releaseEvent();
|
|
28071
|
+
this._container = null;
|
|
28072
|
+
this._containerClip = null;
|
|
28073
|
+
this.removeAllChild(true);
|
|
28074
|
+
if (releaseSelf) {
|
|
28075
|
+
super.release(true);
|
|
28076
|
+
if (removeFromParent) {
|
|
28077
|
+
(_b = (parent !== null && parent !== void 0 ? parent : this.parent)) === null || _b === void 0 ? void 0 : _b.removeChild(this);
|
|
28078
|
+
}
|
|
28079
|
+
}
|
|
28080
|
+
runExitReleaseCallbacks(callbacks);
|
|
28081
|
+
}
|
|
28082
|
+
_runExitAnimationBeforeCleanup(options = {}) {
|
|
27168
28083
|
var _a;
|
|
28084
|
+
const releaseSelf = !!options.releaseSelf;
|
|
28085
|
+
if (this._exitReleaseState && !this._exitReleaseState.finalized) {
|
|
28086
|
+
this._exitReleaseState.releaseSelf = this._exitReleaseState.releaseSelf || releaseSelf;
|
|
28087
|
+
this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent;
|
|
28088
|
+
appendExitReleaseCallback(this._exitReleaseState, options.onComplete);
|
|
28089
|
+
return true;
|
|
28090
|
+
}
|
|
28091
|
+
if (!this.stage ||
|
|
28092
|
+
this.attribute.animation === false ||
|
|
28093
|
+
this.attribute.animationExit === false ||
|
|
28094
|
+
!this._container) {
|
|
28095
|
+
return false;
|
|
28096
|
+
}
|
|
28097
|
+
this.transAnimationConfig();
|
|
28098
|
+
if (!((_a = this._animationConfig) === null || _a === void 0 ? void 0 : _a.exit)) {
|
|
28099
|
+
return false;
|
|
28100
|
+
}
|
|
28101
|
+
const existingAnimates = collectTrackedAnimates(this);
|
|
28102
|
+
this.markerAnimate('exit');
|
|
28103
|
+
const animates = collectTrackedAnimates(this);
|
|
28104
|
+
const exitAnimates = animates.filter(animate => !existingAnimates.includes(animate));
|
|
28105
|
+
if (!exitAnimates.length) {
|
|
28106
|
+
return false;
|
|
28107
|
+
}
|
|
28108
|
+
this._releaseEvent();
|
|
28109
|
+
this.setAttribute('childrenPickable', false);
|
|
28110
|
+
if (releaseSelf) {
|
|
28111
|
+
this.releaseStatus = 'willRelease';
|
|
28112
|
+
}
|
|
28113
|
+
const pendingAnimates = new Set(exitAnimates);
|
|
28114
|
+
this._exitReleaseState = {
|
|
28115
|
+
pendingAnimates,
|
|
28116
|
+
finalized: false,
|
|
28117
|
+
releaseSelf,
|
|
28118
|
+
removeFromParent: !!options.removeFromParent,
|
|
28119
|
+
onComplete: options.onComplete ? [options.onComplete] : []
|
|
28120
|
+
};
|
|
28121
|
+
bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease());
|
|
28122
|
+
return true;
|
|
28123
|
+
}
|
|
28124
|
+
releaseWithExitAnimation(options = {}) {
|
|
28125
|
+
if (this.releaseStatus === 'released') {
|
|
28126
|
+
return false;
|
|
28127
|
+
}
|
|
28128
|
+
return this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({}, options), { releaseSelf: true }));
|
|
28129
|
+
}
|
|
28130
|
+
render() {
|
|
28131
|
+
var _a, _b;
|
|
28132
|
+
if ((_a = this._exitReleaseState) === null || _a === void 0 ? void 0 : _a.releaseSelf) {
|
|
28133
|
+
return;
|
|
28134
|
+
}
|
|
27169
28135
|
this.transAnimationConfig();
|
|
27170
28136
|
this.setAttribute('pickable', false);
|
|
27171
|
-
const markerVisible = (
|
|
28137
|
+
const markerVisible = (_b = this.attribute.visible) !== null && _b !== void 0 ? _b : true;
|
|
27172
28138
|
if (this.attribute.interactive === false) {
|
|
27173
28139
|
this.setAttribute('childrenPickable', false);
|
|
27174
28140
|
}
|
|
27175
28141
|
if (markerVisible && this.isValidPoints()) {
|
|
28142
|
+
if (this._exitReleaseState) {
|
|
28143
|
+
this._finalizeExitRelease();
|
|
28144
|
+
}
|
|
27176
28145
|
if (!this._container) {
|
|
27177
28146
|
this._initContainer();
|
|
27178
28147
|
this.initMarker(this._container);
|
|
@@ -27185,18 +28154,30 @@ class Marker extends AbstractComponent {
|
|
|
27185
28154
|
}
|
|
27186
28155
|
}
|
|
27187
28156
|
else {
|
|
27188
|
-
this.
|
|
27189
|
-
|
|
27190
|
-
|
|
28157
|
+
if (!this._runExitAnimationBeforeCleanup()) {
|
|
28158
|
+
this._container = null;
|
|
28159
|
+
this._containerClip = null;
|
|
28160
|
+
this.removeAllChild(true);
|
|
28161
|
+
}
|
|
27191
28162
|
}
|
|
27192
28163
|
this._releaseEvent();
|
|
27193
28164
|
this._bindEvent();
|
|
27194
28165
|
}
|
|
27195
|
-
release() {
|
|
27196
|
-
this.
|
|
27197
|
-
|
|
28166
|
+
release(all) {
|
|
28167
|
+
if (this._exitReleaseState) {
|
|
28168
|
+
this._finalizeExitRelease();
|
|
28169
|
+
return;
|
|
28170
|
+
}
|
|
28171
|
+
if (this.attribute.animation !== false && this.attribute.animationExit !== false) {
|
|
28172
|
+
this.markerAnimate('exit');
|
|
28173
|
+
}
|
|
28174
|
+
if (all) {
|
|
28175
|
+
this.removeAllChild(true);
|
|
28176
|
+
}
|
|
28177
|
+
super.release(all);
|
|
27198
28178
|
this._releaseEvent();
|
|
27199
28179
|
this._container = null;
|
|
28180
|
+
this._containerClip = null;
|
|
27200
28181
|
}
|
|
27201
28182
|
}
|
|
27202
28183
|
|
|
@@ -29703,8 +30684,10 @@ class DiscreteLegend extends LegendBase {
|
|
|
29703
30684
|
? this.attribute.item.width
|
|
29704
30685
|
: innerGroupWidth + parsedPadding[1] + parsedPadding[3];
|
|
29705
30686
|
const itemGroupHeight = this._itemHeightByUser || innerGroupHeight + parsedPadding[0] + parsedPadding[2];
|
|
29706
|
-
itemGroup.
|
|
29707
|
-
|
|
30687
|
+
itemGroup.setAttributes({
|
|
30688
|
+
width: itemGroupWidth,
|
|
30689
|
+
height: itemGroupHeight
|
|
30690
|
+
});
|
|
29708
30691
|
focusShape && focusShape.setAttribute('visible', false);
|
|
29709
30692
|
innerGroup.translateTo(-innerGroupBounds.x1 + parsedPadding[3], -innerGroupBounds.y1 + parsedPadding[0]);
|
|
29710
30693
|
return itemGroup;
|
|
@@ -31690,9 +32673,11 @@ class Title extends AbstractComponent {
|
|
|
31690
32673
|
totalHeight = maxHeight;
|
|
31691
32674
|
}
|
|
31692
32675
|
}
|
|
31693
|
-
group.
|
|
31694
|
-
|
|
31695
|
-
|
|
32676
|
+
group.setAttributes({
|
|
32677
|
+
width: totalWidth,
|
|
32678
|
+
height: totalHeight,
|
|
32679
|
+
boundsPadding: parsedPadding
|
|
32680
|
+
});
|
|
31696
32681
|
if (this._mainTitle) {
|
|
31697
32682
|
if (isValid(align) || isValid(textStyle.align)) {
|
|
31698
32683
|
const mainTitleAlign = textStyle.align ? textStyle.align : align;
|
|
@@ -35777,6 +36762,6 @@ TableSeriesNumber.defaultAttributes = {
|
|
|
35777
36762
|
select: true
|
|
35778
36763
|
};
|
|
35779
36764
|
|
|
35780
|
-
const version = "1.1.0-alpha.
|
|
36765
|
+
const version = "1.1.0-alpha.18";
|
|
35781
36766
|
|
|
35782
36767
|
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 };
|