@visactor/vrender-components 1.1.0-alpha.15 → 1.1.0-alpha.17
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/polygon-sector.js +1 -2
- package/cjs/crosshair/polygon.js +2 -1
- package/cjs/empty-tip/register.js +1 -2
- package/cjs/empty-tip/type.js +2 -1
- 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/base.d.ts +6 -1
- package/cjs/label/base.js +66 -2
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/dataLabel.d.ts +5 -1
- package/cjs/label/dataLabel.js +46 -1
- package/cjs/label/dataLabel.js.map +1 -1
- package/cjs/legend/discrete/discrete.js +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 +1122 -197
- 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/polygon-sector.js +1 -2
- package/es/crosshair/polygon.js +2 -1
- package/es/empty-tip/register.js +1 -2
- package/es/empty-tip/type.js +2 -1
- 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/base.d.ts +6 -1
- package/es/label/base.js +66 -1
- package/es/label/base.js.map +1 -1
- package/es/label/dataLabel.d.ts +5 -1
- package/es/label/dataLabel.js +46 -0
- package/es/label/dataLabel.js.map +1 -1
- package/es/legend/discrete/discrete.js +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 +6 -6
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventEmitter, Logger, isBoolean, isObject, isFunction, tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, isArray, cos, sin, pi, isString, pointAt, isNumber, sqrt, isPointInLine, Color,
|
|
1
|
+
import { EventEmitter, Logger, isBoolean, isObject, isFunction, tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, isArray, cos, sin, pi, isString, pointAt, isNumber, sqrt, isPointInLine, Color, OBBBounds, isEqual, isNil, normalTransform, isValidUrl, isBase64, getContextFont, rotatePoint, transformBoundsWithMatrix, clampAngleByRadian, asin, isNumberClose, TextMeasure, Bounds, getRectIntersect, isRectIntersect, arrayEqual, acos, isPlainObject as isPlainObject$3, merge, isValid, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isEmpty, array, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, normalizeAngle, isValidNumber, flattenArray, isRotateAABBIntersect, isLess, isGreater, aabbSeparation, obbSeparation, cloneDeep, get, last, mixin, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, pointInRect, calculateAnchorOfBounds, computeQuadrant, polygonContainPoint } from '@visactor/vutils';
|
|
2
2
|
import { isContinuous, isDiscrete, LinearScale } from '@visactor/vscale';
|
|
3
3
|
|
|
4
4
|
class Hook {
|
|
@@ -4800,9 +4800,172 @@ function classifyAttributeDelta(key, prev, next) {
|
|
|
4800
4800
|
}
|
|
4801
4801
|
|
|
4802
4802
|
const STAGE_PERF_MONITOR = Symbol("vrender.statePerfMonitor");
|
|
4803
|
+
function createReasonBreakdown() {
|
|
4804
|
+
return {
|
|
4805
|
+
config_disabled: 0,
|
|
4806
|
+
context_disabled: 0,
|
|
4807
|
+
non_batch_operation: 0,
|
|
4808
|
+
mixed_update_category: 0,
|
|
4809
|
+
resolver_unstable_keys: 0,
|
|
4810
|
+
graphic_unavailable: 0
|
|
4811
|
+
};
|
|
4812
|
+
}
|
|
4813
|
+
function createEmptyStatePerfSnapshot() {
|
|
4814
|
+
return {
|
|
4815
|
+
counters: {
|
|
4816
|
+
stateCommits: 0,
|
|
4817
|
+
sharedRefreshCommits: 0,
|
|
4818
|
+
deferredJobsCreated: 0,
|
|
4819
|
+
deferredJobsCompleted: 0,
|
|
4820
|
+
deferredJobsCancelled: 0,
|
|
4821
|
+
deferredJobsCoalesced: 0,
|
|
4822
|
+
deferredGraphicsCommitted: 0,
|
|
4823
|
+
deferredBudgetYields: 0,
|
|
4824
|
+
deferredIneligibleGraphics: 0
|
|
4825
|
+
},
|
|
4826
|
+
deferredIneligibleByReason: createReasonBreakdown(),
|
|
4827
|
+
categoryBreakdown: {
|
|
4828
|
+
paint: 0,
|
|
4829
|
+
transform: 0,
|
|
4830
|
+
shape: 0,
|
|
4831
|
+
bounds: 0,
|
|
4832
|
+
layout: 0,
|
|
4833
|
+
pick: 0
|
|
4834
|
+
},
|
|
4835
|
+
refresh: {
|
|
4836
|
+
queuedGraphics: 0,
|
|
4837
|
+
flushedGraphics: 0,
|
|
4838
|
+
ensureFreshCalls: 0,
|
|
4839
|
+
renderScheduled: 0
|
|
4840
|
+
},
|
|
4841
|
+
resolver: {
|
|
4842
|
+
cacheHits: 0,
|
|
4843
|
+
cacheMisses: 0,
|
|
4844
|
+
invalidations: 0
|
|
4845
|
+
},
|
|
4846
|
+
cost: {
|
|
4847
|
+
resolverTotalMs: 0,
|
|
4848
|
+
resolverMaxMs: 0,
|
|
4849
|
+
patchTotalMs: 0,
|
|
4850
|
+
patchMaxMs: 0,
|
|
4851
|
+
sharedRefreshTotalMs: 0,
|
|
4852
|
+
sharedRefreshMaxMs: 0,
|
|
4853
|
+
batchSliceTotalMs: 0,
|
|
4854
|
+
batchSliceMaxMs: 0
|
|
4855
|
+
},
|
|
4856
|
+
allocationHints: {
|
|
4857
|
+
patchObjectsCreated: 0,
|
|
4858
|
+
batchEntriesCreated: 0,
|
|
4859
|
+
refreshQueuePushes: 0
|
|
4860
|
+
},
|
|
4861
|
+
batch: {
|
|
4862
|
+
pendingJobs: 0,
|
|
4863
|
+
maxPendingJobs: 0,
|
|
4864
|
+
maxGraphicsInJob: 0,
|
|
4865
|
+
maxFrameSliceCost: 0
|
|
4866
|
+
},
|
|
4867
|
+
events: []
|
|
4868
|
+
};
|
|
4869
|
+
}
|
|
4870
|
+
function cloneSnapshot(snapshot) {
|
|
4871
|
+
return {
|
|
4872
|
+
counters: Object.assign({}, snapshot.counters),
|
|
4873
|
+
deferredIneligibleByReason: Object.assign({}, snapshot.deferredIneligibleByReason),
|
|
4874
|
+
categoryBreakdown: Object.assign({}, snapshot.categoryBreakdown),
|
|
4875
|
+
refresh: Object.assign({}, snapshot.refresh),
|
|
4876
|
+
resolver: Object.assign({}, snapshot.resolver),
|
|
4877
|
+
cost: Object.assign({}, snapshot.cost),
|
|
4878
|
+
allocationHints: Object.assign({}, snapshot.allocationHints),
|
|
4879
|
+
batch: Object.assign({}, snapshot.batch),
|
|
4880
|
+
events: snapshot.events ? snapshot.events.slice() : []
|
|
4881
|
+
};
|
|
4882
|
+
}
|
|
4883
|
+
class StatePerfMonitor {
|
|
4884
|
+
constructor(configSource) {
|
|
4885
|
+
this.configSource = configSource, this.snapshot = createEmptyStatePerfSnapshot();
|
|
4886
|
+
}
|
|
4887
|
+
setConfig(config) {
|
|
4888
|
+
this.configSource = config;
|
|
4889
|
+
}
|
|
4890
|
+
getSnapshot() {
|
|
4891
|
+
return cloneSnapshot(this.snapshot);
|
|
4892
|
+
}
|
|
4893
|
+
reset() {
|
|
4894
|
+
const next = createEmptyStatePerfSnapshot();
|
|
4895
|
+
Object.assign(this.snapshot.counters, next.counters), Object.assign(this.snapshot.deferredIneligibleByReason, next.deferredIneligibleByReason), Object.assign(this.snapshot.categoryBreakdown, next.categoryBreakdown), Object.assign(this.snapshot.refresh, next.refresh), Object.assign(this.snapshot.resolver, next.resolver), Object.assign(this.snapshot.cost, next.cost), Object.assign(this.snapshot.allocationHints, next.allocationHints), Object.assign(this.snapshot.batch, next.batch), this.snapshot.events = [];
|
|
4896
|
+
}
|
|
4897
|
+
incrementCounter(key, delta = 1) {
|
|
4898
|
+
this.isEnabled() && (this.snapshot.counters[key] += delta);
|
|
4899
|
+
}
|
|
4900
|
+
recordDeferredIneligible(reason, delta = 1) {
|
|
4901
|
+
this.isEnabled() && (this.snapshot.deferredIneligibleByReason[reason] += delta, this.snapshot.counters.deferredIneligibleGraphics += delta, this.recordEvent("deferred-ineligible", {
|
|
4902
|
+
reason: reason,
|
|
4903
|
+
count: delta
|
|
4904
|
+
}));
|
|
4905
|
+
}
|
|
4906
|
+
recordCategory(category) {
|
|
4907
|
+
this.isEnabled() && (category & UpdateCategory.PAINT && (this.snapshot.categoryBreakdown.paint += 1), category & UpdateCategory.TRANSFORM && (this.snapshot.categoryBreakdown.transform += 1), category & UpdateCategory.SHAPE && (this.snapshot.categoryBreakdown.shape += 1), category & UpdateCategory.BOUNDS && (this.snapshot.categoryBreakdown.bounds += 1), category & UpdateCategory.LAYOUT && (this.snapshot.categoryBreakdown.layout += 1), category & UpdateCategory.PICK && (this.snapshot.categoryBreakdown.pick += 1));
|
|
4908
|
+
}
|
|
4909
|
+
recordRefresh(key, delta = 1) {
|
|
4910
|
+
this.isEnabled() && (this.snapshot.refresh[key] += delta);
|
|
4911
|
+
}
|
|
4912
|
+
recordResolver(key, delta = 1) {
|
|
4913
|
+
this.isEnabled() && (this.snapshot.resolver[key] += delta);
|
|
4914
|
+
}
|
|
4915
|
+
recordCost(kind, durationMs) {
|
|
4916
|
+
if (this.isEnabled()) {
|
|
4917
|
+
if ("resolver" === kind) return this.snapshot.cost.resolverTotalMs += durationMs, void (this.snapshot.cost.resolverMaxMs = Math.max(this.snapshot.cost.resolverMaxMs, durationMs));
|
|
4918
|
+
if ("patch" === kind) return this.snapshot.cost.patchTotalMs += durationMs, void (this.snapshot.cost.patchMaxMs = Math.max(this.snapshot.cost.patchMaxMs, durationMs));
|
|
4919
|
+
if ("sharedRefresh" === kind) return this.snapshot.cost.sharedRefreshTotalMs += durationMs, void (this.snapshot.cost.sharedRefreshMaxMs = Math.max(this.snapshot.cost.sharedRefreshMaxMs, durationMs));
|
|
4920
|
+
this.snapshot.cost.batchSliceTotalMs += durationMs, this.snapshot.cost.batchSliceMaxMs = Math.max(this.snapshot.cost.batchSliceMaxMs, durationMs), this.snapshot.batch.maxFrameSliceCost = Math.max(this.snapshot.batch.maxFrameSliceCost, durationMs);
|
|
4921
|
+
}
|
|
4922
|
+
}
|
|
4923
|
+
recordAllocation(key, delta = 1) {
|
|
4924
|
+
this.isEnabled() && (this.snapshot.allocationHints[key] += delta);
|
|
4925
|
+
}
|
|
4926
|
+
updateBatchPending(pendingJobs) {
|
|
4927
|
+
this.isEnabled() && (this.snapshot.batch.pendingJobs = pendingJobs, this.snapshot.batch.maxPendingJobs = Math.max(this.snapshot.batch.maxPendingJobs, pendingJobs));
|
|
4928
|
+
}
|
|
4929
|
+
updateMaxGraphicsInJob(count) {
|
|
4930
|
+
this.isEnabled() && (this.snapshot.batch.maxGraphicsInJob = Math.max(this.snapshot.batch.maxGraphicsInJob, count));
|
|
4931
|
+
}
|
|
4932
|
+
recordEvent(type, detail) {
|
|
4933
|
+
var _a, _b, _c;
|
|
4934
|
+
if (!this.shouldRecordEvents()) return;
|
|
4935
|
+
const events = null !== (_a = this.snapshot.events) && void 0 !== _a ? _a : this.snapshot.events = [];
|
|
4936
|
+
events.push({
|
|
4937
|
+
type: type,
|
|
4938
|
+
at: Date.now(),
|
|
4939
|
+
detail: detail
|
|
4940
|
+
});
|
|
4941
|
+
const max = null !== (_c = null === (_b = this.getConfig()) || void 0 === _b ? void 0 : _b.maxEventRecords) && void 0 !== _c ? _c : 100;
|
|
4942
|
+
events.length > max && events.splice(0, events.length - max);
|
|
4943
|
+
}
|
|
4944
|
+
isEnabled() {
|
|
4945
|
+
var _a;
|
|
4946
|
+
return !0 === (null === (_a = this.getConfig()) || void 0 === _a ? void 0 : _a.enabled);
|
|
4947
|
+
}
|
|
4948
|
+
shouldRecordEvents() {
|
|
4949
|
+
const config = this.getConfig();
|
|
4950
|
+
return !!(null == config ? void 0 : config.enabled) && !!config.recordEvents;
|
|
4951
|
+
}
|
|
4952
|
+
getConfig() {
|
|
4953
|
+
return "function" == typeof this.configSource ? this.configSource() : this.configSource;
|
|
4954
|
+
}
|
|
4955
|
+
}
|
|
4956
|
+
function ensureStageStatePerfMonitor(stage) {
|
|
4957
|
+
const stageAny = stage;
|
|
4958
|
+
return stageAny[STAGE_PERF_MONITOR] || (stageAny[STAGE_PERF_MONITOR] = new StatePerfMonitor(() => stage.statePerfConfig)), stageAny[STAGE_PERF_MONITOR];
|
|
4959
|
+
}
|
|
4803
4960
|
function getStageStatePerfMonitor(stage) {
|
|
4804
4961
|
if (stage) return stage[STAGE_PERF_MONITOR];
|
|
4805
4962
|
}
|
|
4963
|
+
function getActiveStageStatePerfMonitor(stage) {
|
|
4964
|
+
var _a;
|
|
4965
|
+
if (!stage) return;
|
|
4966
|
+
const current = getStageStatePerfMonitor(stage);
|
|
4967
|
+
return current || (!0 === (null === (_a = stage.statePerfConfig) || void 0 === _a ? void 0 : _a.enabled) ? ensureStageStatePerfMonitor(stage) : void 0);
|
|
4968
|
+
}
|
|
4806
4969
|
|
|
4807
4970
|
function isPlainObject$1(value) {
|
|
4808
4971
|
return null != value && "object" == typeof value && !Array.isArray(value);
|
|
@@ -4898,7 +5061,7 @@ class StateEngine {
|
|
|
4898
5061
|
}
|
|
4899
5062
|
invalidateResolverCache() {
|
|
4900
5063
|
var _a, _b;
|
|
4901
|
-
this.resolverPatchCache.clear(), this.resolverCacheKey = "", this.resolverCacheValid = !1, null === (_b =
|
|
5064
|
+
this.resolverPatchCache.clear(), this.resolverCacheKey = "", this.resolverCacheValid = !1, null === (_b = getActiveStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage)) || void 0 === _b || _b.recordResolver("invalidations");
|
|
4902
5065
|
}
|
|
4903
5066
|
hasState(stateName) {
|
|
4904
5067
|
return !!this._activeStates.length && (null == stateName || this._activeStates.includes(stateName));
|
|
@@ -4945,7 +5108,7 @@ class StateEngine {
|
|
|
4945
5108
|
}
|
|
4946
5109
|
recomputePatch(effectiveStates) {
|
|
4947
5110
|
var _a;
|
|
4948
|
-
const perfMonitor =
|
|
5111
|
+
const perfMonitor = getActiveStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage),
|
|
4949
5112
|
patchStart = perfMonitor ? performance.now() : 0;
|
|
4950
5113
|
let resolverCost = 0;
|
|
4951
5114
|
const cacheKey = effectiveStates.join(","),
|
|
@@ -5193,32 +5356,6 @@ class StateStyleResolver {
|
|
|
5193
5356
|
}
|
|
5194
5357
|
}), resolvedAttrs;
|
|
5195
5358
|
}
|
|
5196
|
-
resolveWithCompiled(normalAttrs, compiledDefinitions, stateProxy, effectiveStates, resolvedPatch) {
|
|
5197
|
-
var _a, _b;
|
|
5198
|
-
const mergeMode = null !== (_a = this.options.mergeMode) && void 0 !== _a ? _a : "shallow",
|
|
5199
|
-
resolvedAttrs = null !== (_b = cloneValue(resolvedPatch)) && void 0 !== _b ? _b : {};
|
|
5200
|
-
return effectiveStates.forEach(stateName => {
|
|
5201
|
-
const proxyPatch = null == stateProxy ? void 0 : stateProxy(stateName, effectiveStates);
|
|
5202
|
-
null != proxyPatch && Object.keys(proxyPatch).forEach(key => {
|
|
5203
|
-
const nextValue = proxyPatch[key],
|
|
5204
|
-
hasCompiledDefinition = compiledDefinitions.has(stateName);
|
|
5205
|
-
if ("deep" === mergeMode && isPlainObject(nextValue) && (isPlainObject(resolvedAttrs[key]) || !hasCompiledDefinition && isPlainObject(normalAttrs[key]))) {
|
|
5206
|
-
const baseValue = isPlainObject(resolvedAttrs[key]) ? resolvedAttrs[key] : isPlainObject(normalAttrs[key]) ? normalAttrs[key] : {};
|
|
5207
|
-
resolvedAttrs[key] = deepMerge(baseValue, nextValue);
|
|
5208
|
-
} else resolvedAttrs[key] = cloneValue(nextValue);
|
|
5209
|
-
});
|
|
5210
|
-
}), resolvedAttrs;
|
|
5211
|
-
}
|
|
5212
|
-
computeNormalAttrsBackup(normalAttrs, targetAttrs, finalAttribute) {
|
|
5213
|
-
const nextNormalAttrs = {},
|
|
5214
|
-
nextTargetAttrs = Object.assign({}, targetAttrs);
|
|
5215
|
-
for (const key in targetAttrs) Object.prototype.hasOwnProperty.call(targetAttrs, key) && (nextNormalAttrs[key] = cloneValue(normalAttrs && key in normalAttrs ? normalAttrs[key] : finalAttribute[key]));
|
|
5216
|
-
if (normalAttrs) for (const key in normalAttrs) Object.prototype.hasOwnProperty.call(normalAttrs, key) && !(key in targetAttrs) && (nextTargetAttrs[key] = cloneValue(normalAttrs[key]));
|
|
5217
|
-
return {
|
|
5218
|
-
attrs: nextTargetAttrs,
|
|
5219
|
-
normalAttrs: nextNormalAttrs
|
|
5220
|
-
};
|
|
5221
|
-
}
|
|
5222
5359
|
}
|
|
5223
5360
|
|
|
5224
5361
|
function hasOwnKeys(value) {
|
|
@@ -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,67 @@ 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
|
+
}
|
|
6077
6419
|
resolveStateAnimateConfig(animateConfig) {
|
|
6078
6420
|
var _a, _b, _c;
|
|
6079
6421
|
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 +6436,7 @@ class Graphic extends Node {
|
|
|
6094
6436
|
});
|
|
6095
6437
|
this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
|
|
6096
6438
|
}
|
|
6097
|
-
updateNormalAttrs(
|
|
6098
|
-
this._deprecatedNormalAttrsView = cloneAttributeValue(this.baseAttributes);
|
|
6099
|
-
}
|
|
6439
|
+
updateNormalAttrs(_stateAttrs) {}
|
|
6100
6440
|
getStateTransitionDefaultAttribute(key, targetAttrs) {
|
|
6101
6441
|
return this.getDefaultAttribute(key);
|
|
6102
6442
|
}
|
|
@@ -6106,6 +6446,7 @@ class Graphic extends Node {
|
|
|
6106
6446
|
stopStateAnimates(type = "end") {
|
|
6107
6447
|
const stopAnimationState = this.stopAnimationState;
|
|
6108
6448
|
if ("function" == typeof stopAnimationState) return void stopAnimationState.call(this, "state", type);
|
|
6449
|
+
if (!this.mayHaveTrackedAnimates()) return;
|
|
6109
6450
|
const stateAnimates = [];
|
|
6110
6451
|
this.visitTrackedAnimates(animate => {
|
|
6111
6452
|
animate.stateNames && stateAnimates.push(animate);
|
|
@@ -6118,19 +6459,25 @@ class Graphic extends Node {
|
|
|
6118
6459
|
}
|
|
6119
6460
|
clearStates(hasAnimation) {
|
|
6120
6461
|
var _a, _b, _c;
|
|
6121
|
-
const previousStates =
|
|
6122
|
-
previousResolvedStatePatch = this.resolvedStatePatch
|
|
6462
|
+
const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
|
|
6463
|
+
previousResolvedStatePatch = this.resolvedStatePatch,
|
|
6123
6464
|
transition = this.createStateModel().clearStates();
|
|
6124
6465
|
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
|
-
|
|
6466
|
+
const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
|
|
6467
|
+
if (!transition.changed || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0)) {
|
|
6468
|
+
if (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(), this.stage) {
|
|
6469
|
+
const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
|
|
6470
|
+
null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
|
|
6471
|
+
graphicId: this._uid,
|
|
6472
|
+
targetStates: []
|
|
6473
|
+
});
|
|
6474
|
+
}
|
|
6475
|
+
hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
6476
|
+
type: AttributeUpdateType.STATE
|
|
6477
|
+
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
|
|
6478
|
+
type: AttributeUpdateType.STATE
|
|
6479
|
+
}), this.emitStateUpdateEvent());
|
|
6480
|
+
}
|
|
6134
6481
|
}
|
|
6135
6482
|
removeState(stateName, hasAnimation) {
|
|
6136
6483
|
const transition = this.createStateModel().removeState(stateName);
|
|
@@ -6144,39 +6491,58 @@ class Graphic extends Node {
|
|
|
6144
6491
|
const transition = this.createStateModel().addState(stateName, keepCurrentStates);
|
|
6145
6492
|
transition.changed && this.useStates(transition.states, hasAnimation);
|
|
6146
6493
|
}
|
|
6494
|
+
setStates(states, hasAnimation) {
|
|
6495
|
+
var _a, _b, _c;
|
|
6496
|
+
const nextStates = (null == states ? void 0 : states.length) ? states : EMPTY_STATE_NAMES,
|
|
6497
|
+
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));
|
|
6498
|
+
if (nextStates.length) this.sameStateNames(this.currentStates, nextStates) ? this.sharedStateDirty && this.refreshSharedStateBeforeRender() : this.useStates(nextStates, hasAnimation);else {
|
|
6499
|
+
if (!hasCurrentState && !this.sharedStateDirty) return;
|
|
6500
|
+
this.clearStates(hasAnimation);
|
|
6501
|
+
}
|
|
6502
|
+
}
|
|
6147
6503
|
useStates(states, hasAnimation) {
|
|
6148
|
-
var _a, _b, _c, _d
|
|
6504
|
+
var _a, _b, _c, _d;
|
|
6149
6505
|
if (!states.length) return void this.clearStates(hasAnimation);
|
|
6150
|
-
const previousStates =
|
|
6151
|
-
previousResolvedStatePatch = this.resolvedStatePatch
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6506
|
+
const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
|
|
6507
|
+
previousResolvedStatePatch = this.resolvedStatePatch;
|
|
6508
|
+
let transition = this.resolveSimpleLocalStateTransition(states, previousStates);
|
|
6509
|
+
const isSimpleLocalTransition = !!transition;
|
|
6510
|
+
let resolvedStateAttrs;
|
|
6511
|
+
if (transition) {
|
|
6512
|
+
if (!transition.changed) return;
|
|
6513
|
+
resolvedStateAttrs = transition.resolvedStateAttrs;
|
|
6514
|
+
} else {
|
|
6515
|
+
const stateResolveBaseAttrs = null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : this.attribute,
|
|
6516
|
+
stateModel = this.createStateModel();
|
|
6517
|
+
if (null === (_c = this.stateEngine) || void 0 === _c || _c.setResolveContext(this, stateResolveBaseAttrs), transition = stateModel.useStates(states), !transition.changed && this.sameStateNames(previousStates, transition.states)) return;
|
|
6158
6518
|
resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6519
|
+
}
|
|
6520
|
+
const effectiveStates = null !== (_d = transition.effectiveStates) && void 0 !== _d ? _d : transition.states;
|
|
6521
|
+
if (this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) {
|
|
6522
|
+
if (this.currentStates = transition.states, this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stage) {
|
|
6523
|
+
const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
|
|
6524
|
+
null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
|
|
6525
|
+
graphicId: this._uid,
|
|
6526
|
+
targetStates: [...transition.states]
|
|
6527
|
+
});
|
|
6528
|
+
}
|
|
6529
|
+
hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
6530
|
+
type: AttributeUpdateType.STATE
|
|
6531
|
+
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
6532
|
+
type: AttributeUpdateType.STATE
|
|
6533
|
+
}), this.emitStateUpdateEvent());
|
|
6534
|
+
}
|
|
6167
6535
|
}
|
|
6168
6536
|
invalidateResolver() {
|
|
6169
|
-
var _a, _b;
|
|
6537
|
+
var _a, _b, _c;
|
|
6170
6538
|
if (!this.stateEngine || !(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.compiledStateDefinitions) return;
|
|
6171
6539
|
const stateResolveBaseAttrs = null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : this.attribute;
|
|
6172
|
-
this.stateEngine.setResolveContext(this, stateResolveBaseAttrs), this.resolverEpoch
|
|
6540
|
+
this.stateEngine.setResolveContext(this, stateResolveBaseAttrs), this.resolverEpoch = (null !== (_c = this.resolverEpoch) && void 0 !== _c ? _c : 0) + 1, this.stateEngine.invalidateResolverCache();
|
|
6173
6541
|
const transition = this.stateEngine.applyStates(this.currentStates),
|
|
6174
6542
|
resolvedStateAttrs = Object.assign({}, this.stateEngine.resolvedPatch);
|
|
6175
|
-
this.effectiveStates = [...transition.effectiveStates], this.resolvedStatePatch =
|
|
6543
|
+
this.effectiveStates = [...transition.effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
|
|
6176
6544
|
type: AttributeUpdateType.STATE
|
|
6177
|
-
}), this.
|
|
6178
|
-
type: AttributeUpdateType.STATE
|
|
6179
|
-
});
|
|
6545
|
+
}), this.emitStateUpdateEvent();
|
|
6180
6546
|
}
|
|
6181
6547
|
sameStateNames(left, right) {
|
|
6182
6548
|
const normalizedLeft = null != left ? left : [],
|
|
@@ -6197,6 +6563,9 @@ class Graphic extends Node {
|
|
|
6197
6563
|
addUpdateShapeAndBoundsTag() {
|
|
6198
6564
|
this._updateTag |= UpdateTag.UPDATE_SHAPE_AND_BOUNDS, this.parent && this.parent.addChildUpdateBoundTag(), this.glyphHost && this.glyphHost.addUpdateBoundTag();
|
|
6199
6565
|
}
|
|
6566
|
+
addBroadUpdateTag() {
|
|
6567
|
+
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();
|
|
6568
|
+
}
|
|
6200
6569
|
updateShapeAndBoundsTagSetted() {
|
|
6201
6570
|
return (this._updateTag & UpdateTag.UPDATE_SHAPE_AND_BOUNDS) === UpdateTag.UPDATE_SHAPE_AND_BOUNDS;
|
|
6202
6571
|
}
|
|
@@ -6284,13 +6653,13 @@ class Graphic extends Node {
|
|
|
6284
6653
|
}
|
|
6285
6654
|
}
|
|
6286
6655
|
setStage(stage, layer) {
|
|
6287
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6656
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
6288
6657
|
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
6658
|
previousStage = this.stage;
|
|
6290
6659
|
if (this.stage !== stage || this.layer !== layer) {
|
|
6291
|
-
if (this.stage = stage, this.layer = layer,
|
|
6292
|
-
const previousTimeline = null === (
|
|
6293
|
-
nextTimeline = null === (
|
|
6660
|
+
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()) {
|
|
6661
|
+
const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
|
|
6662
|
+
nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
|
|
6294
6663
|
detachedStageAnimates = [];
|
|
6295
6664
|
this.visitTrackedAnimates(a => {
|
|
6296
6665
|
(!!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 +6672,13 @@ class Graphic extends Node {
|
|
|
6303
6672
|
type: AttributeUpdateType.ANIMATE_END
|
|
6304
6673
|
}));
|
|
6305
6674
|
}
|
|
6306
|
-
return this._onSetStage && this._onSetStage(this, stage, layer), void (null === (
|
|
6675
|
+
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
6676
|
}
|
|
6308
|
-
|
|
6677
|
+
((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);
|
|
6678
|
+
}
|
|
6679
|
+
detachStageForRelease() {
|
|
6680
|
+
var _a, _b, _c;
|
|
6681
|
+
(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
6682
|
}
|
|
6310
6683
|
setStageToShadowRoot(stage, layer) {
|
|
6311
6684
|
this.shadowRoot && this.shadowRoot.setStage(stage, layer);
|
|
@@ -6372,6 +6745,7 @@ class Graphic extends Node {
|
|
|
6372
6745
|
res && (res.state = "fail", cb && cb());
|
|
6373
6746
|
}
|
|
6374
6747
|
_stopAnimates() {
|
|
6748
|
+
if (!this.mayHaveTrackedAnimates()) return;
|
|
6375
6749
|
const animates = [];
|
|
6376
6750
|
this.visitTrackedAnimates(animate => {
|
|
6377
6751
|
animates.push(animate);
|
|
@@ -6385,14 +6759,17 @@ class Graphic extends Node {
|
|
|
6385
6759
|
});
|
|
6386
6760
|
}
|
|
6387
6761
|
release() {
|
|
6388
|
-
var _a, _b, _c;
|
|
6389
|
-
this.releaseStatus = "released", this.clearSharedStateActiveRegistrations(), this.stopAnimates();
|
|
6390
|
-
const graphicService = null !== (
|
|
6391
|
-
null === (
|
|
6762
|
+
var _a, _b, _c, _d;
|
|
6763
|
+
this.releaseStatus = "released", (null === (_a = this.registeredActiveScopes) || void 0 === _a ? void 0 : _a.size) && this.clearSharedStateActiveRegistrations(), (this.mayHaveTrackedAnimates() || this.shadowRoot) && this.stopAnimates();
|
|
6764
|
+
const graphicService = null !== (_c = null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService;
|
|
6765
|
+
null === (_d = null == graphicService ? void 0 : graphicService.onRelease) || void 0 === _d || _d.call(graphicService, this), super.release();
|
|
6766
|
+
}
|
|
6767
|
+
hasCustomEvent(type) {
|
|
6768
|
+
return !!this._events && type in this._events;
|
|
6392
6769
|
}
|
|
6393
6770
|
_dispatchCustomEvent(type, context) {
|
|
6394
6771
|
var _a, _b;
|
|
6395
|
-
if (this.
|
|
6772
|
+
if (this.hasCustomEvent(type)) {
|
|
6396
6773
|
const changeEvent = new CustomEvent(type, context);
|
|
6397
6774
|
changeEvent.bubbles = !1;
|
|
6398
6775
|
const manager = null === (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem) || void 0 === _b ? void 0 : _b.manager;
|
|
@@ -6401,7 +6778,7 @@ class Graphic extends Node {
|
|
|
6401
6778
|
return !0;
|
|
6402
6779
|
}
|
|
6403
6780
|
beforeStateUpdate(attrs, prevStates, nextStates, hasAnimation, isClear) {
|
|
6404
|
-
return this._dispatchCustomEvent("beforeStateUpdate", {
|
|
6781
|
+
return !this.hasCustomEvent("beforeStateUpdate") || this._dispatchCustomEvent("beforeStateUpdate", {
|
|
6405
6782
|
type: AttributeUpdateType.STATE,
|
|
6406
6783
|
attrs: Object.assign({}, attrs),
|
|
6407
6784
|
prevStates: prevStates.slice(),
|
|
@@ -6410,6 +6787,11 @@ class Graphic extends Node {
|
|
|
6410
6787
|
isClear: !!isClear
|
|
6411
6788
|
});
|
|
6412
6789
|
}
|
|
6790
|
+
emitStateUpdateEvent() {
|
|
6791
|
+
this.hasCustomEvent("afterStateUpdate") && this._emitCustomEvent("afterStateUpdate", {
|
|
6792
|
+
type: AttributeUpdateType.STATE
|
|
6793
|
+
});
|
|
6794
|
+
}
|
|
6413
6795
|
_emitCustomEvent(type, context) {
|
|
6414
6796
|
this._dispatchCustomEvent(type, context);
|
|
6415
6797
|
}
|
|
@@ -9096,13 +9478,15 @@ var GroupUpdateAABBBoundsMode;
|
|
|
9096
9478
|
}(GroupUpdateAABBBoundsMode || (GroupUpdateAABBBoundsMode = {}));
|
|
9097
9479
|
class Group extends Graphic {
|
|
9098
9480
|
constructor(params) {
|
|
9099
|
-
super(params), this.type = "group", this.parent = null, this.isContainer = !0, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
|
|
9481
|
+
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
9482
|
}
|
|
9101
9483
|
get sharedStateDefinitions() {
|
|
9102
9484
|
return this._sharedStateDefinitions;
|
|
9103
9485
|
}
|
|
9104
9486
|
set sharedStateDefinitions(value) {
|
|
9105
|
-
|
|
9487
|
+
if (this._sharedStateDefinitions === value) return;
|
|
9488
|
+
const previousScope = this.sharedStateScope;
|
|
9489
|
+
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
9490
|
}
|
|
9107
9491
|
setMode(mode) {
|
|
9108
9492
|
"3d" === mode ? this.set3dMode() : this.set2dMode();
|
|
@@ -9227,9 +9611,10 @@ class Group extends Graphic {
|
|
|
9227
9611
|
insertInto(newNode, idx) {
|
|
9228
9612
|
return this._updateChildToStage(super.insertInto(newNode, idx));
|
|
9229
9613
|
}
|
|
9230
|
-
removeChild(child) {
|
|
9614
|
+
removeChild(child, highPerformance = !1) {
|
|
9615
|
+
var _a;
|
|
9231
9616
|
const data = super.removeChild(child);
|
|
9232
|
-
return this.getGraphicService().onRemove(child), child.setStage(null, null), this.addUpdateBoundTag(), data;
|
|
9617
|
+
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
9618
|
}
|
|
9234
9619
|
removeAllChild(deep = !1) {
|
|
9235
9620
|
const children = this.children.slice();
|
|
@@ -9241,11 +9626,13 @@ class Group extends Graphic {
|
|
|
9241
9626
|
}
|
|
9242
9627
|
setStage(stage, layer) {
|
|
9243
9628
|
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
|
-
|
|
9629
|
+
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,
|
|
9630
|
+
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;
|
|
9631
|
+
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
9632
|
item.setStage(stage, this.layer);
|
|
9247
9633
|
});
|
|
9248
|
-
|
|
9634
|
+
const layerChanged = this.layer !== layer;
|
|
9635
|
+
layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.forEachChildren(item => {
|
|
9249
9636
|
item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(stage, this.layer);
|
|
9250
9637
|
});
|
|
9251
9638
|
}
|
|
@@ -9292,15 +9679,29 @@ class Group extends Graphic {
|
|
|
9292
9679
|
g.release(all);
|
|
9293
9680
|
}), super.release();
|
|
9294
9681
|
}
|
|
9682
|
+
detachStageForRelease() {
|
|
9683
|
+
super.detachStageForRelease(), this.sharedStateScope = void 0, this.forEachChildren(item => {
|
|
9684
|
+
var _a;
|
|
9685
|
+
null === (_a = item.detachStageForRelease) || void 0 === _a || _a.call(item);
|
|
9686
|
+
});
|
|
9687
|
+
}
|
|
9295
9688
|
ensureSharedStateScopeBound() {
|
|
9296
9689
|
var _a, _b, _c;
|
|
9690
|
+
if (!this.hasSharedStateDefinitions()) return void (this.sharedStateScope = void 0);
|
|
9297
9691
|
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
9692
|
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
9693
|
}
|
|
9694
|
+
hasSharedStateDefinitions() {
|
|
9695
|
+
return this._hasSharedStateDefinitions;
|
|
9696
|
+
}
|
|
9697
|
+
notifyChildrenSharedStateTreeChanged() {
|
|
9698
|
+
this.forEachChildren(item => {
|
|
9699
|
+
item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(this.stage, this.layer);
|
|
9700
|
+
});
|
|
9701
|
+
}
|
|
9300
9702
|
onParentSharedStateTreeChanged(stage, layer) {
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
})) : this.setStage(stage, layer);
|
|
9703
|
+
var _a;
|
|
9704
|
+
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
9705
|
}
|
|
9305
9706
|
}
|
|
9306
9707
|
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
@@ -9488,7 +9889,10 @@ class DefaultGraphicService {
|
|
|
9488
9889
|
beforeUpdateAABBBounds: new SyncHook(["graphic", "stage", "willUpdate", "aabbBounds"]),
|
|
9489
9890
|
afterUpdateAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds", "globalAABBBounds", "selfChange"]),
|
|
9490
9891
|
clearAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds"])
|
|
9491
|
-
}, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds()
|
|
9892
|
+
}, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds(), this.tempAABBBoundsResult = {
|
|
9893
|
+
tb1: this.tempAABBBounds1,
|
|
9894
|
+
tb2: this.tempAABBBounds2
|
|
9895
|
+
};
|
|
9492
9896
|
}
|
|
9493
9897
|
onAttributeUpdate(graphic) {
|
|
9494
9898
|
this.hooks.onAttributeUpdate.taps.length && this.hooks.onAttributeUpdate.call(graphic);
|
|
@@ -9588,10 +9992,7 @@ class DefaultGraphicService {
|
|
|
9588
9992
|
updateTempAABBBounds(aabbBounds) {
|
|
9589
9993
|
const tb1 = this.tempAABBBounds1,
|
|
9590
9994
|
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
|
-
};
|
|
9995
|
+
return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.tempAABBBoundsResult;
|
|
9595
9996
|
}
|
|
9596
9997
|
}
|
|
9597
9998
|
|
|
@@ -12981,7 +13382,11 @@ const result = {
|
|
|
12981
13382
|
};
|
|
12982
13383
|
class BaseRender {
|
|
12983
13384
|
init(contributions) {
|
|
12984
|
-
|
|
13385
|
+
this.builtinContributions || (this.builtinContributions = []), this._renderContribitions = contributions ? contributions.getContributions().slice() : [];
|
|
13386
|
+
const addContribution = item => {
|
|
13387
|
+
this._renderContribitions.includes(item) || this._renderContribitions.push(item);
|
|
13388
|
+
};
|
|
13389
|
+
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
13390
|
}
|
|
12986
13391
|
reInit() {
|
|
12987
13392
|
this.init(this.graphicRenderContributions);
|
|
@@ -18378,6 +18783,47 @@ function commitUpdateAnimationTarget(graphic, targetAttrs, startAttrs) {
|
|
|
18378
18783
|
});
|
|
18379
18784
|
}
|
|
18380
18785
|
|
|
18786
|
+
function collectTrackedAnimates(graphic, animates = [], visited = new Set()) {
|
|
18787
|
+
var _a, _b, _c, _d, _e;
|
|
18788
|
+
const trackedAnimates = (_c = (_b = (_a = graphic).getTrackedAnimates) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : graphic.animates;
|
|
18789
|
+
trackedAnimates === null || trackedAnimates === void 0 ? void 0 : trackedAnimates.forEach((animate) => {
|
|
18790
|
+
if (animate && !visited.has(animate)) {
|
|
18791
|
+
visited.add(animate);
|
|
18792
|
+
animates.push(animate);
|
|
18793
|
+
}
|
|
18794
|
+
});
|
|
18795
|
+
(_e = (_d = graphic).forEachChildren) === null || _e === void 0 ? void 0 : _e.call(_d, (child) => {
|
|
18796
|
+
collectTrackedAnimates(child, animates, visited);
|
|
18797
|
+
});
|
|
18798
|
+
return animates;
|
|
18799
|
+
}
|
|
18800
|
+
function appendExitReleaseCallback(state, callback) {
|
|
18801
|
+
if (callback) {
|
|
18802
|
+
state === null || state === void 0 ? void 0 : state.onComplete.push(callback);
|
|
18803
|
+
}
|
|
18804
|
+
}
|
|
18805
|
+
function runExitReleaseCallbacks(callbacks) {
|
|
18806
|
+
callbacks.forEach(callback => {
|
|
18807
|
+
callback();
|
|
18808
|
+
});
|
|
18809
|
+
}
|
|
18810
|
+
function bindExitReleaseAnimates(exitAnimates, getState, finalize) {
|
|
18811
|
+
const finish = (animate) => {
|
|
18812
|
+
const state = getState();
|
|
18813
|
+
if (!state || state.finalized || !state.pendingAnimates.has(animate)) {
|
|
18814
|
+
return;
|
|
18815
|
+
}
|
|
18816
|
+
state.pendingAnimates.delete(animate);
|
|
18817
|
+
if (!state.pendingAnimates.size) {
|
|
18818
|
+
finalize();
|
|
18819
|
+
}
|
|
18820
|
+
};
|
|
18821
|
+
exitAnimates.forEach(animate => {
|
|
18822
|
+
animate.onEnd(() => finish(animate));
|
|
18823
|
+
animate.onRemove(() => finish(animate));
|
|
18824
|
+
});
|
|
18825
|
+
}
|
|
18826
|
+
|
|
18381
18827
|
const DefaultAxisAnimation = {
|
|
18382
18828
|
type: 'default',
|
|
18383
18829
|
duration: 300,
|
|
@@ -18423,7 +18869,101 @@ class AxisBase extends AnimateComponent {
|
|
|
18423
18869
|
this.attribute = currentAttribute;
|
|
18424
18870
|
return offscreenGroup.AABBBounds;
|
|
18425
18871
|
}
|
|
18872
|
+
_finalizeExitRelease() {
|
|
18873
|
+
var _a, _b;
|
|
18874
|
+
const state = this._exitReleaseState;
|
|
18875
|
+
if (state === null || state === void 0 ? void 0 : state.finalized) {
|
|
18876
|
+
return;
|
|
18877
|
+
}
|
|
18878
|
+
if (state) {
|
|
18879
|
+
state.finalized = true;
|
|
18880
|
+
}
|
|
18881
|
+
const parent = this.parent;
|
|
18882
|
+
const removeFromParent = !!(state === null || state === void 0 ? void 0 : state.removeFromParent);
|
|
18883
|
+
const callbacks = (_a = state === null || state === void 0 ? void 0 : state.onComplete) !== null && _a !== void 0 ? _a : [];
|
|
18884
|
+
this._exitReleaseState = undefined;
|
|
18885
|
+
this._prevInnerView = null;
|
|
18886
|
+
this._innerView = null;
|
|
18887
|
+
this.axisLabelsContainer = null;
|
|
18888
|
+
this.axisContainer = null;
|
|
18889
|
+
this.removeAllChild(true);
|
|
18890
|
+
super.release(true);
|
|
18891
|
+
if (removeFromParent) {
|
|
18892
|
+
(_b = (parent !== null && parent !== void 0 ? parent : this.parent)) === null || _b === void 0 ? void 0 : _b.removeChild(this);
|
|
18893
|
+
}
|
|
18894
|
+
runExitReleaseCallbacks(callbacks);
|
|
18895
|
+
}
|
|
18896
|
+
_runExitAnimationBeforeRelease(options = {}) {
|
|
18897
|
+
var _a, _b, _c;
|
|
18898
|
+
if (this._exitReleaseState && !this._exitReleaseState.finalized) {
|
|
18899
|
+
this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent;
|
|
18900
|
+
appendExitReleaseCallback(this._exitReleaseState, options.onComplete);
|
|
18901
|
+
return true;
|
|
18902
|
+
}
|
|
18903
|
+
if (!this.stage ||
|
|
18904
|
+
this.attribute.animation === false ||
|
|
18905
|
+
this.attribute.animationExit === false ||
|
|
18906
|
+
!this._innerView) {
|
|
18907
|
+
return false;
|
|
18908
|
+
}
|
|
18909
|
+
this._prepare();
|
|
18910
|
+
if (!((_a = this._animationConfig) === null || _a === void 0 ? void 0 : _a.exit)) {
|
|
18911
|
+
return false;
|
|
18912
|
+
}
|
|
18913
|
+
const exitTargets = new Set();
|
|
18914
|
+
traverseGroup(this._innerView, (el) => {
|
|
18915
|
+
if (el.type !== 'group') {
|
|
18916
|
+
exitTargets.add(el);
|
|
18917
|
+
}
|
|
18918
|
+
});
|
|
18919
|
+
if (!exitTargets.size) {
|
|
18920
|
+
return false;
|
|
18921
|
+
}
|
|
18922
|
+
const existingAnimates = collectTrackedAnimates(this);
|
|
18923
|
+
const { delay = 0, duration = DefaultAxisAnimation.duration, easing = DefaultAxisAnimation.easing } = this._animationConfig.exit;
|
|
18924
|
+
exitTargets.forEach(target => {
|
|
18925
|
+
var _a, _b, _c;
|
|
18926
|
+
const startAttrs = {
|
|
18927
|
+
opacity: (_a = target.attribute.opacity) !== null && _a !== void 0 ? _a : 1,
|
|
18928
|
+
fillOpacity: (_b = target.attribute.fillOpacity) !== null && _b !== void 0 ? _b : 1,
|
|
18929
|
+
strokeOpacity: (_c = target.attribute.strokeOpacity) !== null && _c !== void 0 ? _c : 1
|
|
18930
|
+
};
|
|
18931
|
+
const endAttrs = {
|
|
18932
|
+
opacity: 0,
|
|
18933
|
+
fillOpacity: 0,
|
|
18934
|
+
strokeOpacity: 0
|
|
18935
|
+
};
|
|
18936
|
+
commitUpdateAnimationTarget(target, endAttrs, startAttrs);
|
|
18937
|
+
target.animate().wait(delay).to(endAttrs, duration, easing);
|
|
18938
|
+
});
|
|
18939
|
+
const animates = collectTrackedAnimates(this);
|
|
18940
|
+
const exitAnimates = animates.filter(animate => !existingAnimates.includes(animate));
|
|
18941
|
+
if (!exitAnimates.length) {
|
|
18942
|
+
return false;
|
|
18943
|
+
}
|
|
18944
|
+
this.setAttribute('childrenPickable', false);
|
|
18945
|
+
(_c = (_b = this._innerView).removeAllEventListeners) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
18946
|
+
this.releaseStatus = 'willRelease';
|
|
18947
|
+
const pendingAnimates = new Set(exitAnimates);
|
|
18948
|
+
this._exitReleaseState = {
|
|
18949
|
+
pendingAnimates,
|
|
18950
|
+
finalized: false,
|
|
18951
|
+
removeFromParent: !!options.removeFromParent,
|
|
18952
|
+
onComplete: options.onComplete ? [options.onComplete] : []
|
|
18953
|
+
};
|
|
18954
|
+
bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease());
|
|
18955
|
+
return true;
|
|
18956
|
+
}
|
|
18957
|
+
releaseWithExitAnimation(options = {}) {
|
|
18958
|
+
if (this.releaseStatus === 'released') {
|
|
18959
|
+
return false;
|
|
18960
|
+
}
|
|
18961
|
+
return this._runExitAnimationBeforeRelease(options);
|
|
18962
|
+
}
|
|
18426
18963
|
render() {
|
|
18964
|
+
if (this._exitReleaseState) {
|
|
18965
|
+
return;
|
|
18966
|
+
}
|
|
18427
18967
|
this._prepare();
|
|
18428
18968
|
this._prevInnerView = this._innerView && getElMap(this._innerView);
|
|
18429
18969
|
this.removeAllChild(true);
|
|
@@ -18829,8 +19369,18 @@ class AxisBase extends AnimateComponent {
|
|
|
18829
19369
|
});
|
|
18830
19370
|
}
|
|
18831
19371
|
}
|
|
18832
|
-
release() {
|
|
18833
|
-
|
|
19372
|
+
release(all) {
|
|
19373
|
+
if (this._exitReleaseState) {
|
|
19374
|
+
this._finalizeExitRelease();
|
|
19375
|
+
return;
|
|
19376
|
+
}
|
|
19377
|
+
if (all) {
|
|
19378
|
+
this.removeAllChild(true);
|
|
19379
|
+
}
|
|
19380
|
+
super.release(all);
|
|
19381
|
+
if (all) {
|
|
19382
|
+
this.removeAllChild(true);
|
|
19383
|
+
}
|
|
18834
19384
|
this._prevInnerView = null;
|
|
18835
19385
|
this._innerView = null;
|
|
18836
19386
|
}
|
|
@@ -19522,17 +20072,35 @@ function commonInterpolateUpdate(key, from, to, ratio, step, target) {
|
|
|
19522
20072
|
return !1;
|
|
19523
20073
|
}
|
|
19524
20074
|
|
|
19525
|
-
|
|
19526
|
-
|
|
19527
|
-
}
|
|
20075
|
+
const animateUpdateContext = {
|
|
20076
|
+
type: AttributeUpdateType.ANIMATE_UPDATE
|
|
20077
|
+
},
|
|
20078
|
+
animateBindContext = {
|
|
20079
|
+
type: AttributeUpdateType.ANIMATE_BIND
|
|
20080
|
+
},
|
|
20081
|
+
animateStartContext = {
|
|
20082
|
+
type: AttributeUpdateType.ANIMATE_START
|
|
20083
|
+
};
|
|
20084
|
+
function getAnimationContext(type) {
|
|
20085
|
+
switch (type) {
|
|
20086
|
+
case AttributeUpdateType.ANIMATE_UPDATE:
|
|
20087
|
+
return animateUpdateContext;
|
|
20088
|
+
case AttributeUpdateType.ANIMATE_BIND:
|
|
20089
|
+
return animateBindContext;
|
|
20090
|
+
case AttributeUpdateType.ANIMATE_START:
|
|
20091
|
+
return animateStartContext;
|
|
20092
|
+
default:
|
|
20093
|
+
return {
|
|
20094
|
+
type: type
|
|
20095
|
+
};
|
|
20096
|
+
}
|
|
20097
|
+
}
|
|
19528
20098
|
function applyAnimationTransientAttributes(target, attributes, type = AttributeUpdateType.ANIMATE_UPDATE) {
|
|
19529
20099
|
var _a;
|
|
19530
20100
|
if (!attributes) return;
|
|
19531
|
-
const context =
|
|
19532
|
-
type: type
|
|
19533
|
-
},
|
|
20101
|
+
const context = getAnimationContext(type),
|
|
19534
20102
|
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);
|
|
20103
|
+
"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
20104
|
}
|
|
19537
20105
|
|
|
19538
20106
|
function noop() {}
|
|
@@ -19887,7 +20455,7 @@ class Animate {
|
|
|
19887
20455
|
bind(target) {
|
|
19888
20456
|
this.target = target;
|
|
19889
20457
|
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(() => {
|
|
20458
|
+
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
20459
|
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
20460
|
}), this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
|
|
19893
20461
|
}
|
|
@@ -20331,6 +20899,33 @@ class AnimateExecutor {
|
|
|
20331
20899
|
cb();
|
|
20332
20900
|
});
|
|
20333
20901
|
}
|
|
20902
|
+
getActiveAttrKeys() {
|
|
20903
|
+
const keys = [];
|
|
20904
|
+
for (let i = 0; i < this._animates.length; i++) {
|
|
20905
|
+
const animate = this._animates[i];
|
|
20906
|
+
if (animate.status === AnimateStatus.END) continue;
|
|
20907
|
+
const endProps = animate.getEndProps();
|
|
20908
|
+
if (endProps) for (const key in endProps) Object.prototype.hasOwnProperty.call(endProps, key) && keys.indexOf(key) < 0 && keys.push(key);
|
|
20909
|
+
}
|
|
20910
|
+
return keys;
|
|
20911
|
+
}
|
|
20912
|
+
hasActiveAttrs() {
|
|
20913
|
+
for (let i = 0; i < this._animates.length; i++) {
|
|
20914
|
+
const animate = this._animates[i];
|
|
20915
|
+
if (animate.status === AnimateStatus.END) continue;
|
|
20916
|
+
const endProps = animate.getEndProps();
|
|
20917
|
+
if (endProps) for (const key in endProps) if (Object.prototype.hasOwnProperty.call(endProps, key)) return !0;
|
|
20918
|
+
}
|
|
20919
|
+
return !1;
|
|
20920
|
+
}
|
|
20921
|
+
preventAttrs(keys) {
|
|
20922
|
+
if (!(null == keys ? void 0 : keys.length)) return this.hasActiveAttrs();
|
|
20923
|
+
for (let i = 0; i < this._animates.length; i++) {
|
|
20924
|
+
const animate = this._animates[i];
|
|
20925
|
+
animate.status !== AnimateStatus.END && animate.preventAttrs(keys);
|
|
20926
|
+
}
|
|
20927
|
+
return this.hasActiveAttrs();
|
|
20928
|
+
}
|
|
20334
20929
|
_trackAnimation(animate) {
|
|
20335
20930
|
this._animates.push(animate), this._activeCount++, 1 !== this._activeCount || this._started || (this._started = !0, this.onStart()), animate.onEnd(() => {
|
|
20336
20931
|
this._activeCount--;
|
|
@@ -20453,7 +21048,8 @@ class AnimateExecutor {
|
|
|
20453
21048
|
let parsedFromProps = null,
|
|
20454
21049
|
props = params.to,
|
|
20455
21050
|
from = params.from;
|
|
20456
|
-
|
|
21051
|
+
const commitAttrOutChannel = this.shouldCommitAttrOutChannel(type);
|
|
21052
|
+
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel)), from = parsedFromProps.from), parsedFromProps.attrOutChannel && graphic.setAttributes(parsedFromProps.attrOutChannel), this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
20457
21053
|
let totalDelay = 0;
|
|
20458
21054
|
oneByOneDelay && (totalDelay = oneByOneDelay * (count - index - 1));
|
|
20459
21055
|
const delayAfterValue = isFunction(delayAfter) ? delayAfter(null === (_h = null === (_g = graphic.context) || void 0 === _g ? void 0 : _g.data) || void 0 === _h ? void 0 : _h[0], graphic, {}) : delayAfter;
|
|
@@ -20516,7 +21112,8 @@ class AnimateExecutor {
|
|
|
20516
21112
|
let parsedFromProps = null,
|
|
20517
21113
|
props = effect.to,
|
|
20518
21114
|
from = effect.from;
|
|
20519
|
-
|
|
21115
|
+
const commitAttrOutChannel = this.shouldCommitAttrOutChannel(type);
|
|
21116
|
+
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel)), from = parsedFromProps.from), parsedFromProps.attrOutChannel && graphic.setAttributes(parsedFromProps.attrOutChannel);
|
|
20520
21117
|
const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
|
|
20521
21118
|
customType = effect.custom ? effect.customType : getCustomType(custom);
|
|
20522
21119
|
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
@@ -20530,11 +21127,14 @@ class AnimateExecutor {
|
|
|
20530
21127
|
interpolator(ratio, from, to, step, target, animate.target, customParams);
|
|
20531
21128
|
}, animate.to(props, duration, easing);
|
|
20532
21129
|
}
|
|
21130
|
+
shouldCommitAttrOutChannel(type) {
|
|
21131
|
+
return "update" !== type;
|
|
21132
|
+
}
|
|
20533
21133
|
createCustomAnimation(animate, CustomAnimateConstructor, from, props, duration, easing, customParams) {
|
|
20534
21134
|
const customAnimate = new CustomAnimateConstructor(from, props, duration, easing, customParams);
|
|
20535
21135
|
animate.play(customAnimate);
|
|
20536
21136
|
}
|
|
20537
|
-
createPropsFromChannel(channel, graphic) {
|
|
21137
|
+
createPropsFromChannel(channel, graphic, includeAttrOutChannel = !0) {
|
|
20538
21138
|
var _a;
|
|
20539
21139
|
const props = {};
|
|
20540
21140
|
let from = null;
|
|
@@ -20543,7 +21143,7 @@ class AnimateExecutor {
|
|
|
20543
21143
|
props: props,
|
|
20544
21144
|
attrOutChannel: null
|
|
20545
21145
|
};
|
|
20546
|
-
const attrOutChannel = {};
|
|
21146
|
+
const attrOutChannel = includeAttrOutChannel ? {} : null;
|
|
20547
21147
|
let hasAttrs = !1;
|
|
20548
21148
|
const diffAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs;
|
|
20549
21149
|
if (Array.isArray(channel) && (channel = channel.reduce((res, key) => (void 0 === diffAttrs[key] || (res[key] = {
|
|
@@ -20552,7 +21152,7 @@ class AnimateExecutor {
|
|
|
20552
21152
|
var _a, _b, _c, _d;
|
|
20553
21153
|
const config = channel[key];
|
|
20554
21154
|
void 0 !== config.to && ("function" == typeof config.to ? props[key] = config.to(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : props[key] = config.to), void 0 !== config.from && (from || (from = {}), "function" == typeof config.from ? from[key] = config.from(null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, {}) : from[key] = config.from);
|
|
20555
|
-
}), diffAttrs) for (const key in diffAttrs) {
|
|
21155
|
+
}), diffAttrs && attrOutChannel) for (const key in diffAttrs) {
|
|
20556
21156
|
const value = diffAttrs[key];
|
|
20557
21157
|
if (void 0 === value) continue;
|
|
20558
21158
|
props.hasOwnProperty(key) || !!(null == from ? void 0 : from.hasOwnProperty(key)) || (attrOutChannel[key] = value, hasAttrs = !0);
|
|
@@ -20631,8 +21231,22 @@ class AnimationStateManager {
|
|
|
20631
21231
|
hasTrackedAnimate() {
|
|
20632
21232
|
return this.trackedAnimates.size > 0;
|
|
20633
21233
|
}
|
|
21234
|
+
hasStateInfo(list, target) {
|
|
21235
|
+
for (let i = 0; i < list.length; i++) if (list[i] === target) return !0;
|
|
21236
|
+
return !1;
|
|
21237
|
+
}
|
|
21238
|
+
takeOverUpdateAttrs(nextState, currentStates, shouldStopState) {
|
|
21239
|
+
if (nextState.state !== AnimationStates.UPDATE || !currentStates.length) return;
|
|
21240
|
+
const nextKeys = nextState.executor.getActiveAttrKeys();
|
|
21241
|
+
if (nextKeys.length) for (let i = 0; i < currentStates.length; i++) {
|
|
21242
|
+
const currentState = currentStates[i];
|
|
21243
|
+
currentState.state !== AnimationStates.UPDATE || currentState === nextState || this.hasStateInfo(shouldStopState, currentState) || currentState.executor.preventAttrs(nextKeys) || (currentState.executor.stop(null, !1), shouldStopState.push(currentState));
|
|
21244
|
+
}
|
|
21245
|
+
}
|
|
20634
21246
|
applyState(nextState, animationConfig, callback) {
|
|
21247
|
+
var _a;
|
|
20635
21248
|
const registry = AnimationTransitionRegistry.getInstance(),
|
|
21249
|
+
currentStateList = null !== (_a = this.stateList) && void 0 !== _a ? _a : [],
|
|
20636
21250
|
shouldStopState = [],
|
|
20637
21251
|
shouldApplyState = [];
|
|
20638
21252
|
if (this.stateList && this.stateList.length ? nextState.forEach((state, index) => {
|
|
@@ -20640,14 +21254,14 @@ class AnimationStateManager {
|
|
|
20640
21254
|
allowTransition: !0,
|
|
20641
21255
|
stopOriginalTransition: !0
|
|
20642
21256
|
};
|
|
20643
|
-
|
|
21257
|
+
currentStateList.forEach(currState => {
|
|
20644
21258
|
const _result = registry.isTransitionAllowed(currState.state, state, this.graphic);
|
|
20645
21259
|
result.allowTransition = result.allowTransition && _result.allowTransition;
|
|
20646
21260
|
}), result.allowTransition && (shouldApplyState.push({
|
|
20647
21261
|
state: state,
|
|
20648
21262
|
animationConfig: isArray(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
|
|
20649
21263
|
executor: new AnimateExecutor(this.graphic)
|
|
20650
|
-
}),
|
|
21264
|
+
}), currentStateList.forEach(currState => {
|
|
20651
21265
|
registry.isTransitionAllowed(currState.state, state, this.graphic).stopOriginalTransition && shouldStopState.push(currState);
|
|
20652
21266
|
}));
|
|
20653
21267
|
}) : nextState.forEach((state, index) => {
|
|
@@ -20659,12 +21273,18 @@ class AnimationStateManager {
|
|
|
20659
21273
|
}), shouldStopState.forEach(state => {
|
|
20660
21274
|
state.executor.stop(null, !1);
|
|
20661
21275
|
}), shouldApplyState.length) {
|
|
20662
|
-
shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig);
|
|
21276
|
+
shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig), this.takeOverUpdateAttrs(shouldApplyState[0], currentStateList, shouldStopState);
|
|
20663
21277
|
for (let i = 0; i < shouldApplyState.length; i++) {
|
|
20664
21278
|
const nextState = shouldApplyState[i + 1],
|
|
20665
21279
|
currentState = shouldApplyState[i];
|
|
20666
21280
|
currentState.executor.onEnd(() => {
|
|
20667
|
-
|
|
21281
|
+
var _a;
|
|
21282
|
+
if (nextState) {
|
|
21283
|
+
nextState.executor.execute(nextState.animationConfig);
|
|
21284
|
+
const stoppedStates = [];
|
|
21285
|
+
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)));
|
|
21286
|
+
}
|
|
21287
|
+
this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
|
|
20668
21288
|
});
|
|
20669
21289
|
}
|
|
20670
21290
|
} else callback && callback(!0);
|
|
@@ -21774,8 +22394,8 @@ class LineAxis extends AxisBase {
|
|
|
21774
22394
|
}
|
|
21775
22395
|
return offset;
|
|
21776
22396
|
}
|
|
21777
|
-
release() {
|
|
21778
|
-
super.release();
|
|
22397
|
+
release(all) {
|
|
22398
|
+
super.release(all);
|
|
21779
22399
|
this._breaks = null;
|
|
21780
22400
|
}
|
|
21781
22401
|
}
|
|
@@ -23654,6 +24274,17 @@ function shiftY(texts, option) {
|
|
|
23654
24274
|
}
|
|
23655
24275
|
|
|
23656
24276
|
loadLabelComponent();
|
|
24277
|
+
function cloneAttributeSnapshot(value) {
|
|
24278
|
+
if (!isObject(value) || isArray(value)) {
|
|
24279
|
+
return value;
|
|
24280
|
+
}
|
|
24281
|
+
const snapshot = {};
|
|
24282
|
+
Object.keys(value).forEach(key => {
|
|
24283
|
+
const nextValue = value[key];
|
|
24284
|
+
snapshot[key] = isObject(nextValue) && !isArray(nextValue) ? cloneAttributeSnapshot(nextValue) : nextValue;
|
|
24285
|
+
});
|
|
24286
|
+
return snapshot;
|
|
24287
|
+
}
|
|
23657
24288
|
class LabelBase extends AnimateComponent {
|
|
23658
24289
|
setBitmap(bitmap) {
|
|
23659
24290
|
this._bitmap = bitmap;
|
|
@@ -23752,7 +24383,92 @@ class LabelBase extends AnimateComponent {
|
|
|
23752
24383
|
return lineGraphic;
|
|
23753
24384
|
}
|
|
23754
24385
|
}
|
|
24386
|
+
_finalizeExitRelease() {
|
|
24387
|
+
var _a, _b, _c, _d;
|
|
24388
|
+
const state = this._exitReleaseState;
|
|
24389
|
+
if (state === null || state === void 0 ? void 0 : state.finalized) {
|
|
24390
|
+
return;
|
|
24391
|
+
}
|
|
24392
|
+
if (state) {
|
|
24393
|
+
state.finalized = true;
|
|
24394
|
+
}
|
|
24395
|
+
const parent = this.parent;
|
|
24396
|
+
const removeFromParent = !!(state === null || state === void 0 ? void 0 : state.removeFromParent);
|
|
24397
|
+
const callbacks = (_a = state === null || state === void 0 ? void 0 : state.onComplete) !== null && _a !== void 0 ? _a : [];
|
|
24398
|
+
this._exitReleaseState = undefined;
|
|
24399
|
+
this._graphicToText = new Map();
|
|
24400
|
+
(_b = this._idToGraphic) === null || _b === void 0 ? void 0 : _b.clear();
|
|
24401
|
+
(_c = this._idToPoint) === null || _c === void 0 ? void 0 : _c.clear();
|
|
24402
|
+
this._baseMarks = undefined;
|
|
24403
|
+
this.removeAllChild(true);
|
|
24404
|
+
super.release(true);
|
|
24405
|
+
if (removeFromParent) {
|
|
24406
|
+
(_d = (parent !== null && parent !== void 0 ? parent : this.parent)) === null || _d === void 0 ? void 0 : _d.removeChild(this);
|
|
24407
|
+
}
|
|
24408
|
+
runExitReleaseCallbacks(callbacks);
|
|
24409
|
+
}
|
|
24410
|
+
_runExitAnimationBeforeRelease(options = {}) {
|
|
24411
|
+
var _a, _b;
|
|
24412
|
+
if (this._exitReleaseState && !this._exitReleaseState.finalized) {
|
|
24413
|
+
this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent;
|
|
24414
|
+
appendExitReleaseCallback(this._exitReleaseState, options.onComplete);
|
|
24415
|
+
return true;
|
|
24416
|
+
}
|
|
24417
|
+
if (!this.stage ||
|
|
24418
|
+
this.attribute.animation === false ||
|
|
24419
|
+
this.attribute.animationExit === false ||
|
|
24420
|
+
!((_a = this._graphicToText) === null || _a === void 0 ? void 0 : _a.size)) {
|
|
24421
|
+
return false;
|
|
24422
|
+
}
|
|
24423
|
+
this._prepareAnimate(DefaultLabelAnimation);
|
|
24424
|
+
if (!((_b = this._animationConfig) === null || _b === void 0 ? void 0 : _b.exit)) {
|
|
24425
|
+
return false;
|
|
24426
|
+
}
|
|
24427
|
+
const exitTargets = new Set();
|
|
24428
|
+
this._graphicToText.forEach(label => {
|
|
24429
|
+
(label === null || label === void 0 ? void 0 : label.text) && exitTargets.add(label.text);
|
|
24430
|
+
(label === null || label === void 0 ? void 0 : label.labelLine) && exitTargets.add(label.labelLine);
|
|
24431
|
+
});
|
|
24432
|
+
if (!exitTargets.size) {
|
|
24433
|
+
return false;
|
|
24434
|
+
}
|
|
24435
|
+
const existingAnimates = collectTrackedAnimates(this);
|
|
24436
|
+
exitTargets.forEach(target => {
|
|
24437
|
+
var _a;
|
|
24438
|
+
target.applyAnimationState(['exit'], [
|
|
24439
|
+
{
|
|
24440
|
+
name: 'exit',
|
|
24441
|
+
animation: Object.assign(Object.assign({}, this._animationConfig.exit), { type: (_a = this._animationConfig.exit.type) !== null && _a !== void 0 ? _a : 'fadeOut', selfOnly: true })
|
|
24442
|
+
}
|
|
24443
|
+
]);
|
|
24444
|
+
});
|
|
24445
|
+
const animates = collectTrackedAnimates(this);
|
|
24446
|
+
const exitAnimates = animates.filter(animate => !existingAnimates.includes(animate));
|
|
24447
|
+
if (!exitAnimates.length) {
|
|
24448
|
+
return false;
|
|
24449
|
+
}
|
|
24450
|
+
this.setAttribute('childrenPickable', false);
|
|
24451
|
+
this.releaseStatus = 'willRelease';
|
|
24452
|
+
const pendingAnimates = new Set(exitAnimates);
|
|
24453
|
+
this._exitReleaseState = {
|
|
24454
|
+
pendingAnimates,
|
|
24455
|
+
finalized: false,
|
|
24456
|
+
removeFromParent: !!options.removeFromParent,
|
|
24457
|
+
onComplete: options.onComplete ? [options.onComplete] : []
|
|
24458
|
+
};
|
|
24459
|
+
bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease());
|
|
24460
|
+
return true;
|
|
24461
|
+
}
|
|
24462
|
+
releaseWithExitAnimation(options = {}) {
|
|
24463
|
+
if (this.releaseStatus === 'released') {
|
|
24464
|
+
return false;
|
|
24465
|
+
}
|
|
24466
|
+
return this._runExitAnimationBeforeRelease(options);
|
|
24467
|
+
}
|
|
23755
24468
|
render() {
|
|
24469
|
+
if (this._exitReleaseState) {
|
|
24470
|
+
return;
|
|
24471
|
+
}
|
|
23756
24472
|
this._prepare();
|
|
23757
24473
|
if (isNil(this._idToGraphic) || (this._isCollectionBase && isNil(this._idToPoint))) {
|
|
23758
24474
|
return;
|
|
@@ -23760,7 +24476,7 @@ class LabelBase extends AnimateComponent {
|
|
|
23760
24476
|
const markAttributeList = [];
|
|
23761
24477
|
if (this._enableAnimation !== false) {
|
|
23762
24478
|
this._baseMarks.forEach(mark => {
|
|
23763
|
-
markAttributeList.push(mark.attribute);
|
|
24479
|
+
markAttributeList.push(cloneAttributeSnapshot(mark.attribute));
|
|
23764
24480
|
mark.initAttributes(mark.getAttributes(true));
|
|
23765
24481
|
});
|
|
23766
24482
|
}
|
|
@@ -24442,6 +25158,21 @@ class LabelBase extends AnimateComponent {
|
|
|
24442
25158
|
}
|
|
24443
25159
|
return shapeBound.encloses(textBound);
|
|
24444
25160
|
}
|
|
25161
|
+
release(all) {
|
|
25162
|
+
var _a, _b;
|
|
25163
|
+
if (this._exitReleaseState) {
|
|
25164
|
+
this._finalizeExitRelease();
|
|
25165
|
+
return;
|
|
25166
|
+
}
|
|
25167
|
+
if (all) {
|
|
25168
|
+
this.removeAllChild(true);
|
|
25169
|
+
}
|
|
25170
|
+
super.release(all);
|
|
25171
|
+
this._graphicToText = new Map();
|
|
25172
|
+
(_a = this._idToGraphic) === null || _a === void 0 ? void 0 : _a.clear();
|
|
25173
|
+
(_b = this._idToPoint) === null || _b === void 0 ? void 0 : _b.clear();
|
|
25174
|
+
this._baseMarks = undefined;
|
|
25175
|
+
}
|
|
24445
25176
|
setLocation(point) {
|
|
24446
25177
|
this.translateTo(point.x, point.y);
|
|
24447
25178
|
}
|
|
@@ -25402,6 +26133,9 @@ class DataLabel extends AbstractComponent {
|
|
|
25402
26133
|
}
|
|
25403
26134
|
render() {
|
|
25404
26135
|
var _a;
|
|
26136
|
+
if (this._exitReleaseState) {
|
|
26137
|
+
return;
|
|
26138
|
+
}
|
|
25405
26139
|
const { dataLabels, size } = this.attribute;
|
|
25406
26140
|
if (!dataLabels || dataLabels.length === 0) {
|
|
25407
26141
|
return;
|
|
@@ -25450,6 +26184,101 @@ class DataLabel extends AbstractComponent {
|
|
|
25450
26184
|
});
|
|
25451
26185
|
this._componentMap = currentComponentMap;
|
|
25452
26186
|
}
|
|
26187
|
+
_finalizeExitRelease() {
|
|
26188
|
+
var _a, _b, _c;
|
|
26189
|
+
const state = this._exitReleaseState;
|
|
26190
|
+
if (state === null || state === void 0 ? void 0 : state.finalized) {
|
|
26191
|
+
return;
|
|
26192
|
+
}
|
|
26193
|
+
if (state) {
|
|
26194
|
+
state.finalized = true;
|
|
26195
|
+
}
|
|
26196
|
+
const parent = this.parent;
|
|
26197
|
+
const removeFromParent = !!(state === null || state === void 0 ? void 0 : state.removeFromParent);
|
|
26198
|
+
const callbacks = (_a = state === null || state === void 0 ? void 0 : state.onComplete) !== null && _a !== void 0 ? _a : [];
|
|
26199
|
+
this._exitReleaseState = undefined;
|
|
26200
|
+
(_b = this._componentMap) === null || _b === void 0 ? void 0 : _b.clear();
|
|
26201
|
+
this.removeAllChild(true);
|
|
26202
|
+
super.release(true);
|
|
26203
|
+
if (removeFromParent) {
|
|
26204
|
+
(_c = (parent !== null && parent !== void 0 ? parent : this.parent)) === null || _c === void 0 ? void 0 : _c.removeChild(this);
|
|
26205
|
+
}
|
|
26206
|
+
runExitReleaseCallbacks(callbacks);
|
|
26207
|
+
}
|
|
26208
|
+
releaseWithExitAnimation(options = {}) {
|
|
26209
|
+
var _a;
|
|
26210
|
+
if (this.releaseStatus === 'released') {
|
|
26211
|
+
return false;
|
|
26212
|
+
}
|
|
26213
|
+
if (this._exitReleaseState && !this._exitReleaseState.finalized) {
|
|
26214
|
+
this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent;
|
|
26215
|
+
appendExitReleaseCallback(this._exitReleaseState, options.onComplete);
|
|
26216
|
+
return true;
|
|
26217
|
+
}
|
|
26218
|
+
if (!this.stage || !((_a = this._componentMap) === null || _a === void 0 ? void 0 : _a.size)) {
|
|
26219
|
+
return false;
|
|
26220
|
+
}
|
|
26221
|
+
const state = {
|
|
26222
|
+
pendingCount: 0,
|
|
26223
|
+
finalized: false,
|
|
26224
|
+
removeFromParent: !!options.removeFromParent,
|
|
26225
|
+
onComplete: options.onComplete ? [options.onComplete] : []
|
|
26226
|
+
};
|
|
26227
|
+
const exitingComponents = [];
|
|
26228
|
+
const fallbackComponents = [];
|
|
26229
|
+
let initializing = true;
|
|
26230
|
+
const finish = () => {
|
|
26231
|
+
if (state.finalized) {
|
|
26232
|
+
return;
|
|
26233
|
+
}
|
|
26234
|
+
state.pendingCount -= 1;
|
|
26235
|
+
if (state.pendingCount <= 0 && !initializing) {
|
|
26236
|
+
this._finalizeExitRelease();
|
|
26237
|
+
}
|
|
26238
|
+
};
|
|
26239
|
+
this._exitReleaseState = state;
|
|
26240
|
+
this._componentMap.forEach(component => {
|
|
26241
|
+
state.pendingCount += 1;
|
|
26242
|
+
const releasedWithExit = component.releaseWithExitAnimation({
|
|
26243
|
+
removeFromParent: false,
|
|
26244
|
+
onComplete: finish
|
|
26245
|
+
});
|
|
26246
|
+
if (releasedWithExit) {
|
|
26247
|
+
exitingComponents.push(component);
|
|
26248
|
+
}
|
|
26249
|
+
else {
|
|
26250
|
+
state.pendingCount -= 1;
|
|
26251
|
+
fallbackComponents.push(component);
|
|
26252
|
+
}
|
|
26253
|
+
});
|
|
26254
|
+
if (!exitingComponents.length) {
|
|
26255
|
+
this._exitReleaseState = undefined;
|
|
26256
|
+
return false;
|
|
26257
|
+
}
|
|
26258
|
+
fallbackComponents.forEach(component => {
|
|
26259
|
+
component.release(true);
|
|
26260
|
+
this.removeChild(component);
|
|
26261
|
+
});
|
|
26262
|
+
this.setAttribute('childrenPickable', false);
|
|
26263
|
+
this.releaseStatus = 'willRelease';
|
|
26264
|
+
initializing = false;
|
|
26265
|
+
if (state.pendingCount <= 0) {
|
|
26266
|
+
this._finalizeExitRelease();
|
|
26267
|
+
}
|
|
26268
|
+
return true;
|
|
26269
|
+
}
|
|
26270
|
+
release(all) {
|
|
26271
|
+
var _a;
|
|
26272
|
+
if (this._exitReleaseState) {
|
|
26273
|
+
this._finalizeExitRelease();
|
|
26274
|
+
return;
|
|
26275
|
+
}
|
|
26276
|
+
if (all) {
|
|
26277
|
+
this.removeAllChild(true);
|
|
26278
|
+
}
|
|
26279
|
+
super.release(all);
|
|
26280
|
+
(_a = this._componentMap) === null || _a === void 0 ? void 0 : _a.clear();
|
|
26281
|
+
}
|
|
25453
26282
|
setLocation(point) {
|
|
25454
26283
|
this.translateTo(point.x, point.y);
|
|
25455
26284
|
}
|
|
@@ -27159,15 +27988,95 @@ class Marker extends AbstractComponent {
|
|
|
27159
27988
|
y: clipInRange ? -((_b = limitRect.y) !== null && _b !== void 0 ? _b : 0) : 0
|
|
27160
27989
|
});
|
|
27161
27990
|
}
|
|
27162
|
-
|
|
27991
|
+
_finalizeExitRelease() {
|
|
27992
|
+
var _a, _b;
|
|
27993
|
+
const state = this._exitReleaseState;
|
|
27994
|
+
if (state === null || state === void 0 ? void 0 : state.finalized) {
|
|
27995
|
+
return;
|
|
27996
|
+
}
|
|
27997
|
+
if (state) {
|
|
27998
|
+
state.finalized = true;
|
|
27999
|
+
}
|
|
28000
|
+
const parent = this.parent;
|
|
28001
|
+
const removeFromParent = !!(state === null || state === void 0 ? void 0 : state.removeFromParent);
|
|
28002
|
+
const releaseSelf = !!(state === null || state === void 0 ? void 0 : state.releaseSelf);
|
|
28003
|
+
const callbacks = (_a = state === null || state === void 0 ? void 0 : state.onComplete) !== null && _a !== void 0 ? _a : [];
|
|
28004
|
+
this._exitReleaseState = undefined;
|
|
28005
|
+
this._releaseEvent();
|
|
28006
|
+
this._container = null;
|
|
28007
|
+
this._containerClip = null;
|
|
28008
|
+
this.removeAllChild(true);
|
|
28009
|
+
if (releaseSelf) {
|
|
28010
|
+
super.release(true);
|
|
28011
|
+
if (removeFromParent) {
|
|
28012
|
+
(_b = (parent !== null && parent !== void 0 ? parent : this.parent)) === null || _b === void 0 ? void 0 : _b.removeChild(this);
|
|
28013
|
+
}
|
|
28014
|
+
}
|
|
28015
|
+
runExitReleaseCallbacks(callbacks);
|
|
28016
|
+
}
|
|
28017
|
+
_runExitAnimationBeforeCleanup(options = {}) {
|
|
27163
28018
|
var _a;
|
|
28019
|
+
const releaseSelf = !!options.releaseSelf;
|
|
28020
|
+
if (this._exitReleaseState && !this._exitReleaseState.finalized) {
|
|
28021
|
+
this._exitReleaseState.releaseSelf = this._exitReleaseState.releaseSelf || releaseSelf;
|
|
28022
|
+
this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent;
|
|
28023
|
+
appendExitReleaseCallback(this._exitReleaseState, options.onComplete);
|
|
28024
|
+
return true;
|
|
28025
|
+
}
|
|
28026
|
+
if (!this.stage ||
|
|
28027
|
+
this.attribute.animation === false ||
|
|
28028
|
+
this.attribute.animationExit === false ||
|
|
28029
|
+
!this._container) {
|
|
28030
|
+
return false;
|
|
28031
|
+
}
|
|
28032
|
+
this.transAnimationConfig();
|
|
28033
|
+
if (!((_a = this._animationConfig) === null || _a === void 0 ? void 0 : _a.exit)) {
|
|
28034
|
+
return false;
|
|
28035
|
+
}
|
|
28036
|
+
const existingAnimates = collectTrackedAnimates(this);
|
|
28037
|
+
this.markerAnimate('exit');
|
|
28038
|
+
const animates = collectTrackedAnimates(this);
|
|
28039
|
+
const exitAnimates = animates.filter(animate => !existingAnimates.includes(animate));
|
|
28040
|
+
if (!exitAnimates.length) {
|
|
28041
|
+
return false;
|
|
28042
|
+
}
|
|
28043
|
+
this._releaseEvent();
|
|
28044
|
+
this.setAttribute('childrenPickable', false);
|
|
28045
|
+
if (releaseSelf) {
|
|
28046
|
+
this.releaseStatus = 'willRelease';
|
|
28047
|
+
}
|
|
28048
|
+
const pendingAnimates = new Set(exitAnimates);
|
|
28049
|
+
this._exitReleaseState = {
|
|
28050
|
+
pendingAnimates,
|
|
28051
|
+
finalized: false,
|
|
28052
|
+
releaseSelf,
|
|
28053
|
+
removeFromParent: !!options.removeFromParent,
|
|
28054
|
+
onComplete: options.onComplete ? [options.onComplete] : []
|
|
28055
|
+
};
|
|
28056
|
+
bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease());
|
|
28057
|
+
return true;
|
|
28058
|
+
}
|
|
28059
|
+
releaseWithExitAnimation(options = {}) {
|
|
28060
|
+
if (this.releaseStatus === 'released') {
|
|
28061
|
+
return false;
|
|
28062
|
+
}
|
|
28063
|
+
return this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({}, options), { releaseSelf: true }));
|
|
28064
|
+
}
|
|
28065
|
+
render() {
|
|
28066
|
+
var _a, _b;
|
|
28067
|
+
if ((_a = this._exitReleaseState) === null || _a === void 0 ? void 0 : _a.releaseSelf) {
|
|
28068
|
+
return;
|
|
28069
|
+
}
|
|
27164
28070
|
this.transAnimationConfig();
|
|
27165
28071
|
this.setAttribute('pickable', false);
|
|
27166
|
-
const markerVisible = (
|
|
28072
|
+
const markerVisible = (_b = this.attribute.visible) !== null && _b !== void 0 ? _b : true;
|
|
27167
28073
|
if (this.attribute.interactive === false) {
|
|
27168
28074
|
this.setAttribute('childrenPickable', false);
|
|
27169
28075
|
}
|
|
27170
28076
|
if (markerVisible && this.isValidPoints()) {
|
|
28077
|
+
if (this._exitReleaseState) {
|
|
28078
|
+
this._finalizeExitRelease();
|
|
28079
|
+
}
|
|
27171
28080
|
if (!this._container) {
|
|
27172
28081
|
this._initContainer();
|
|
27173
28082
|
this.initMarker(this._container);
|
|
@@ -27180,18 +28089,30 @@ class Marker extends AbstractComponent {
|
|
|
27180
28089
|
}
|
|
27181
28090
|
}
|
|
27182
28091
|
else {
|
|
27183
|
-
this.
|
|
27184
|
-
|
|
27185
|
-
|
|
28092
|
+
if (!this._runExitAnimationBeforeCleanup()) {
|
|
28093
|
+
this._container = null;
|
|
28094
|
+
this._containerClip = null;
|
|
28095
|
+
this.removeAllChild(true);
|
|
28096
|
+
}
|
|
27186
28097
|
}
|
|
27187
28098
|
this._releaseEvent();
|
|
27188
28099
|
this._bindEvent();
|
|
27189
28100
|
}
|
|
27190
|
-
release() {
|
|
27191
|
-
this.
|
|
27192
|
-
|
|
28101
|
+
release(all) {
|
|
28102
|
+
if (this._exitReleaseState) {
|
|
28103
|
+
this._finalizeExitRelease();
|
|
28104
|
+
return;
|
|
28105
|
+
}
|
|
28106
|
+
if (this.attribute.animation !== false && this.attribute.animationExit !== false) {
|
|
28107
|
+
this.markerAnimate('exit');
|
|
28108
|
+
}
|
|
28109
|
+
if (all) {
|
|
28110
|
+
this.removeAllChild(true);
|
|
28111
|
+
}
|
|
28112
|
+
super.release(all);
|
|
27193
28113
|
this._releaseEvent();
|
|
27194
28114
|
this._container = null;
|
|
28115
|
+
this._containerClip = null;
|
|
27195
28116
|
}
|
|
27196
28117
|
}
|
|
27197
28118
|
|
|
@@ -29698,8 +30619,10 @@ class DiscreteLegend extends LegendBase {
|
|
|
29698
30619
|
? this.attribute.item.width
|
|
29699
30620
|
: innerGroupWidth + parsedPadding[1] + parsedPadding[3];
|
|
29700
30621
|
const itemGroupHeight = this._itemHeightByUser || innerGroupHeight + parsedPadding[0] + parsedPadding[2];
|
|
29701
|
-
itemGroup.
|
|
29702
|
-
|
|
30622
|
+
itemGroup.setAttributes({
|
|
30623
|
+
width: itemGroupWidth,
|
|
30624
|
+
height: itemGroupHeight
|
|
30625
|
+
});
|
|
29703
30626
|
focusShape && focusShape.setAttribute('visible', false);
|
|
29704
30627
|
innerGroup.translateTo(-innerGroupBounds.x1 + parsedPadding[3], -innerGroupBounds.y1 + parsedPadding[0]);
|
|
29705
30628
|
return itemGroup;
|
|
@@ -31685,9 +32608,11 @@ class Title extends AbstractComponent {
|
|
|
31685
32608
|
totalHeight = maxHeight;
|
|
31686
32609
|
}
|
|
31687
32610
|
}
|
|
31688
|
-
group.
|
|
31689
|
-
|
|
31690
|
-
|
|
32611
|
+
group.setAttributes({
|
|
32612
|
+
width: totalWidth,
|
|
32613
|
+
height: totalHeight,
|
|
32614
|
+
boundsPadding: parsedPadding
|
|
32615
|
+
});
|
|
31691
32616
|
if (this._mainTitle) {
|
|
31692
32617
|
if (isValid(align) || isValid(textStyle.align)) {
|
|
31693
32618
|
const mainTitleAlign = textStyle.align ? textStyle.align : align;
|
|
@@ -35772,6 +36697,6 @@ TableSeriesNumber.defaultAttributes = {
|
|
|
35772
36697
|
select: true
|
|
35773
36698
|
};
|
|
35774
36699
|
|
|
35775
|
-
const version = "1.1.0-alpha.
|
|
36700
|
+
const version = "1.1.0-alpha.17";
|
|
35776
36701
|
|
|
35777
36702
|
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 };
|