targetj 1.0.260 → 1.1.0
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/Export.js +3 -0
- package/build/AnimationManager.js +1 -1
- package/build/App.js +10 -2
- package/build/BaseModel.js +8 -4
- package/build/Bracket.js +7 -1
- package/build/EventListener.js +10 -1
- package/build/LocationManager.js +137 -46
- package/build/PageManager.js +35 -134
- package/build/ParticleChild.js +575 -0
- package/build/ParticleRenderer.js +249 -68
- package/build/ParticleRuntime.js +898 -283
- package/build/ParticleTModel.js +610 -227
- package/build/ParticleUtil.js +119 -171
- package/build/RunScheduler.js +10 -3
- package/build/StateManager.js +81 -24
- package/build/StateUtil.js +1 -1
- package/build/TModel.js +1 -1
- package/build/TModelManager.js +105 -90
- package/build/TModelUtil.js +11 -8
- package/build/TUtil.js +57 -52
- package/build/TargetData.js +6 -0
- package/build/TargetExecutor.js +11 -3
- package/build/TargetManager.js +34 -21
- package/build/TargetParser.js +21 -2
- package/build/TargetUtil.js +24 -3
- package/build/VisibilityUtil.js +4 -2
- package/build/index.js +1 -0
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/build/ParticleTModel.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
1
5
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
2
6
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
7
|
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
4
8
|
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
5
|
-
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
6
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
9
9
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
10
10
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
11
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -36,10 +36,11 @@ import { TModelFactory } from "./TModelFactory.js";
|
|
|
36
36
|
import { ParticleRenderer } from "./ParticleRenderer.js";
|
|
37
37
|
import { ParticleRuntime } from "./ParticleRuntime.js";
|
|
38
38
|
import { ParticleUtil } from "./ParticleUtil.js";
|
|
39
|
+
import { ParticleChild } from "./ParticleChild.js";
|
|
39
40
|
import { TargetParser } from "./TargetParser.js";
|
|
40
41
|
import { TargetUtil } from "./TargetUtil.js";
|
|
41
42
|
import { TUtil } from "./TUtil.js";
|
|
42
|
-
import {
|
|
43
|
+
import { getRunScheduler } from "./App.js";
|
|
43
44
|
|
|
44
45
|
/**
|
|
45
46
|
* It provides a TModel that can render instanced addChildren values on the GPU.
|
|
@@ -50,23 +51,20 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
50
51
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
51
52
|
_classCallCheck(this, ParticleTModel);
|
|
52
53
|
_this = _callSuper(this, ParticleTModel, [type, targets, oid, options]);
|
|
53
|
-
_this.
|
|
54
|
+
_this.childActualValues = [];
|
|
55
|
+
_this.childTargetMaps = [];
|
|
54
56
|
_this.particleValuesDirty = false;
|
|
55
57
|
_this.particleRenderRequested = false;
|
|
56
58
|
_this.childHandles = [];
|
|
57
59
|
_this.childTargetValues = {};
|
|
58
60
|
_this.childTransitions = {};
|
|
59
61
|
_this.pendingGpuChildren = {};
|
|
60
|
-
|
|
61
|
-
/*
|
|
62
|
-
* Logical lightweight-child runtime state remains directly on the TModel
|
|
63
|
-
* so it can participate in runtime checkpointing.
|
|
64
|
-
*/
|
|
65
62
|
_this.childRuntimePrograms = [];
|
|
66
63
|
_this.childRuntimeStates = [];
|
|
67
64
|
_this.pendingGpuChildRuntimeCounts = {};
|
|
68
65
|
_this.activeChildTransitionKey = undefined;
|
|
69
66
|
_this.gpuChildrenEnabled = false;
|
|
67
|
+
_this.childGeneration = 0;
|
|
70
68
|
_this.layoutEpoch = 0;
|
|
71
69
|
_this.completeLayoutEpoch = -1;
|
|
72
70
|
_this.layoutCompleteWaiters = [];
|
|
@@ -173,7 +171,7 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
173
171
|
key: "syncParticleRendererNow",
|
|
174
172
|
value: function () {
|
|
175
173
|
var _syncParticleRendererNow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
176
|
-
var key, targetName, transition;
|
|
174
|
+
var key, targetName, transition, applied;
|
|
177
175
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
178
176
|
while (1) switch (_context3.prev = _context3.next) {
|
|
179
177
|
case 0:
|
|
@@ -183,12 +181,12 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
183
181
|
}
|
|
184
182
|
return _context3.abrupt("return", false);
|
|
185
183
|
case 2:
|
|
186
|
-
if (!this.
|
|
184
|
+
if (!this.childHandles.length) {
|
|
187
185
|
_context3.next = 7;
|
|
188
186
|
break;
|
|
189
187
|
}
|
|
190
188
|
_context3.next = 5;
|
|
191
|
-
return this.particleRenderer.setParticles(this.
|
|
189
|
+
return this.particleRenderer.setParticles(this.childHandles);
|
|
192
190
|
case 5:
|
|
193
191
|
_context3.next = 9;
|
|
194
192
|
break;
|
|
@@ -212,11 +210,14 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
212
210
|
return _context3.abrupt("return", true);
|
|
213
211
|
case 16:
|
|
214
212
|
_context3.next = 18;
|
|
215
|
-
return this.particleRenderer.setTargetParticles(transition.values, transition.steps);
|
|
213
|
+
return this.particleRenderer.setTargetParticles(transition.values, transition.steps, transition.generation);
|
|
216
214
|
case 18:
|
|
217
|
-
|
|
215
|
+
applied = _context3.sent;
|
|
216
|
+
if (applied && this.childTransitions[targetName] === transition) {
|
|
217
|
+
this.handleSpecialTargetStep(key);
|
|
218
|
+
}
|
|
218
219
|
return _context3.abrupt("return", true);
|
|
219
|
-
case
|
|
220
|
+
case 21:
|
|
220
221
|
case "end":
|
|
221
222
|
return _context3.stop();
|
|
222
223
|
}
|
|
@@ -237,9 +238,13 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
237
238
|
this.particleRenderRequested = true;
|
|
238
239
|
requestAnimationFrame(function () {
|
|
239
240
|
_this3.particleRenderRequested = false;
|
|
241
|
+
if (_this3.activeChildTransitionKey) {
|
|
242
|
+
_this3.particleRenderer.render();
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
240
245
|
if (_this3.particleValuesDirty) {
|
|
241
246
|
_this3.particleValuesDirty = false;
|
|
242
|
-
_this3.particleRenderer.updateParticles(_this3.
|
|
247
|
+
_this3.particleRenderer.updateParticles(_this3.childHandles);
|
|
243
248
|
} else {
|
|
244
249
|
_this3.particleRenderer.render();
|
|
245
250
|
}
|
|
@@ -265,7 +270,7 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
265
270
|
key = _ref2[0],
|
|
266
271
|
propertyValue = _ref2[1];
|
|
267
272
|
var cleanKey = TargetUtil.getTargetName(key);
|
|
268
|
-
return key === cleanKey &&
|
|
273
|
+
return key === cleanKey && ParticleUtil.isGpuTarget(cleanKey) && _this4.canRenderChildValue(propertyValue);
|
|
269
274
|
});
|
|
270
275
|
});
|
|
271
276
|
}
|
|
@@ -286,11 +291,6 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
286
291
|
}
|
|
287
292
|
return true;
|
|
288
293
|
}
|
|
289
|
-
}, {
|
|
290
|
-
key: "supportsChildTarget",
|
|
291
|
-
value: function supportsChildTarget(key) {
|
|
292
|
-
return ParticleUtil.isGpuRenderTarget(key);
|
|
293
|
-
}
|
|
294
294
|
}, {
|
|
295
295
|
key: "affectsChildLayout",
|
|
296
296
|
value: function affectsChildLayout(key) {
|
|
@@ -307,71 +307,56 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
307
307
|
}, {
|
|
308
308
|
key: "getChildren",
|
|
309
309
|
value: function getChildren() {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
}
|
|
313
|
-
return this.childHandles;
|
|
310
|
+
var children = _superPropGet(ParticleTModel, "getChildren", this, 3)([]);
|
|
311
|
+
return this.gpuChildrenEnabled ? [].concat(_toConsumableArray(children), _toConsumableArray(this.childHandles)) : children;
|
|
314
312
|
}
|
|
315
313
|
}, {
|
|
316
314
|
key: "getChildValue",
|
|
317
315
|
value: function getChildValue(index, key) {
|
|
318
|
-
var
|
|
319
|
-
|
|
316
|
+
var child = this.childHandles[index];
|
|
317
|
+
if (!child) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
var cleanKey = ParticleUtil.getTargetName(key);
|
|
321
|
+
if ((cleanKey === "x" || cleanKey === "y") && !child.allTargetMap[cleanKey]) {
|
|
322
|
+
return child[cleanKey];
|
|
323
|
+
}
|
|
324
|
+
return child.actualValues[cleanKey];
|
|
320
325
|
}
|
|
321
326
|
}, {
|
|
322
327
|
key: "setChildTarget",
|
|
323
|
-
value: function setChildTarget(index, key, target) {
|
|
324
|
-
var
|
|
325
|
-
var
|
|
326
|
-
var cleanKey =
|
|
327
|
-
|
|
328
|
+
value: function setChildTarget(index, key, target, steps, interval, easing) {
|
|
329
|
+
var originalTargetName = TargetUtil.currentTargetName;
|
|
330
|
+
var originalTModel = TargetUtil.currentTModel;
|
|
331
|
+
var cleanKey = ParticleUtil.getTargetName(key);
|
|
332
|
+
var child = this.childHandles[index];
|
|
333
|
+
if (!child) {
|
|
328
334
|
return;
|
|
329
335
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
var targetValues = (_this$childTargetValu2 = (_this$childTargetValu = this.childTargetValues)[targetName]) !== null && _this$childTargetValu2 !== void 0 ? _this$childTargetValu2 : _this$childTargetValu[targetName] = [];
|
|
334
|
-
var childValues = (_targetValues$index = targetValues[index]) !== null && _targetValues$index !== void 0 ? _targetValues$index : targetValues[index] = {};
|
|
335
|
-
childValues[cleanKey] = TargetParser.isTargetSpecObject(target) ? _objectSpread({}, target) : {
|
|
336
|
-
value: target
|
|
337
|
-
};
|
|
336
|
+
child.allTargetMap[cleanKey] = key;
|
|
337
|
+
this.childTargetMaps[index] = child.allTargetMap;
|
|
338
|
+
this.particleRuntime.setImperativeTarget(index, cleanKey, target, steps, interval, easing, originalTargetName, originalTModel);
|
|
338
339
|
}
|
|
339
340
|
}, {
|
|
340
341
|
key: "setChildValue",
|
|
341
342
|
value: function setChildValue(index, key, value) {
|
|
342
|
-
var
|
|
343
|
-
var childValues = this.particleValues[index];
|
|
344
|
-
if (!childValues || childValues[cleanKey] === value) {
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
childValues[cleanKey] = value;
|
|
348
|
-
this.particleValuesDirty = true;
|
|
349
|
-
if (this.affectsChildLayout(cleanKey)) {
|
|
350
|
-
this.invalidateChildrenLayout();
|
|
351
|
-
}
|
|
343
|
+
var invalidateLayout = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
352
344
|
var child = this.childHandles[index];
|
|
353
|
-
if (child) {
|
|
354
|
-
|
|
345
|
+
if (!child) {
|
|
346
|
+
return false;
|
|
355
347
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
value: function setChildLayoutValue(index, key, value) {
|
|
360
|
-
var _this$getScrollLeft, _this$getScrollTop;
|
|
361
|
-
var childValues = this.particleValues[index];
|
|
362
|
-
if (!childValues) {
|
|
363
|
-
return;
|
|
348
|
+
var cleanKey = ParticleUtil.getTargetName(key);
|
|
349
|
+
if (child.actualValues[cleanKey] === value) {
|
|
350
|
+
return false;
|
|
364
351
|
}
|
|
365
|
-
|
|
366
|
-
|
|
352
|
+
child.actualValues[cleanKey] = value;
|
|
353
|
+
if (ParticleUtil.isGpuTarget(cleanKey)) {
|
|
354
|
+
this.particleValuesDirty = true;
|
|
367
355
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
if (childValues[key] === layoutValue) {
|
|
371
|
-
return;
|
|
356
|
+
if (invalidateLayout && this.affectsChildLayout(cleanKey)) {
|
|
357
|
+
this.invalidateLayout();
|
|
372
358
|
}
|
|
373
|
-
|
|
374
|
-
this.particleValuesDirty = true;
|
|
359
|
+
return true;
|
|
375
360
|
}
|
|
376
361
|
}, {
|
|
377
362
|
key: "getChildTargetValues",
|
|
@@ -384,50 +369,155 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
384
369
|
var _this5 = this;
|
|
385
370
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
386
371
|
var targetName = TargetUtil.getTargetName(key);
|
|
387
|
-
var values = new Array(this.particleValues.length);
|
|
388
|
-
var steps = new Array(this.particleValues.length);
|
|
389
372
|
var defaultSteps = Math.max(0, Number(options.steps) || 0);
|
|
390
|
-
var
|
|
391
|
-
|
|
392
|
-
|
|
373
|
+
var children = [];
|
|
374
|
+
var handledNonGpu = false;
|
|
375
|
+
for (var index = 0; index < targetValues.length; index++) {
|
|
393
376
|
var targets = targetValues[index];
|
|
394
|
-
var
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
377
|
+
var child = this.childHandles[index];
|
|
378
|
+
if (!targets || !child) {
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
var transitionChild = {
|
|
382
|
+
index: index,
|
|
383
|
+
target: {},
|
|
384
|
+
steps: {},
|
|
385
|
+
loops: {},
|
|
386
|
+
valueLists: {}
|
|
387
|
+
};
|
|
388
|
+
for (var _i = 0, _Object$entries = Object.entries(targets); _i < _Object$entries.length; _i++) {
|
|
389
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
390
|
+
property = _Object$entries$_i[0],
|
|
391
|
+
rawTarget = _Object$entries$_i[1];
|
|
392
|
+
var targetProperty = ParticleUtil.getTargetName(property);
|
|
393
|
+
if (!ParticleUtil.isGpuTarget(targetProperty)) {
|
|
394
|
+
var _TargetParser$getValu = TargetParser.getValueStepsCycles(child, targetProperty, rawTarget, 0),
|
|
395
|
+
_TargetParser$getValu2 = _slicedToArray(_TargetParser$getValu, 2),
|
|
396
|
+
_value = _TargetParser$getValu2[0],
|
|
397
|
+
steps = _TargetParser$getValu2[1];
|
|
398
|
+
if (!steps) {
|
|
399
|
+
this.setChildValue(index, targetProperty, _value);
|
|
400
|
+
handledNonGpu = true;
|
|
401
|
+
}
|
|
402
|
+
continue;
|
|
408
403
|
}
|
|
404
|
+
var _TargetParser$getValu3 = TargetParser.getValueStepsCycles(child, targetProperty, rawTarget, 0),
|
|
405
|
+
_TargetParser$getValu4 = _slicedToArray(_TargetParser$getValu3, 2),
|
|
406
|
+
value = _TargetParser$getValu4[0],
|
|
407
|
+
parsedSteps = _TargetParser$getValu4[1];
|
|
408
|
+
var hasOwnSteps = TUtil.isDefined(rawTarget === null || rawTarget === void 0 ? void 0 : rawTarget.steps) || TargetParser.isValueStepsCycleArray(rawTarget === null || rawTarget === void 0 ? void 0 : rawTarget.value);
|
|
409
|
+
var propertySteps = hasOwnSteps ? parsedSteps : defaultSteps;
|
|
410
|
+
if (TargetParser.isListTarget(value)) {
|
|
411
|
+
transitionChild.valueLists[targetProperty] = value.list;
|
|
412
|
+
transitionChild.target[targetProperty] = value.list[1];
|
|
413
|
+
} else {
|
|
414
|
+
transitionChild.target[targetProperty] = value;
|
|
415
|
+
}
|
|
416
|
+
transitionChild.steps[targetProperty] = propertySteps;
|
|
417
|
+
transitionChild.loops[targetProperty] = (rawTarget === null || rawTarget === void 0 ? void 0 : rawTarget.loop) === true;
|
|
418
|
+
}
|
|
419
|
+
if (Object.keys(transitionChild.target).length) {
|
|
420
|
+
children.push(transitionChild);
|
|
409
421
|
}
|
|
410
|
-
values[index] = nextParticle;
|
|
411
|
-
steps[index] = childSteps;
|
|
412
422
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
423
|
+
if (!children.length) {
|
|
424
|
+
if (!handledNonGpu) {
|
|
425
|
+
return false;
|
|
426
|
+
}
|
|
427
|
+
delete this.childTargetValues[targetName];
|
|
428
|
+
return {
|
|
429
|
+
handled: true,
|
|
430
|
+
steps: 0
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
var segmentCount = this.getChildrenSegmentCount(children);
|
|
434
|
+
var segment = this.buildChildTransitionSegment(children, 0, defaultSteps);
|
|
435
|
+
this.commitImmediateChildTransitionValues(children, segment.values, segment.steps);
|
|
436
|
+
if (!segment.hasSegment || segment.maxSteps === 0) {
|
|
437
|
+
this.commitChildTransitionSegment(children, segment.values, segment.steps);
|
|
438
|
+
delete this.childTargetValues[targetName];
|
|
439
|
+
this.particleValuesDirty = true;
|
|
440
|
+
this.requestParticleRender();
|
|
441
|
+
return {
|
|
442
|
+
handled: true,
|
|
443
|
+
steps: 0
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
var transition = {
|
|
447
|
+
children: children,
|
|
448
|
+
segmentIndex: 0,
|
|
449
|
+
segmentCount: segmentCount,
|
|
450
|
+
defaultSteps: defaultSteps,
|
|
451
|
+
initialValues: segment.initialValues,
|
|
452
|
+
values: segment.values,
|
|
453
|
+
steps: segment.steps,
|
|
454
|
+
loops: segment.loops,
|
|
455
|
+
hasLoop: segment.hasLoop,
|
|
456
|
+
generation: this.childGeneration
|
|
416
457
|
};
|
|
458
|
+
this.childTransitions[targetName] = transition;
|
|
417
459
|
this.activeChildTransitionKey = key;
|
|
460
|
+
this.addChildTransitionLayoutTargets(transition);
|
|
418
461
|
if (this.hasDom()) {
|
|
419
|
-
this.particleRenderer.setTargetParticles(values, steps).then(function () {
|
|
420
|
-
|
|
421
|
-
if (((_this5$childTransitio = _this5.childTransitions[targetName]) === null || _this5$childTransitio === void 0 ? void 0 : _this5$childTransitio.values) === values) {
|
|
462
|
+
this.particleRenderer.setTargetParticles(segment.values, segment.steps, transition.generation).then(function (applied) {
|
|
463
|
+
if (applied && _this5.childTransitions[targetName] === transition) {
|
|
422
464
|
_this5.handleSpecialTargetStep(key);
|
|
423
465
|
}
|
|
424
466
|
});
|
|
425
467
|
}
|
|
426
468
|
return {
|
|
427
469
|
handled: true,
|
|
428
|
-
steps: maxSteps
|
|
470
|
+
steps: segment.maxSteps
|
|
429
471
|
};
|
|
430
472
|
}
|
|
473
|
+
}, {
|
|
474
|
+
key: "commitChildTransitionSegment",
|
|
475
|
+
value: function commitChildTransitionSegment(children, values, steps) {
|
|
476
|
+
var _iterator = _createForOfIteratorHelper(children),
|
|
477
|
+
_step;
|
|
478
|
+
try {
|
|
479
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
480
|
+
var transitionChild = _step.value;
|
|
481
|
+
var index = transitionChild.index;
|
|
482
|
+
var child = this.childHandles[index];
|
|
483
|
+
var childSteps = steps === null || steps === void 0 ? void 0 : steps[index];
|
|
484
|
+
if (!child || !childSteps) {
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
var wasVisible = child.isVisible();
|
|
488
|
+
var layoutProperties = [];
|
|
489
|
+
for (var _i2 = 0, _Object$keys = Object.keys(childSteps); _i2 < _Object$keys.length; _i2++) {
|
|
490
|
+
var _values$index;
|
|
491
|
+
var property = _Object$keys[_i2];
|
|
492
|
+
child.actualValues[property] = (_values$index = values[index]) === null || _values$index === void 0 ? void 0 : _values$index[property];
|
|
493
|
+
if (ParticleUtil.affectsChildLayout(property)) {
|
|
494
|
+
layoutProperties.push(property);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
if (layoutProperties.length) {
|
|
498
|
+
child.actualValues.isVisible = child.calcVisibility();
|
|
499
|
+
if (wasVisible || child.isVisible()) {
|
|
500
|
+
var _iterator2 = _createForOfIteratorHelper(layoutProperties),
|
|
501
|
+
_step2;
|
|
502
|
+
try {
|
|
503
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
504
|
+
var _property = _step2.value;
|
|
505
|
+
child.removeFromNoDomUpdatingTargets(_property);
|
|
506
|
+
}
|
|
507
|
+
} catch (err) {
|
|
508
|
+
_iterator2.e(err);
|
|
509
|
+
} finally {
|
|
510
|
+
_iterator2.f();
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
} catch (err) {
|
|
516
|
+
_iterator.e(err);
|
|
517
|
+
} finally {
|
|
518
|
+
_iterator.f();
|
|
519
|
+
}
|
|
520
|
+
}
|
|
431
521
|
}, {
|
|
432
522
|
key: "handleSpecialTarget",
|
|
433
523
|
value: function handleSpecialTarget(key, value) {
|
|
@@ -444,20 +534,20 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
444
534
|
}, {
|
|
445
535
|
key: "getRenderScrollLeft",
|
|
446
536
|
value: function getRenderScrollLeft() {
|
|
447
|
-
var _this
|
|
448
|
-
return
|
|
537
|
+
var _this$$dom;
|
|
538
|
+
return ((_this$$dom = this.$dom) === null || _this$$dom === void 0 ? void 0 : _this$$dom.getScrollLeft()) || this.getScrollLeft() || 0;
|
|
449
539
|
}
|
|
450
540
|
}, {
|
|
451
541
|
key: "getRenderScrollTop",
|
|
452
542
|
value: function getRenderScrollTop() {
|
|
453
|
-
var _this
|
|
454
|
-
return
|
|
543
|
+
var _this$$dom2;
|
|
544
|
+
return ((_this$$dom2 = this.$dom) === null || _this$$dom2 === void 0 ? void 0 : _this$$dom2.getScrollTop()) || this.getScrollTop() || 0;
|
|
455
545
|
}
|
|
456
546
|
}, {
|
|
457
547
|
key: "addChild",
|
|
458
548
|
value: function addChild(child) {
|
|
459
549
|
var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.addedChildren.length + this.allChildrenList.length;
|
|
460
|
-
if (child && _typeof(child) === "object" && !(child instanceof TModel) && ParticleUtil.
|
|
550
|
+
if (child && _typeof(child) === "object" && !(child instanceof TModel) && ParticleUtil.isChildrenTarget(TargetUtil.currentTargetName)) {
|
|
461
551
|
var renderer = this.getChildrenRenderer();
|
|
462
552
|
if (renderer !== "dom") {
|
|
463
553
|
var childDefinition = TUtil.cloneTargetDefinition(child);
|
|
@@ -474,27 +564,25 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
474
564
|
value: function addGpuChild(definition) {
|
|
475
565
|
var key = TargetUtil.currentTargetName;
|
|
476
566
|
var targetName = TargetUtil.getTargetName(key);
|
|
477
|
-
var index = this.
|
|
567
|
+
var index = this.childHandles.length;
|
|
478
568
|
this.gpuChildrenEnabled = true;
|
|
479
|
-
|
|
480
|
-
/*
|
|
481
|
-
* A placeholder and Child must exist before function-valued properties
|
|
482
|
-
* are resolved because functions can call Child getters.
|
|
483
|
-
*/
|
|
484
|
-
this.particleValues[index] = {};
|
|
485
|
-
var handle = new Child(this, index);
|
|
569
|
+
var handle = new ParticleChild(this, index);
|
|
486
570
|
this.childHandles[index] = handle;
|
|
571
|
+
this.childActualValues[index] = handle.actualValues;
|
|
572
|
+
this.childTargetMaps[index] = handle.allTargetMap;
|
|
487
573
|
try {
|
|
488
574
|
var _this$pendingGpuChild, _this$pendingGpuChild2;
|
|
489
|
-
var compiled = ParticleUtil.
|
|
575
|
+
var compiled = ParticleUtil.compileChildDefinition(handle, definition);
|
|
490
576
|
var child = this.createGpuChild(compiled.renderDefinition);
|
|
491
577
|
if (!child) {
|
|
492
|
-
this.particleValues.pop();
|
|
493
578
|
this.childHandles.pop();
|
|
579
|
+
this.childActualValues.pop();
|
|
580
|
+
this.childTargetMaps.pop();
|
|
494
581
|
return false;
|
|
495
582
|
}
|
|
496
|
-
this.particleValues[index] = child.initial;
|
|
497
583
|
Object.assign(handle.actualValues, child.initial);
|
|
584
|
+
this.childActualValues[index] = handle.actualValues;
|
|
585
|
+
this.childTargetMaps[index] = handle.allTargetMap;
|
|
498
586
|
this.particleRuntime.registerChild(index, targetName, compiled);
|
|
499
587
|
var pending = (_this$pendingGpuChild2 = (_this$pendingGpuChild = this.pendingGpuChildren)[targetName]) !== null && _this$pendingGpuChild2 !== void 0 ? _this$pendingGpuChild2 : _this$pendingGpuChild[targetName] = {
|
|
500
588
|
key: key,
|
|
@@ -503,21 +591,108 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
503
591
|
pending.children.push(_objectSpread({
|
|
504
592
|
index: index
|
|
505
593
|
}, child));
|
|
594
|
+
this.childGeneration++;
|
|
506
595
|
this.childrenUpdateFlag = true;
|
|
507
596
|
this.markLayoutDirty("addGpuChild");
|
|
508
597
|
return true;
|
|
509
598
|
} catch (error) {
|
|
510
|
-
this.particleValues.pop();
|
|
511
599
|
this.childHandles.pop();
|
|
600
|
+
this.childActualValues.pop();
|
|
601
|
+
this.childTargetMaps.pop();
|
|
512
602
|
this.childRuntimePrograms.pop();
|
|
513
603
|
this.childRuntimeStates.pop();
|
|
514
604
|
throw error;
|
|
515
605
|
}
|
|
516
606
|
}
|
|
607
|
+
}, {
|
|
608
|
+
key: "removeChild",
|
|
609
|
+
value: function removeChild(child) {
|
|
610
|
+
if (!this.gpuChildrenEnabled || !(child instanceof ParticleChild)) {
|
|
611
|
+
return _superPropGet(ParticleTModel, "removeChild", this, 3)([child]);
|
|
612
|
+
}
|
|
613
|
+
var index = this.childHandles.indexOf(child);
|
|
614
|
+
if (index < 0) {
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
this.particleRuntime.removeChild(index);
|
|
618
|
+
this.childHandles.splice(index, 1);
|
|
619
|
+
this.childActualValues.splice(index, 1);
|
|
620
|
+
this.childTargetMaps.splice(index, 1);
|
|
621
|
+
this.removeChildFromTransitions(index);
|
|
622
|
+
for (var _i3 = 0, _Object$values = Object.values(this.childTargetValues); _i3 < _Object$values.length; _i3++) {
|
|
623
|
+
var targetValues = _Object$values[_i3];
|
|
624
|
+
targetValues === null || targetValues === void 0 || targetValues.splice(index, 1);
|
|
625
|
+
}
|
|
626
|
+
child.index = -1;
|
|
627
|
+
for (var i = index; i < this.childHandles.length; i++) {
|
|
628
|
+
this.childHandles[i].index = i;
|
|
629
|
+
}
|
|
630
|
+
this.childGeneration++;
|
|
631
|
+
this.particleValuesDirty = true;
|
|
632
|
+
this.invalidateLayout();
|
|
633
|
+
this.markLayoutDirty("removeGpuChild");
|
|
634
|
+
this.requestParticleRender();
|
|
635
|
+
return this;
|
|
636
|
+
}
|
|
637
|
+
}, {
|
|
638
|
+
key: "removeChildFromTransitions",
|
|
639
|
+
value: function removeChildFromTransitions(index) {
|
|
640
|
+
for (var _i4 = 0, _Object$values2 = Object.values(this.childTransitions); _i4 < _Object$values2.length; _i4++) {
|
|
641
|
+
var _transition$initialVa, _transition$values, _transition$steps, _transition$loops;
|
|
642
|
+
var transition = _Object$values2[_i4];
|
|
643
|
+
(_transition$initialVa = transition.initialValues) === null || _transition$initialVa === void 0 || _transition$initialVa.splice(index, 1);
|
|
644
|
+
(_transition$values = transition.values) === null || _transition$values === void 0 || _transition$values.splice(index, 1);
|
|
645
|
+
(_transition$steps = transition.steps) === null || _transition$steps === void 0 || _transition$steps.splice(index, 1);
|
|
646
|
+
(_transition$loops = transition.loops) === null || _transition$loops === void 0 || _transition$loops.splice(index, 1);
|
|
647
|
+
if (transition.children) {
|
|
648
|
+
transition.children = transition.children.filter(function (child) {
|
|
649
|
+
return child.index !== index;
|
|
650
|
+
});
|
|
651
|
+
var _iterator3 = _createForOfIteratorHelper(transition.children),
|
|
652
|
+
_step3;
|
|
653
|
+
try {
|
|
654
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
655
|
+
var child = _step3.value;
|
|
656
|
+
if (child.index > index) {
|
|
657
|
+
child.index--;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
} catch (err) {
|
|
661
|
+
_iterator3.e(err);
|
|
662
|
+
} finally {
|
|
663
|
+
_iterator3.f();
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
for (var _i5 = 0, _Object$values3 = Object.values(this.pendingGpuChildren); _i5 < _Object$values3.length; _i5++) {
|
|
668
|
+
var pending = _Object$values3[_i5];
|
|
669
|
+
if (!(pending !== null && pending !== void 0 && pending.children)) {
|
|
670
|
+
continue;
|
|
671
|
+
}
|
|
672
|
+
pending.children = pending.children.filter(function (child) {
|
|
673
|
+
return child.index !== index;
|
|
674
|
+
});
|
|
675
|
+
var _iterator4 = _createForOfIteratorHelper(pending.children),
|
|
676
|
+
_step4;
|
|
677
|
+
try {
|
|
678
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
679
|
+
var _child = _step4.value;
|
|
680
|
+
if (_child.index > index) {
|
|
681
|
+
_child.index--;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
} catch (err) {
|
|
685
|
+
_iterator4.e(err);
|
|
686
|
+
} finally {
|
|
687
|
+
_iterator4.f();
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
517
691
|
}, {
|
|
518
692
|
key: "isTargetEnabled",
|
|
519
693
|
value: function isTargetEnabled(key) {
|
|
520
|
-
|
|
694
|
+
var target = this.targets[key];
|
|
695
|
+
if (ParticleUtil.isChildrenTarget(key) && (target === null || target === void 0 ? void 0 : target.waitForChildren) === true && this.isExecuted(key) && this.particleRuntime.hasPending(key)) {
|
|
521
696
|
return false;
|
|
522
697
|
}
|
|
523
698
|
return _superPropGet(ParticleTModel, "isTargetEnabled", this, 3)([key]);
|
|
@@ -536,9 +711,9 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
536
711
|
var loops = {};
|
|
537
712
|
var valueLists = {};
|
|
538
713
|
var hasTransition = false;
|
|
539
|
-
for (var
|
|
714
|
+
for (var _i6 = 0, _Object$entries2 = Object.entries(definition); _i6 < _Object$entries2.length; _i6++) {
|
|
540
715
|
var _resolved$valueList;
|
|
541
|
-
var _Object$entries2$_i = _slicedToArray(_Object$entries2[
|
|
716
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i6], 2),
|
|
542
717
|
property = _Object$entries2$_i[0],
|
|
543
718
|
value = _Object$entries2$_i[1];
|
|
544
719
|
var resolved = this.resolveInitialChildProperty(value);
|
|
@@ -574,7 +749,7 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
574
749
|
value: function finalizeChildrenTarget(key) {
|
|
575
750
|
var _this6 = this;
|
|
576
751
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
577
|
-
if (!ParticleUtil.
|
|
752
|
+
if (!ParticleUtil.isChildrenTarget(key)) {
|
|
578
753
|
return false;
|
|
579
754
|
}
|
|
580
755
|
var targetName = TargetUtil.getTargetName(key);
|
|
@@ -582,34 +757,34 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
582
757
|
if (!(pending !== null && pending !== void 0 && pending.children.length)) {
|
|
583
758
|
return false;
|
|
584
759
|
}
|
|
585
|
-
this.
|
|
760
|
+
this.invalidateLayout();
|
|
586
761
|
var defaultSteps = Math.max(0, Number(options.steps) || 0);
|
|
587
|
-
var currentValues = this.particleValues;
|
|
588
762
|
var segmentCount = this.getChildrenSegmentCount(pending.children);
|
|
589
|
-
var segment = this.buildChildTransitionSegment(pending.children, 0,
|
|
763
|
+
var segment = this.buildChildTransitionSegment(pending.children, 0, defaultSteps);
|
|
764
|
+
this.commitImmediateChildTransitionValues(pending.children, segment.values, segment.steps);
|
|
590
765
|
delete this.pendingGpuChildren[targetName];
|
|
591
766
|
if (!segment.hasSegment || segment.maxSteps === 0) {
|
|
592
|
-
this.
|
|
767
|
+
this.commitChildTransitionSegment(pending.children, segment.values, segment.steps);
|
|
593
768
|
var runtimeIndexes = pending.children.map(function (child) {
|
|
594
769
|
return child.index;
|
|
595
770
|
}).filter(function (index) {
|
|
596
|
-
var _this6
|
|
597
|
-
return
|
|
771
|
+
var state = _this6.childRuntimeStates[index];
|
|
772
|
+
return state && !state.done;
|
|
598
773
|
});
|
|
599
|
-
var
|
|
600
|
-
|
|
774
|
+
var _iterator5 = _createForOfIteratorHelper(runtimeIndexes),
|
|
775
|
+
_step5;
|
|
601
776
|
try {
|
|
602
|
-
for (
|
|
603
|
-
var index =
|
|
777
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
778
|
+
var index = _step5.value;
|
|
604
779
|
this.particleRuntime.queueStart(index);
|
|
605
780
|
}
|
|
606
781
|
} catch (err) {
|
|
607
|
-
|
|
782
|
+
_iterator5.e(err);
|
|
608
783
|
} finally {
|
|
609
|
-
|
|
784
|
+
_iterator5.f();
|
|
610
785
|
}
|
|
611
786
|
if (this.hasDom()) {
|
|
612
|
-
this.particleRenderer.setParticles(
|
|
787
|
+
this.particleRenderer.setParticles(this.childHandles).then(function () {
|
|
613
788
|
_this6.particleRuntime.markRenderReady(runtimeIndexes);
|
|
614
789
|
});
|
|
615
790
|
}
|
|
@@ -618,22 +793,106 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
618
793
|
steps: 0
|
|
619
794
|
};
|
|
620
795
|
}
|
|
621
|
-
|
|
796
|
+
var transition = {
|
|
622
797
|
children: pending.children,
|
|
623
798
|
segmentIndex: 0,
|
|
624
799
|
segmentCount: segmentCount,
|
|
625
800
|
defaultSteps: defaultSteps,
|
|
801
|
+
initialValues: segment.initialValues,
|
|
626
802
|
values: segment.values,
|
|
627
803
|
steps: segment.steps,
|
|
628
804
|
loops: segment.loops,
|
|
629
|
-
hasLoop: segment.hasLoop
|
|
805
|
+
hasLoop: segment.hasLoop,
|
|
806
|
+
generation: this.childGeneration
|
|
630
807
|
};
|
|
808
|
+
this.childTransitions[targetName] = transition;
|
|
631
809
|
this.activeChildTransitionKey = key;
|
|
810
|
+
this.addChildTransitionLayoutTargets(transition);
|
|
632
811
|
return {
|
|
633
812
|
handled: true,
|
|
634
813
|
steps: segment.maxSteps
|
|
635
814
|
};
|
|
636
815
|
}
|
|
816
|
+
}, {
|
|
817
|
+
key: "addChildTransitionLayoutTargets",
|
|
818
|
+
value: function addChildTransitionLayoutTargets(transition) {
|
|
819
|
+
var _iterator6 = _createForOfIteratorHelper(transition.children),
|
|
820
|
+
_step6;
|
|
821
|
+
try {
|
|
822
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
823
|
+
var _transition$steps2;
|
|
824
|
+
var transitionChild = _step6.value;
|
|
825
|
+
var index = transitionChild.index;
|
|
826
|
+
var child = this.childHandles[index];
|
|
827
|
+
var childSteps = (_transition$steps2 = transition.steps) === null || _transition$steps2 === void 0 ? void 0 : _transition$steps2[index];
|
|
828
|
+
if (!child || !childSteps) {
|
|
829
|
+
continue;
|
|
830
|
+
}
|
|
831
|
+
for (var _i7 = 0, _Object$entries3 = Object.entries(childSteps); _i7 < _Object$entries3.length; _i7++) {
|
|
832
|
+
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i7], 2),
|
|
833
|
+
property = _Object$entries3$_i[0],
|
|
834
|
+
steps = _Object$entries3$_i[1];
|
|
835
|
+
if (steps > 0 && ParticleUtil.affectsChildLayout(property)) {
|
|
836
|
+
child.addToNoDomUpdatingTargets(property);
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
} catch (err) {
|
|
841
|
+
_iterator6.e(err);
|
|
842
|
+
} finally {
|
|
843
|
+
_iterator6.f();
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
}, {
|
|
847
|
+
key: "catchupChildLayoutTargets",
|
|
848
|
+
value: function catchupChildLayoutTargets(child) {
|
|
849
|
+
var _child$noDomUpdatingT, _transition$initialVa2, _transition$values2, _transition$steps3;
|
|
850
|
+
if (!(child !== null && child !== void 0 && (_child$noDomUpdatingT = child.noDomUpdatingTargets) !== null && _child$noDomUpdatingT !== void 0 && _child$noDomUpdatingT.size) || child.index < 0) {
|
|
851
|
+
return false;
|
|
852
|
+
}
|
|
853
|
+
var key = this.activeChildTransitionKey;
|
|
854
|
+
if (!key) {
|
|
855
|
+
return false;
|
|
856
|
+
}
|
|
857
|
+
var targetName = TargetUtil.getTargetName(key);
|
|
858
|
+
var transition = this.childTransitions[targetName];
|
|
859
|
+
if (!transition || transition.generation !== this.childGeneration) {
|
|
860
|
+
return false;
|
|
861
|
+
}
|
|
862
|
+
var index = child.index;
|
|
863
|
+
var initialValues = (_transition$initialVa2 = transition.initialValues) === null || _transition$initialVa2 === void 0 ? void 0 : _transition$initialVa2[index];
|
|
864
|
+
var targetValues = (_transition$values2 = transition.values) === null || _transition$values2 === void 0 ? void 0 : _transition$values2[index];
|
|
865
|
+
var childSteps = (_transition$steps3 = transition.steps) === null || _transition$steps3 === void 0 ? void 0 : _transition$steps3[index];
|
|
866
|
+
if (!initialValues || !targetValues || !childSteps) {
|
|
867
|
+
return false;
|
|
868
|
+
}
|
|
869
|
+
var currentStep = Math.max(0, Number(this.getTargetStep(key)) || 0);
|
|
870
|
+
var changed = false;
|
|
871
|
+
for (var _i8 = 0, _arr = _toConsumableArray(child.noDomUpdatingTargets); _i8 < _arr.length; _i8++) {
|
|
872
|
+
var property = _arr[_i8];
|
|
873
|
+
if (!ParticleUtil.affectsChildLayout(property)) {
|
|
874
|
+
child.removeFromNoDomUpdatingTargets(property);
|
|
875
|
+
continue;
|
|
876
|
+
}
|
|
877
|
+
var initialValue = initialValues[property];
|
|
878
|
+
var targetValue = targetValues[property];
|
|
879
|
+
var steps = Math.max(0, Number(childSteps[property]) || 0);
|
|
880
|
+
if (!TUtil.isDefined(initialValue) || !TUtil.isDefined(targetValue)) {
|
|
881
|
+
child.removeFromNoDomUpdatingTargets(property);
|
|
882
|
+
continue;
|
|
883
|
+
}
|
|
884
|
+
var progress = steps === 0 ? 1 : Math.min(1, currentStep / steps);
|
|
885
|
+
var value = initialValue + (targetValue - initialValue) * progress;
|
|
886
|
+
if (child.actualValues[property] !== value) {
|
|
887
|
+
child.actualValues[property] = value;
|
|
888
|
+
changed = true;
|
|
889
|
+
}
|
|
890
|
+
if (progress === 1) {
|
|
891
|
+
child.removeFromNoDomUpdatingTargets(property);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
return changed;
|
|
895
|
+
}
|
|
637
896
|
}, {
|
|
638
897
|
key: "advanceChildTransitionSegment",
|
|
639
898
|
value: function advanceChildTransitionSegment(key, transition) {
|
|
@@ -645,13 +904,16 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
645
904
|
if (nextSegmentIndex >= transition.segmentCount) {
|
|
646
905
|
return false;
|
|
647
906
|
}
|
|
648
|
-
this.
|
|
907
|
+
this.commitChildTransitionSegment(transition.children, transition.values, transition.steps);
|
|
649
908
|
this.particleRenderer.completeTransition();
|
|
650
|
-
var segment = this.buildChildTransitionSegment(transition.children, nextSegmentIndex,
|
|
909
|
+
var segment = this.buildChildTransitionSegment(transition.children, nextSegmentIndex, transition.defaultSteps);
|
|
651
910
|
transition.segmentIndex = nextSegmentIndex;
|
|
911
|
+
transition.initialValues = segment.initialValues;
|
|
652
912
|
transition.values = segment.values;
|
|
653
913
|
transition.steps = segment.steps;
|
|
654
914
|
transition.loops = segment.loops;
|
|
915
|
+
this.commitImmediateChildTransitionValues(transition.children, segment.values, segment.steps);
|
|
916
|
+
this.addChildTransitionLayoutTargets(transition);
|
|
655
917
|
var targetValue = this.targetValues[key];
|
|
656
918
|
if (targetValue) {
|
|
657
919
|
targetValue.steps = segment.maxSteps;
|
|
@@ -660,8 +922,8 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
660
922
|
this.resetTargetInitialValue(key);
|
|
661
923
|
this.setTargetStatus(key, "updating");
|
|
662
924
|
if (this.hasDom()) {
|
|
663
|
-
this.particleRenderer.setTargetParticles(segment.values, segment.steps).then(function () {
|
|
664
|
-
if (_this7.childTransitions[TargetUtil.getTargetName(key)] === transition) {
|
|
925
|
+
this.particleRenderer.setTargetParticles(segment.values, segment.steps, transition.generation).then(function (applied) {
|
|
926
|
+
if (applied && _this7.childTransitions[TargetUtil.getTargetName(key)] === transition) {
|
|
665
927
|
_this7.handleSpecialTargetStep(key);
|
|
666
928
|
}
|
|
667
929
|
});
|
|
@@ -670,69 +932,78 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
670
932
|
}
|
|
671
933
|
}, {
|
|
672
934
|
key: "buildChildTransitionSegment",
|
|
673
|
-
value: function buildChildTransitionSegment(children, segmentIndex,
|
|
674
|
-
var
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
var steps = Array.from({
|
|
678
|
-
length: currentValues.length
|
|
679
|
-
}, function () {
|
|
680
|
-
return {};
|
|
681
|
-
});
|
|
682
|
-
var loops = Array.from({
|
|
683
|
-
length: currentValues.length
|
|
684
|
-
}, function () {
|
|
685
|
-
return {};
|
|
935
|
+
value: function buildChildTransitionSegment(children, segmentIndex, defaultSteps) {
|
|
936
|
+
var initialValues = new Array(this.childHandles.length);
|
|
937
|
+
var values = this.childHandles.map(function (child) {
|
|
938
|
+
return child === null || child === void 0 ? void 0 : child.actualValues;
|
|
686
939
|
});
|
|
940
|
+
var steps = new Array(this.childHandles.length);
|
|
941
|
+
var loops = new Array(this.childHandles.length);
|
|
687
942
|
var maxSteps = 0;
|
|
688
943
|
var hasSegment = false;
|
|
689
944
|
var hasLoop = false;
|
|
690
|
-
var
|
|
691
|
-
|
|
945
|
+
var _iterator7 = _createForOfIteratorHelper(children),
|
|
946
|
+
_step7;
|
|
692
947
|
try {
|
|
693
|
-
for (
|
|
694
|
-
var
|
|
695
|
-
var
|
|
696
|
-
var
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
948
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
949
|
+
var transitionChild = _step7.value;
|
|
950
|
+
var index = transitionChild.index;
|
|
951
|
+
var child = this.childHandles[index];
|
|
952
|
+
if (!child) {
|
|
953
|
+
continue;
|
|
954
|
+
}
|
|
955
|
+
var current = _objectSpread(_objectSpread({}, child.actualValues), {}, {
|
|
956
|
+
x: this.getChildValue(index, "x"),
|
|
957
|
+
y: this.getChildValue(index, "y")
|
|
958
|
+
});
|
|
959
|
+
var initial = void 0;
|
|
960
|
+
var target = void 0;
|
|
961
|
+
var childSteps = void 0;
|
|
962
|
+
var childLoops = void 0;
|
|
963
|
+
for (var _i9 = 0, _Object$keys2 = Object.keys(transitionChild.target); _i9 < _Object$keys2.length; _i9++) {
|
|
964
|
+
var property = _Object$keys2[_i9];
|
|
965
|
+
var valueList = transitionChild.valueLists[property];
|
|
966
|
+
var value = void 0;
|
|
700
967
|
if (valueList) {
|
|
701
968
|
if (segmentIndex >= valueList.length - 1) {
|
|
702
969
|
continue;
|
|
703
970
|
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
maxSteps = Math.max(maxSteps, _propertySteps);
|
|
709
|
-
hasSegment = true;
|
|
710
|
-
if (child.loops[property]) {
|
|
711
|
-
hasLoop = true;
|
|
971
|
+
value = valueList[segmentIndex + 1];
|
|
972
|
+
} else {
|
|
973
|
+
if (segmentIndex !== 0 || current[property] === transitionChild.target[property]) {
|
|
974
|
+
continue;
|
|
712
975
|
}
|
|
713
|
-
|
|
976
|
+
value = transitionChild.target[property];
|
|
714
977
|
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
978
|
+
var propertySteps = this.getChildPropertySteps(transitionChild, property, segmentIndex, defaultSteps);
|
|
979
|
+
initial || (initial = {});
|
|
980
|
+
target || (target = _objectSpread({}, current));
|
|
981
|
+
childSteps || (childSteps = {});
|
|
982
|
+
childLoops || (childLoops = {});
|
|
983
|
+
initial[property] = current[property];
|
|
984
|
+
target[property] = value;
|
|
985
|
+
childSteps[property] = propertySteps;
|
|
986
|
+
childLoops[property] = transitionChild.loops[property] === true;
|
|
722
987
|
maxSteps = Math.max(maxSteps, propertySteps);
|
|
723
988
|
hasSegment = true;
|
|
724
|
-
if (
|
|
989
|
+
if (childLoops[property]) {
|
|
725
990
|
hasLoop = true;
|
|
726
991
|
}
|
|
727
992
|
}
|
|
728
|
-
|
|
993
|
+
if (target) {
|
|
994
|
+
initialValues[index] = initial;
|
|
995
|
+
values[index] = target;
|
|
996
|
+
steps[index] = childSteps;
|
|
997
|
+
loops[index] = childLoops;
|
|
998
|
+
}
|
|
729
999
|
}
|
|
730
1000
|
} catch (err) {
|
|
731
|
-
|
|
1001
|
+
_iterator7.e(err);
|
|
732
1002
|
} finally {
|
|
733
|
-
|
|
1003
|
+
_iterator7.f();
|
|
734
1004
|
}
|
|
735
1005
|
return {
|
|
1006
|
+
initialValues: initialValues,
|
|
736
1007
|
values: values,
|
|
737
1008
|
steps: steps,
|
|
738
1009
|
loops: loops,
|
|
@@ -757,8 +1028,8 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
757
1028
|
key: "getChildSegmentCount",
|
|
758
1029
|
value: function getChildSegmentCount(child) {
|
|
759
1030
|
var count = 0;
|
|
760
|
-
for (var
|
|
761
|
-
var valueList = _Object$
|
|
1031
|
+
for (var _i10 = 0, _Object$values4 = Object.values(child.valueLists); _i10 < _Object$values4.length; _i10++) {
|
|
1032
|
+
var valueList = _Object$values4[_i10];
|
|
762
1033
|
count = Math.max(count, valueList.length - 1);
|
|
763
1034
|
}
|
|
764
1035
|
return count;
|
|
@@ -767,17 +1038,17 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
767
1038
|
key: "getChildrenSegmentCount",
|
|
768
1039
|
value: function getChildrenSegmentCount(children) {
|
|
769
1040
|
var count = 0;
|
|
770
|
-
var
|
|
771
|
-
|
|
1041
|
+
var _iterator8 = _createForOfIteratorHelper(children),
|
|
1042
|
+
_step8;
|
|
772
1043
|
try {
|
|
773
|
-
for (
|
|
774
|
-
var child =
|
|
1044
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
1045
|
+
var child = _step8.value;
|
|
775
1046
|
count = Math.max(count, this.getChildSegmentCount(child));
|
|
776
1047
|
}
|
|
777
1048
|
} catch (err) {
|
|
778
|
-
|
|
1049
|
+
_iterator8.e(err);
|
|
779
1050
|
} finally {
|
|
780
|
-
|
|
1051
|
+
_iterator8.f();
|
|
781
1052
|
}
|
|
782
1053
|
return count;
|
|
783
1054
|
}
|
|
@@ -794,7 +1065,8 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
794
1065
|
key: "handleSpecialTargetStep",
|
|
795
1066
|
value: function handleSpecialTargetStep(key) {
|
|
796
1067
|
var targetName = TargetUtil.getTargetName(key);
|
|
797
|
-
|
|
1068
|
+
var transition = this.childTransitions[targetName];
|
|
1069
|
+
if (!transition || transition.generation !== this.childGeneration) {
|
|
798
1070
|
return false;
|
|
799
1071
|
}
|
|
800
1072
|
this.particleRenderer.setTransitionStep(this.getTargetStep(key));
|
|
@@ -808,6 +1080,17 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
808
1080
|
if (!transition) {
|
|
809
1081
|
return false;
|
|
810
1082
|
}
|
|
1083
|
+
if (transition.generation !== this.childGeneration) {
|
|
1084
|
+
this.particleRenderer.completeTransition();
|
|
1085
|
+
delete this.childTransitions[targetName];
|
|
1086
|
+
delete this.childTargetValues[targetName];
|
|
1087
|
+
if (this.activeChildTransitionKey === key) {
|
|
1088
|
+
this.activeChildTransitionKey = undefined;
|
|
1089
|
+
}
|
|
1090
|
+
this.particleValuesDirty = true;
|
|
1091
|
+
this.requestParticleRender();
|
|
1092
|
+
return true;
|
|
1093
|
+
}
|
|
811
1094
|
if (this.advanceChildTransitionSegment(key, transition)) {
|
|
812
1095
|
return true;
|
|
813
1096
|
}
|
|
@@ -815,7 +1098,7 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
815
1098
|
this.restartChildTransition(key, transition);
|
|
816
1099
|
return true;
|
|
817
1100
|
}
|
|
818
|
-
this.
|
|
1101
|
+
this.commitChildTransitionSegment(transition.children, transition.values, transition.steps);
|
|
819
1102
|
this.particleRenderer.completeTransition();
|
|
820
1103
|
delete this.childTransitions[targetName];
|
|
821
1104
|
delete this.childTargetValues[targetName];
|
|
@@ -870,16 +1153,25 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
870
1153
|
this.resetTargetStep(key);
|
|
871
1154
|
this.resetTargetInitialValue(key);
|
|
872
1155
|
this.setTargetStatus(key, "updating");
|
|
1156
|
+
this.addChildTransitionLayoutTargets(transition);
|
|
873
1157
|
this.handleSpecialTargetStep(key);
|
|
874
1158
|
return true;
|
|
875
1159
|
}
|
|
1160
|
+
}, {
|
|
1161
|
+
key: "shouldBeBracketed",
|
|
1162
|
+
value: function shouldBeBracketed() {
|
|
1163
|
+
if (this.gpuChildrenEnabled) {
|
|
1164
|
+
return false;
|
|
1165
|
+
}
|
|
1166
|
+
return _superPropGet(ParticleTModel, "shouldBeBracketed", this, 3)([]);
|
|
1167
|
+
}
|
|
876
1168
|
}, {
|
|
877
1169
|
key: "shouldCalculateChildren",
|
|
878
1170
|
value: function shouldCalculateChildren() {
|
|
879
1171
|
if (!this.gpuChildrenEnabled) {
|
|
880
1172
|
return _superPropGet(ParticleTModel, "shouldCalculateChildren", this, 3)([]);
|
|
881
1173
|
}
|
|
882
|
-
if (this.completeLayoutEpoch === this.layoutEpoch && !this.
|
|
1174
|
+
if (!this.getDirtyLayout() && this.completeLayoutEpoch === this.layoutEpoch && !this.hasLayoutStateChanged()) {
|
|
883
1175
|
this.currentStatus = undefined;
|
|
884
1176
|
this.requestParticleRender();
|
|
885
1177
|
return false;
|
|
@@ -887,8 +1179,8 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
887
1179
|
return _superPropGet(ParticleTModel, "shouldCalculateChildren", this, 3)([]);
|
|
888
1180
|
}
|
|
889
1181
|
}, {
|
|
890
|
-
key: "
|
|
891
|
-
value: function
|
|
1182
|
+
key: "getLayoutState",
|
|
1183
|
+
value: function getLayoutState() {
|
|
892
1184
|
return [this.getWidth(), this.getHeight(), this.val("gap"), this.getPaddingTop(), this.getPaddingRight(), this.getPaddingBottom(), this.getPaddingLeft(), this.getContainerOverflowMode()];
|
|
893
1185
|
}
|
|
894
1186
|
}, {
|
|
@@ -899,11 +1191,15 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
899
1191
|
return;
|
|
900
1192
|
}
|
|
901
1193
|
this.completeLayoutEpoch = epoch;
|
|
902
|
-
this.
|
|
903
|
-
if (this.particleRuntime.
|
|
1194
|
+
this.completeLayoutState = this.getLayoutState();
|
|
1195
|
+
if (this.particleRuntime.resolveInitialTargets()) {
|
|
904
1196
|
this.requestParticleRender();
|
|
905
|
-
|
|
1197
|
+
if (this.completeLayoutEpoch !== this.layoutEpoch) {
|
|
1198
|
+
getRunScheduler().schedule(0, "particleInitialTargets-".concat(this.oid));
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
906
1201
|
}
|
|
1202
|
+
this.particleRenderer.updateCanvasLayerWidthHeight();
|
|
907
1203
|
this.resolveLayoutCompleteWaiters();
|
|
908
1204
|
this.particleRuntime.startReady();
|
|
909
1205
|
var key = this.activeChildTransitionKey;
|
|
@@ -915,25 +1211,102 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
915
1211
|
if (!transition) {
|
|
916
1212
|
return;
|
|
917
1213
|
}
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
1214
|
+
var layoutProperties = ["x", "y", "width", "height"];
|
|
1215
|
+
for (var index = 0; index < this.childHandles.length; index++) {
|
|
1216
|
+
var _transition$steps4, _index, _transition$steps4$_i;
|
|
1217
|
+
var child = this.childHandles[index];
|
|
1218
|
+
if (!child) {
|
|
1219
|
+
continue;
|
|
1220
|
+
}
|
|
1221
|
+
var target = transition.values[index];
|
|
1222
|
+
if (!target || target === child.actualValues) {
|
|
1223
|
+
target = _objectSpread({}, child.actualValues);
|
|
1224
|
+
transition.values[index] = target;
|
|
1225
|
+
}
|
|
1226
|
+
var childSteps = (_transition$steps4$_i = (_transition$steps4 = transition.steps)[_index = index]) !== null && _transition$steps4$_i !== void 0 ? _transition$steps4$_i : _transition$steps4[_index] = {};
|
|
1227
|
+
var _iterator9 = _createForOfIteratorHelper(layoutProperties),
|
|
1228
|
+
_step9;
|
|
1229
|
+
try {
|
|
1230
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
1231
|
+
var property = _step9.value;
|
|
1232
|
+
if (Object.prototype.hasOwnProperty.call(childSteps, property)) {
|
|
1233
|
+
continue;
|
|
1234
|
+
}
|
|
1235
|
+
var value = this.getChildValue(index, property);
|
|
1236
|
+
if (!TUtil.isDefined(value)) {
|
|
1237
|
+
continue;
|
|
1238
|
+
}
|
|
1239
|
+
target[property] = value;
|
|
1240
|
+
childSteps[property] = 0;
|
|
1241
|
+
}
|
|
1242
|
+
} catch (err) {
|
|
1243
|
+
_iterator9.e(err);
|
|
1244
|
+
} finally {
|
|
1245
|
+
_iterator9.f();
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
if (transition.generation !== this.childGeneration || this.restoringParticleRuntime || !this.hasDom()) {
|
|
922
1249
|
return;
|
|
923
1250
|
}
|
|
924
|
-
|
|
925
|
-
return _this8.
|
|
926
|
-
}
|
|
927
|
-
|
|
1251
|
+
var isCurrentTransition = function isCurrentTransition() {
|
|
1252
|
+
return _this8.activeChildTransitionKey === key && _this8.childTransitions[targetName] === transition && transition.generation === _this8.childGeneration;
|
|
1253
|
+
};
|
|
1254
|
+
this.particleRenderer.setTargetParticles(transition.values, transition.steps, transition.generation).then(function (applied) {
|
|
1255
|
+
if (applied && isCurrentTransition()) {
|
|
928
1256
|
_this8.handleSpecialTargetStep(key);
|
|
929
1257
|
}
|
|
930
1258
|
});
|
|
931
1259
|
}
|
|
932
1260
|
}, {
|
|
933
|
-
key: "
|
|
934
|
-
value: function
|
|
935
|
-
var
|
|
936
|
-
var
|
|
1261
|
+
key: "commitImmediateChildTransitionValues",
|
|
1262
|
+
value: function commitImmediateChildTransitionValues(children, values, steps) {
|
|
1263
|
+
var changed = false;
|
|
1264
|
+
var _iterator10 = _createForOfIteratorHelper(children),
|
|
1265
|
+
_step10;
|
|
1266
|
+
try {
|
|
1267
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
1268
|
+
var transitionChild = _step10.value;
|
|
1269
|
+
var index = transitionChild.index;
|
|
1270
|
+
var child = this.childHandles[index];
|
|
1271
|
+
var childSteps = steps === null || steps === void 0 ? void 0 : steps[index];
|
|
1272
|
+
if (!child || !childSteps) {
|
|
1273
|
+
continue;
|
|
1274
|
+
}
|
|
1275
|
+
var layoutChanged = false;
|
|
1276
|
+
for (var _i11 = 0, _Object$entries4 = Object.entries(childSteps); _i11 < _Object$entries4.length; _i11++) {
|
|
1277
|
+
var _values$index2;
|
|
1278
|
+
var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i11], 2),
|
|
1279
|
+
property = _Object$entries4$_i[0],
|
|
1280
|
+
propertySteps = _Object$entries4$_i[1];
|
|
1281
|
+
if (propertySteps !== 0) {
|
|
1282
|
+
continue;
|
|
1283
|
+
}
|
|
1284
|
+
var value = (_values$index2 = values[index]) === null || _values$index2 === void 0 ? void 0 : _values$index2[property];
|
|
1285
|
+
if (child.actualValues[property] === value) {
|
|
1286
|
+
continue;
|
|
1287
|
+
}
|
|
1288
|
+
child.actualValues[property] = value;
|
|
1289
|
+
changed = true;
|
|
1290
|
+
if (ParticleUtil.affectsChildLayout(property)) {
|
|
1291
|
+
layoutChanged = true;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
if (layoutChanged) {
|
|
1295
|
+
child.actualValues.isVisible = child.calcVisibility();
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
} catch (err) {
|
|
1299
|
+
_iterator10.e(err);
|
|
1300
|
+
} finally {
|
|
1301
|
+
_iterator10.f();
|
|
1302
|
+
}
|
|
1303
|
+
return changed;
|
|
1304
|
+
}
|
|
1305
|
+
}, {
|
|
1306
|
+
key: "hasLayoutStateChanged",
|
|
1307
|
+
value: function hasLayoutStateChanged() {
|
|
1308
|
+
var current = this.getLayoutState();
|
|
1309
|
+
var previous = this.completeLayoutState;
|
|
937
1310
|
if (!previous || current.length !== previous.length) {
|
|
938
1311
|
return true;
|
|
939
1312
|
}
|
|
@@ -942,14 +1315,14 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
942
1315
|
});
|
|
943
1316
|
}
|
|
944
1317
|
}, {
|
|
945
|
-
key: "
|
|
946
|
-
value: function
|
|
1318
|
+
key: "invalidateLayout",
|
|
1319
|
+
value: function invalidateLayout() {
|
|
947
1320
|
this.layoutEpoch++;
|
|
948
1321
|
}
|
|
949
1322
|
}, {
|
|
950
1323
|
key: "getParticleCount",
|
|
951
1324
|
value: function getParticleCount() {
|
|
952
|
-
return this.
|
|
1325
|
+
return this.childHandles.length;
|
|
953
1326
|
}
|
|
954
1327
|
}, {
|
|
955
1328
|
key: "excludeRuntimeSnapshotField",
|
|
@@ -960,15 +1333,25 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
960
1333
|
key: "restoreRuntimeDerivedState",
|
|
961
1334
|
value: function restoreRuntimeDerivedState() {
|
|
962
1335
|
var _this9 = this;
|
|
963
|
-
this.
|
|
964
|
-
|
|
1336
|
+
this.particleRenderer.destroy();
|
|
1337
|
+
this.childActualValues || (this.childActualValues = []);
|
|
1338
|
+
this.childTargetMaps || (this.childTargetMaps = []);
|
|
1339
|
+
this.childHandles = this.childActualValues.map(function (values, index) {
|
|
1340
|
+
var child = new ParticleChild(_this9, index);
|
|
1341
|
+
var targetMap = _this9.childTargetMaps[index] || {};
|
|
1342
|
+
Object.assign(child.actualValues, values);
|
|
1343
|
+
Object.assign(child.allTargetMap, targetMap);
|
|
1344
|
+
_this9.childActualValues[index] = child.actualValues;
|
|
1345
|
+
_this9.childTargetMaps[index] = child.allTargetMap;
|
|
1346
|
+
return child;
|
|
965
1347
|
});
|
|
1348
|
+
this.childGeneration = Number.isInteger(this.childGeneration) ? this.childGeneration : 0;
|
|
966
1349
|
this.particleValuesDirty = false;
|
|
967
1350
|
this.particleRenderRequested = false;
|
|
968
1351
|
this.pendingGpuChildren = {};
|
|
969
1352
|
this.layoutEpoch = 0;
|
|
970
|
-
this.completeLayoutEpoch =
|
|
971
|
-
this.
|
|
1353
|
+
this.completeLayoutEpoch = -1;
|
|
1354
|
+
this.completeLayoutState = undefined;
|
|
972
1355
|
this.layoutCompleteWaiters = [];
|
|
973
1356
|
this.particleSyncPromise = undefined;
|
|
974
1357
|
this.restoringParticleRuntime = true;
|
|
@@ -991,17 +1374,17 @@ var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
|
991
1374
|
key: "resolveLayoutCompleteWaiters",
|
|
992
1375
|
value: function resolveLayoutCompleteWaiters() {
|
|
993
1376
|
var waiters = this.layoutCompleteWaiters.splice(0);
|
|
994
|
-
var
|
|
995
|
-
|
|
1377
|
+
var _iterator11 = _createForOfIteratorHelper(waiters),
|
|
1378
|
+
_step11;
|
|
996
1379
|
try {
|
|
997
|
-
for (
|
|
998
|
-
var resolve =
|
|
1380
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
1381
|
+
var resolve = _step11.value;
|
|
999
1382
|
resolve();
|
|
1000
1383
|
}
|
|
1001
1384
|
} catch (err) {
|
|
1002
|
-
|
|
1385
|
+
_iterator11.e(err);
|
|
1003
1386
|
} finally {
|
|
1004
|
-
|
|
1387
|
+
_iterator11.f();
|
|
1005
1388
|
}
|
|
1006
1389
|
}
|
|
1007
1390
|
}]);
|
|
@@ -1010,11 +1393,11 @@ function isParticleTModel(targets) {
|
|
|
1010
1393
|
if (!targets) {
|
|
1011
1394
|
return false;
|
|
1012
1395
|
}
|
|
1013
|
-
for (var
|
|
1014
|
-
var _Object$
|
|
1015
|
-
key = _Object$
|
|
1016
|
-
target = _Object$
|
|
1017
|
-
if (!ParticleUtil.
|
|
1396
|
+
for (var _i12 = 0, _Object$entries5 = Object.entries(targets); _i12 < _Object$entries5.length; _i12++) {
|
|
1397
|
+
var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i12], 2),
|
|
1398
|
+
key = _Object$entries5$_i[0],
|
|
1399
|
+
target = _Object$entries5$_i[1];
|
|
1400
|
+
if (!ParticleUtil.isChildrenTarget(key)) {
|
|
1018
1401
|
continue;
|
|
1019
1402
|
}
|
|
1020
1403
|
if (!target || _typeof(target) !== "object") {
|