targetj 1.0.259 → 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 +16 -1
- package/README.md +18 -25
- package/build/AnimationManager.js +1 -1
- package/build/AnimationUtil.js +1 -8
- package/build/App.js +13 -4
- package/build/BaseModel.js +39 -14
- package/build/Bracket.js +7 -1
- package/build/Child.js +504 -0
- package/build/EventListener.js +10 -1
- package/build/LocationManager.js +161 -40
- package/build/PageManager.js +35 -134
- package/build/ParticleChild.js +575 -0
- package/build/ParticleRenderer.js +818 -0
- package/build/ParticleRuntime.js +1513 -0
- package/build/ParticleTModel.js +1423 -0
- package/build/ParticleUtil.js +265 -0
- package/build/RunScheduler.js +10 -3
- package/build/ScheduleUtil.js +2 -2
- package/build/StateManager.js +235 -31
- package/build/StateUtil.js +14 -15
- package/build/TModel.js +62 -28
- package/build/TModelFactory.js +48 -0
- package/build/TModelManager.js +146 -98
- package/build/TModelUtil.js +11 -8
- package/build/TUtil.js +57 -47
- package/build/TargetData.js +7 -1
- package/build/TargetExecutor.js +63 -9
- package/build/TargetManager.js +39 -23
- package/build/TargetParser.js +38 -2
- package/build/TargetUtil.js +26 -5
- package/build/Viewport.js +2 -2
- package/build/VisibilityUtil.js +4 -2
- package/build/index.js +6 -1
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1423 @@
|
|
|
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; } } }; }
|
|
5
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
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."); }
|
|
7
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
8
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
9
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
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
|
+
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; } }
|
|
12
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
13
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
15
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
16
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
17
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
18
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
19
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
20
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
21
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
23
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
24
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
25
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
26
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
27
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
28
|
+
function _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }
|
|
29
|
+
function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }
|
|
30
|
+
function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }
|
|
31
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
32
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
33
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
34
|
+
import { TModel } from "./TModel.js";
|
|
35
|
+
import { TModelFactory } from "./TModelFactory.js";
|
|
36
|
+
import { ParticleRenderer } from "./ParticleRenderer.js";
|
|
37
|
+
import { ParticleRuntime } from "./ParticleRuntime.js";
|
|
38
|
+
import { ParticleUtil } from "./ParticleUtil.js";
|
|
39
|
+
import { ParticleChild } from "./ParticleChild.js";
|
|
40
|
+
import { TargetParser } from "./TargetParser.js";
|
|
41
|
+
import { TargetUtil } from "./TargetUtil.js";
|
|
42
|
+
import { TUtil } from "./TUtil.js";
|
|
43
|
+
import { getRunScheduler } from "./App.js";
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* It provides a TModel that can render instanced addChildren values on the GPU.
|
|
47
|
+
*/
|
|
48
|
+
var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
49
|
+
function ParticleTModel(type, targets, oid) {
|
|
50
|
+
var _this;
|
|
51
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
52
|
+
_classCallCheck(this, ParticleTModel);
|
|
53
|
+
_this = _callSuper(this, ParticleTModel, [type, targets, oid, options]);
|
|
54
|
+
_this.childActualValues = [];
|
|
55
|
+
_this.childTargetMaps = [];
|
|
56
|
+
_this.particleValuesDirty = false;
|
|
57
|
+
_this.particleRenderRequested = false;
|
|
58
|
+
_this.childHandles = [];
|
|
59
|
+
_this.childTargetValues = {};
|
|
60
|
+
_this.childTransitions = {};
|
|
61
|
+
_this.pendingGpuChildren = {};
|
|
62
|
+
_this.childRuntimePrograms = [];
|
|
63
|
+
_this.childRuntimeStates = [];
|
|
64
|
+
_this.pendingGpuChildRuntimeCounts = {};
|
|
65
|
+
_this.activeChildTransitionKey = undefined;
|
|
66
|
+
_this.gpuChildrenEnabled = false;
|
|
67
|
+
_this.childGeneration = 0;
|
|
68
|
+
_this.layoutEpoch = 0;
|
|
69
|
+
_this.completeLayoutEpoch = -1;
|
|
70
|
+
_this.layoutCompleteWaiters = [];
|
|
71
|
+
_this.particleSyncPromise = undefined;
|
|
72
|
+
_this.restoringParticleRuntime = false;
|
|
73
|
+
_this.particleRuntime = new ParticleRuntime(_this);
|
|
74
|
+
_this.particleRenderer = new ParticleRenderer(_this);
|
|
75
|
+
return _this;
|
|
76
|
+
}
|
|
77
|
+
_inherits(ParticleTModel, _TModel);
|
|
78
|
+
return _createClass(ParticleTModel, [{
|
|
79
|
+
key: "onDomReady",
|
|
80
|
+
value: function () {
|
|
81
|
+
var _onDomReady = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
82
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
83
|
+
while (1) switch (_context.prev = _context.next) {
|
|
84
|
+
case 0:
|
|
85
|
+
if (!this.restoringParticleRuntime) {
|
|
86
|
+
_context.next = 2;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
return _context.abrupt("return");
|
|
90
|
+
case 2:
|
|
91
|
+
_context.next = 4;
|
|
92
|
+
return this.syncParticleRenderer();
|
|
93
|
+
case 4:
|
|
94
|
+
this.particleRuntime.markPendingRenderReady();
|
|
95
|
+
case 5:
|
|
96
|
+
case "end":
|
|
97
|
+
return _context.stop();
|
|
98
|
+
}
|
|
99
|
+
}, _callee, this);
|
|
100
|
+
}));
|
|
101
|
+
function onDomReady() {
|
|
102
|
+
return _onDomReady.apply(this, arguments);
|
|
103
|
+
}
|
|
104
|
+
return onDomReady;
|
|
105
|
+
}()
|
|
106
|
+
}, {
|
|
107
|
+
key: "restoreRuntimeDomDerivedState",
|
|
108
|
+
value: function () {
|
|
109
|
+
var _restoreRuntimeDomDerivedState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
110
|
+
var restored;
|
|
111
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
112
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
113
|
+
case 0:
|
|
114
|
+
if (!(!this.gpuChildrenEnabled || !this.hasDom())) {
|
|
115
|
+
_context2.next = 3;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
this.restoringParticleRuntime = false;
|
|
119
|
+
return _context2.abrupt("return", false);
|
|
120
|
+
case 3:
|
|
121
|
+
restored = false;
|
|
122
|
+
_context2.prev = 4;
|
|
123
|
+
_context2.next = 7;
|
|
124
|
+
return this.waitForLayoutComplete();
|
|
125
|
+
case 7:
|
|
126
|
+
_context2.next = 9;
|
|
127
|
+
return this.syncParticleRenderer();
|
|
128
|
+
case 9:
|
|
129
|
+
restored = _context2.sent;
|
|
130
|
+
if (restored) {
|
|
131
|
+
_context2.next = 12;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
return _context2.abrupt("return", false);
|
|
135
|
+
case 12:
|
|
136
|
+
_context2.next = 14;
|
|
137
|
+
return this.particleRenderer.waitForPresentedFrame();
|
|
138
|
+
case 14:
|
|
139
|
+
_context2.prev = 14;
|
|
140
|
+
this.restoringParticleRuntime = false;
|
|
141
|
+
return _context2.finish(14);
|
|
142
|
+
case 17:
|
|
143
|
+
if (restored) {
|
|
144
|
+
this.particleRuntime.resumeRestored();
|
|
145
|
+
}
|
|
146
|
+
return _context2.abrupt("return", restored);
|
|
147
|
+
case 19:
|
|
148
|
+
case "end":
|
|
149
|
+
return _context2.stop();
|
|
150
|
+
}
|
|
151
|
+
}, _callee2, this, [[4,, 14, 17]]);
|
|
152
|
+
}));
|
|
153
|
+
function restoreRuntimeDomDerivedState() {
|
|
154
|
+
return _restoreRuntimeDomDerivedState.apply(this, arguments);
|
|
155
|
+
}
|
|
156
|
+
return restoreRuntimeDomDerivedState;
|
|
157
|
+
}()
|
|
158
|
+
}, {
|
|
159
|
+
key: "syncParticleRenderer",
|
|
160
|
+
value: function syncParticleRenderer() {
|
|
161
|
+
var _this2 = this;
|
|
162
|
+
if (this.particleSyncPromise) {
|
|
163
|
+
return this.particleSyncPromise;
|
|
164
|
+
}
|
|
165
|
+
this.particleSyncPromise = this.syncParticleRendererNow().finally(function () {
|
|
166
|
+
_this2.particleSyncPromise = undefined;
|
|
167
|
+
});
|
|
168
|
+
return this.particleSyncPromise;
|
|
169
|
+
}
|
|
170
|
+
}, {
|
|
171
|
+
key: "syncParticleRendererNow",
|
|
172
|
+
value: function () {
|
|
173
|
+
var _syncParticleRendererNow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
174
|
+
var key, targetName, transition, applied;
|
|
175
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
176
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
177
|
+
case 0:
|
|
178
|
+
if (!(!this.gpuChildrenEnabled || !this.hasDom())) {
|
|
179
|
+
_context3.next = 2;
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
return _context3.abrupt("return", false);
|
|
183
|
+
case 2:
|
|
184
|
+
if (!this.childHandles.length) {
|
|
185
|
+
_context3.next = 7;
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
_context3.next = 5;
|
|
189
|
+
return this.particleRenderer.setParticles(this.childHandles);
|
|
190
|
+
case 5:
|
|
191
|
+
_context3.next = 9;
|
|
192
|
+
break;
|
|
193
|
+
case 7:
|
|
194
|
+
_context3.next = 9;
|
|
195
|
+
return this.particleRenderer.init();
|
|
196
|
+
case 9:
|
|
197
|
+
key = this.activeChildTransitionKey;
|
|
198
|
+
if (key) {
|
|
199
|
+
_context3.next = 12;
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
return _context3.abrupt("return", true);
|
|
203
|
+
case 12:
|
|
204
|
+
targetName = TargetUtil.getTargetName(key);
|
|
205
|
+
transition = this.childTransitions[targetName];
|
|
206
|
+
if (transition) {
|
|
207
|
+
_context3.next = 16;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
return _context3.abrupt("return", true);
|
|
211
|
+
case 16:
|
|
212
|
+
_context3.next = 18;
|
|
213
|
+
return this.particleRenderer.setTargetParticles(transition.values, transition.steps, transition.generation);
|
|
214
|
+
case 18:
|
|
215
|
+
applied = _context3.sent;
|
|
216
|
+
if (applied && this.childTransitions[targetName] === transition) {
|
|
217
|
+
this.handleSpecialTargetStep(key);
|
|
218
|
+
}
|
|
219
|
+
return _context3.abrupt("return", true);
|
|
220
|
+
case 21:
|
|
221
|
+
case "end":
|
|
222
|
+
return _context3.stop();
|
|
223
|
+
}
|
|
224
|
+
}, _callee3, this);
|
|
225
|
+
}));
|
|
226
|
+
function syncParticleRendererNow() {
|
|
227
|
+
return _syncParticleRendererNow.apply(this, arguments);
|
|
228
|
+
}
|
|
229
|
+
return syncParticleRendererNow;
|
|
230
|
+
}()
|
|
231
|
+
}, {
|
|
232
|
+
key: "requestParticleRender",
|
|
233
|
+
value: function requestParticleRender() {
|
|
234
|
+
var _this3 = this;
|
|
235
|
+
if (this.restoringParticleRuntime || !this.gpuChildrenEnabled || !this.hasDom() || this.particleRenderRequested) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
this.particleRenderRequested = true;
|
|
239
|
+
requestAnimationFrame(function () {
|
|
240
|
+
_this3.particleRenderRequested = false;
|
|
241
|
+
if (_this3.activeChildTransitionKey) {
|
|
242
|
+
_this3.particleRenderer.render();
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (_this3.particleValuesDirty) {
|
|
246
|
+
_this3.particleValuesDirty = false;
|
|
247
|
+
_this3.particleRenderer.updateParticles(_this3.childHandles);
|
|
248
|
+
} else {
|
|
249
|
+
_this3.particleRenderer.render();
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}, {
|
|
254
|
+
key: "getChildrenRenderer",
|
|
255
|
+
value: function getChildrenRenderer() {
|
|
256
|
+
var target = this.targets[TargetUtil.currentTargetName];
|
|
257
|
+
return (target === null || target === void 0 ? void 0 : target.renderer) || "auto";
|
|
258
|
+
}
|
|
259
|
+
}, {
|
|
260
|
+
key: "canRenderChildren",
|
|
261
|
+
value: function canRenderChildren(values) {
|
|
262
|
+
var _this4 = this;
|
|
263
|
+
values = Array.isArray(values) ? values : [values];
|
|
264
|
+
return values.length > 0 && values.every(function (value) {
|
|
265
|
+
if (!value || _typeof(value) !== "object" || Array.isArray(value)) {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
return Object.entries(value).every(function (_ref) {
|
|
269
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
270
|
+
key = _ref2[0],
|
|
271
|
+
propertyValue = _ref2[1];
|
|
272
|
+
var cleanKey = TargetUtil.getTargetName(key);
|
|
273
|
+
return key === cleanKey && ParticleUtil.isGpuTarget(cleanKey) && _this4.canRenderChildValue(propertyValue);
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}, {
|
|
278
|
+
key: "canRenderChildValue",
|
|
279
|
+
value: function canRenderChildValue(value) {
|
|
280
|
+
if (typeof value === "function") {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
if (!TargetParser.isTargetSpecObject(value)) {
|
|
284
|
+
return true;
|
|
285
|
+
}
|
|
286
|
+
if (typeof value.value === "function") {
|
|
287
|
+
return false;
|
|
288
|
+
}
|
|
289
|
+
if (Array.isArray(value.value)) {
|
|
290
|
+
return value.value.length >= 2;
|
|
291
|
+
}
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
}, {
|
|
295
|
+
key: "affectsChildLayout",
|
|
296
|
+
value: function affectsChildLayout(key) {
|
|
297
|
+
return ParticleUtil.affectsChildLayout(key);
|
|
298
|
+
}
|
|
299
|
+
}, {
|
|
300
|
+
key: "getChild",
|
|
301
|
+
value: function getChild(index) {
|
|
302
|
+
if (!this.gpuChildrenEnabled || typeof index !== "number") {
|
|
303
|
+
return _superPropGet(ParticleTModel, "getChild", this, 3)([index]);
|
|
304
|
+
}
|
|
305
|
+
return this.childHandles[index];
|
|
306
|
+
}
|
|
307
|
+
}, {
|
|
308
|
+
key: "getChildren",
|
|
309
|
+
value: function getChildren() {
|
|
310
|
+
var children = _superPropGet(ParticleTModel, "getChildren", this, 3)([]);
|
|
311
|
+
return this.gpuChildrenEnabled ? [].concat(_toConsumableArray(children), _toConsumableArray(this.childHandles)) : children;
|
|
312
|
+
}
|
|
313
|
+
}, {
|
|
314
|
+
key: "getChildValue",
|
|
315
|
+
value: function getChildValue(index, key) {
|
|
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];
|
|
325
|
+
}
|
|
326
|
+
}, {
|
|
327
|
+
key: "setChildTarget",
|
|
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) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
child.allTargetMap[cleanKey] = key;
|
|
337
|
+
this.childTargetMaps[index] = child.allTargetMap;
|
|
338
|
+
this.particleRuntime.setImperativeTarget(index, cleanKey, target, steps, interval, easing, originalTargetName, originalTModel);
|
|
339
|
+
}
|
|
340
|
+
}, {
|
|
341
|
+
key: "setChildValue",
|
|
342
|
+
value: function setChildValue(index, key, value) {
|
|
343
|
+
var invalidateLayout = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
344
|
+
var child = this.childHandles[index];
|
|
345
|
+
if (!child) {
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
var cleanKey = ParticleUtil.getTargetName(key);
|
|
349
|
+
if (child.actualValues[cleanKey] === value) {
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
child.actualValues[cleanKey] = value;
|
|
353
|
+
if (ParticleUtil.isGpuTarget(cleanKey)) {
|
|
354
|
+
this.particleValuesDirty = true;
|
|
355
|
+
}
|
|
356
|
+
if (invalidateLayout && this.affectsChildLayout(cleanKey)) {
|
|
357
|
+
this.invalidateLayout();
|
|
358
|
+
}
|
|
359
|
+
return true;
|
|
360
|
+
}
|
|
361
|
+
}, {
|
|
362
|
+
key: "getChildTargetValues",
|
|
363
|
+
value: function getChildTargetValues(key) {
|
|
364
|
+
return this.childTargetValues[TargetUtil.getTargetName(key)];
|
|
365
|
+
}
|
|
366
|
+
}, {
|
|
367
|
+
key: "handleChildTargets",
|
|
368
|
+
value: function handleChildTargets(key, targetValues) {
|
|
369
|
+
var _this5 = this;
|
|
370
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
371
|
+
var targetName = TargetUtil.getTargetName(key);
|
|
372
|
+
var defaultSteps = Math.max(0, Number(options.steps) || 0);
|
|
373
|
+
var children = [];
|
|
374
|
+
var handledNonGpu = false;
|
|
375
|
+
for (var index = 0; index < targetValues.length; index++) {
|
|
376
|
+
var targets = targetValues[index];
|
|
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;
|
|
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);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
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
|
|
457
|
+
};
|
|
458
|
+
this.childTransitions[targetName] = transition;
|
|
459
|
+
this.activeChildTransitionKey = key;
|
|
460
|
+
this.addChildTransitionLayoutTargets(transition);
|
|
461
|
+
if (this.hasDom()) {
|
|
462
|
+
this.particleRenderer.setTargetParticles(segment.values, segment.steps, transition.generation).then(function (applied) {
|
|
463
|
+
if (applied && _this5.childTransitions[targetName] === transition) {
|
|
464
|
+
_this5.handleSpecialTargetStep(key);
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
return {
|
|
469
|
+
handled: true,
|
|
470
|
+
steps: segment.maxSteps
|
|
471
|
+
};
|
|
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
|
+
}
|
|
521
|
+
}, {
|
|
522
|
+
key: "handleSpecialTarget",
|
|
523
|
+
value: function handleSpecialTarget(key, value) {
|
|
524
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
525
|
+
if (!this.gpuChildrenEnabled) {
|
|
526
|
+
return false;
|
|
527
|
+
}
|
|
528
|
+
var targetValues = this.getChildTargetValues(key);
|
|
529
|
+
if (targetValues) {
|
|
530
|
+
return this.handleChildTargets(key, targetValues, options);
|
|
531
|
+
}
|
|
532
|
+
return false;
|
|
533
|
+
}
|
|
534
|
+
}, {
|
|
535
|
+
key: "getRenderScrollLeft",
|
|
536
|
+
value: function getRenderScrollLeft() {
|
|
537
|
+
var _this$$dom;
|
|
538
|
+
return ((_this$$dom = this.$dom) === null || _this$$dom === void 0 ? void 0 : _this$$dom.getScrollLeft()) || this.getScrollLeft() || 0;
|
|
539
|
+
}
|
|
540
|
+
}, {
|
|
541
|
+
key: "getRenderScrollTop",
|
|
542
|
+
value: function getRenderScrollTop() {
|
|
543
|
+
var _this$$dom2;
|
|
544
|
+
return ((_this$$dom2 = this.$dom) === null || _this$$dom2 === void 0 ? void 0 : _this$$dom2.getScrollTop()) || this.getScrollTop() || 0;
|
|
545
|
+
}
|
|
546
|
+
}, {
|
|
547
|
+
key: "addChild",
|
|
548
|
+
value: function addChild(child) {
|
|
549
|
+
var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.addedChildren.length + this.allChildrenList.length;
|
|
550
|
+
if (child && _typeof(child) === "object" && !(child instanceof TModel) && ParticleUtil.isChildrenTarget(TargetUtil.currentTargetName)) {
|
|
551
|
+
var renderer = this.getChildrenRenderer();
|
|
552
|
+
if (renderer !== "dom") {
|
|
553
|
+
var childDefinition = TUtil.cloneTargetDefinition(child);
|
|
554
|
+
if (renderer === "gpu" || this.canRenderChildren(childDefinition)) {
|
|
555
|
+
this.addGpuChild(childDefinition);
|
|
556
|
+
return this;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
return _superPropGet(ParticleTModel, "addChild", this, 3)([child, index]);
|
|
561
|
+
}
|
|
562
|
+
}, {
|
|
563
|
+
key: "addGpuChild",
|
|
564
|
+
value: function addGpuChild(definition) {
|
|
565
|
+
var key = TargetUtil.currentTargetName;
|
|
566
|
+
var targetName = TargetUtil.getTargetName(key);
|
|
567
|
+
var index = this.childHandles.length;
|
|
568
|
+
this.gpuChildrenEnabled = true;
|
|
569
|
+
var handle = new ParticleChild(this, index);
|
|
570
|
+
this.childHandles[index] = handle;
|
|
571
|
+
this.childActualValues[index] = handle.actualValues;
|
|
572
|
+
this.childTargetMaps[index] = handle.allTargetMap;
|
|
573
|
+
try {
|
|
574
|
+
var _this$pendingGpuChild, _this$pendingGpuChild2;
|
|
575
|
+
var compiled = ParticleUtil.compileChildDefinition(handle, definition);
|
|
576
|
+
var child = this.createGpuChild(compiled.renderDefinition);
|
|
577
|
+
if (!child) {
|
|
578
|
+
this.childHandles.pop();
|
|
579
|
+
this.childActualValues.pop();
|
|
580
|
+
this.childTargetMaps.pop();
|
|
581
|
+
return false;
|
|
582
|
+
}
|
|
583
|
+
Object.assign(handle.actualValues, child.initial);
|
|
584
|
+
this.childActualValues[index] = handle.actualValues;
|
|
585
|
+
this.childTargetMaps[index] = handle.allTargetMap;
|
|
586
|
+
this.particleRuntime.registerChild(index, targetName, compiled);
|
|
587
|
+
var pending = (_this$pendingGpuChild2 = (_this$pendingGpuChild = this.pendingGpuChildren)[targetName]) !== null && _this$pendingGpuChild2 !== void 0 ? _this$pendingGpuChild2 : _this$pendingGpuChild[targetName] = {
|
|
588
|
+
key: key,
|
|
589
|
+
children: []
|
|
590
|
+
};
|
|
591
|
+
pending.children.push(_objectSpread({
|
|
592
|
+
index: index
|
|
593
|
+
}, child));
|
|
594
|
+
this.childGeneration++;
|
|
595
|
+
this.childrenUpdateFlag = true;
|
|
596
|
+
this.markLayoutDirty("addGpuChild");
|
|
597
|
+
return true;
|
|
598
|
+
} catch (error) {
|
|
599
|
+
this.childHandles.pop();
|
|
600
|
+
this.childActualValues.pop();
|
|
601
|
+
this.childTargetMaps.pop();
|
|
602
|
+
this.childRuntimePrograms.pop();
|
|
603
|
+
this.childRuntimeStates.pop();
|
|
604
|
+
throw error;
|
|
605
|
+
}
|
|
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
|
+
}
|
|
691
|
+
}, {
|
|
692
|
+
key: "isTargetEnabled",
|
|
693
|
+
value: function isTargetEnabled(key) {
|
|
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)) {
|
|
696
|
+
return false;
|
|
697
|
+
}
|
|
698
|
+
return _superPropGet(ParticleTModel, "isTargetEnabled", this, 3)([key]);
|
|
699
|
+
}
|
|
700
|
+
}, {
|
|
701
|
+
key: "activateGpuChildTarget",
|
|
702
|
+
value: function activateGpuChildTarget(index, key) {
|
|
703
|
+
return this.particleRuntime.activateTarget(index, key);
|
|
704
|
+
}
|
|
705
|
+
}, {
|
|
706
|
+
key: "createGpuChild",
|
|
707
|
+
value: function createGpuChild(definition) {
|
|
708
|
+
var initial = {};
|
|
709
|
+
var target = {};
|
|
710
|
+
var steps = {};
|
|
711
|
+
var loops = {};
|
|
712
|
+
var valueLists = {};
|
|
713
|
+
var hasTransition = false;
|
|
714
|
+
for (var _i6 = 0, _Object$entries2 = Object.entries(definition); _i6 < _Object$entries2.length; _i6++) {
|
|
715
|
+
var _resolved$valueList;
|
|
716
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i6], 2),
|
|
717
|
+
property = _Object$entries2$_i[0],
|
|
718
|
+
value = _Object$entries2$_i[1];
|
|
719
|
+
var resolved = this.resolveInitialChildProperty(value);
|
|
720
|
+
if (!resolved) {
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
initial[property] = resolved.initialValue;
|
|
724
|
+
target[property] = resolved.targetValue;
|
|
725
|
+
if (resolved.steps !== undefined) {
|
|
726
|
+
steps[property] = resolved.steps;
|
|
727
|
+
}
|
|
728
|
+
if (resolved.valueList) {
|
|
729
|
+
valueLists[property] = resolved.valueList;
|
|
730
|
+
}
|
|
731
|
+
if (resolved.loop) {
|
|
732
|
+
loops[property] = true;
|
|
733
|
+
}
|
|
734
|
+
if (((_resolved$valueList = resolved.valueList) === null || _resolved$valueList === void 0 ? void 0 : _resolved$valueList.length) > 1 || resolved.initialValue !== resolved.targetValue) {
|
|
735
|
+
hasTransition = true;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
return {
|
|
739
|
+
initial: initial,
|
|
740
|
+
target: target,
|
|
741
|
+
steps: steps,
|
|
742
|
+
loops: loops,
|
|
743
|
+
valueLists: valueLists,
|
|
744
|
+
hasTransition: hasTransition
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
}, {
|
|
748
|
+
key: "finalizeChildrenTarget",
|
|
749
|
+
value: function finalizeChildrenTarget(key) {
|
|
750
|
+
var _this6 = this;
|
|
751
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
752
|
+
if (!ParticleUtil.isChildrenTarget(key)) {
|
|
753
|
+
return false;
|
|
754
|
+
}
|
|
755
|
+
var targetName = TargetUtil.getTargetName(key);
|
|
756
|
+
var pending = this.pendingGpuChildren[targetName];
|
|
757
|
+
if (!(pending !== null && pending !== void 0 && pending.children.length)) {
|
|
758
|
+
return false;
|
|
759
|
+
}
|
|
760
|
+
this.invalidateLayout();
|
|
761
|
+
var defaultSteps = Math.max(0, Number(options.steps) || 0);
|
|
762
|
+
var segmentCount = this.getChildrenSegmentCount(pending.children);
|
|
763
|
+
var segment = this.buildChildTransitionSegment(pending.children, 0, defaultSteps);
|
|
764
|
+
this.commitImmediateChildTransitionValues(pending.children, segment.values, segment.steps);
|
|
765
|
+
delete this.pendingGpuChildren[targetName];
|
|
766
|
+
if (!segment.hasSegment || segment.maxSteps === 0) {
|
|
767
|
+
this.commitChildTransitionSegment(pending.children, segment.values, segment.steps);
|
|
768
|
+
var runtimeIndexes = pending.children.map(function (child) {
|
|
769
|
+
return child.index;
|
|
770
|
+
}).filter(function (index) {
|
|
771
|
+
var state = _this6.childRuntimeStates[index];
|
|
772
|
+
return state && !state.done;
|
|
773
|
+
});
|
|
774
|
+
var _iterator5 = _createForOfIteratorHelper(runtimeIndexes),
|
|
775
|
+
_step5;
|
|
776
|
+
try {
|
|
777
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
778
|
+
var index = _step5.value;
|
|
779
|
+
this.particleRuntime.queueStart(index);
|
|
780
|
+
}
|
|
781
|
+
} catch (err) {
|
|
782
|
+
_iterator5.e(err);
|
|
783
|
+
} finally {
|
|
784
|
+
_iterator5.f();
|
|
785
|
+
}
|
|
786
|
+
if (this.hasDom()) {
|
|
787
|
+
this.particleRenderer.setParticles(this.childHandles).then(function () {
|
|
788
|
+
_this6.particleRuntime.markRenderReady(runtimeIndexes);
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
return {
|
|
792
|
+
handled: true,
|
|
793
|
+
steps: 0
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
var transition = {
|
|
797
|
+
children: pending.children,
|
|
798
|
+
segmentIndex: 0,
|
|
799
|
+
segmentCount: segmentCount,
|
|
800
|
+
defaultSteps: defaultSteps,
|
|
801
|
+
initialValues: segment.initialValues,
|
|
802
|
+
values: segment.values,
|
|
803
|
+
steps: segment.steps,
|
|
804
|
+
loops: segment.loops,
|
|
805
|
+
hasLoop: segment.hasLoop,
|
|
806
|
+
generation: this.childGeneration
|
|
807
|
+
};
|
|
808
|
+
this.childTransitions[targetName] = transition;
|
|
809
|
+
this.activeChildTransitionKey = key;
|
|
810
|
+
this.addChildTransitionLayoutTargets(transition);
|
|
811
|
+
return {
|
|
812
|
+
handled: true,
|
|
813
|
+
steps: segment.maxSteps
|
|
814
|
+
};
|
|
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
|
+
}
|
|
896
|
+
}, {
|
|
897
|
+
key: "advanceChildTransitionSegment",
|
|
898
|
+
value: function advanceChildTransitionSegment(key, transition) {
|
|
899
|
+
var _this7 = this;
|
|
900
|
+
if (!transition || !Array.isArray(transition.children) || !Number.isInteger(transition.segmentIndex) || !Number.isInteger(transition.segmentCount)) {
|
|
901
|
+
return false;
|
|
902
|
+
}
|
|
903
|
+
var nextSegmentIndex = transition.segmentIndex + 1;
|
|
904
|
+
if (nextSegmentIndex >= transition.segmentCount) {
|
|
905
|
+
return false;
|
|
906
|
+
}
|
|
907
|
+
this.commitChildTransitionSegment(transition.children, transition.values, transition.steps);
|
|
908
|
+
this.particleRenderer.completeTransition();
|
|
909
|
+
var segment = this.buildChildTransitionSegment(transition.children, nextSegmentIndex, transition.defaultSteps);
|
|
910
|
+
transition.segmentIndex = nextSegmentIndex;
|
|
911
|
+
transition.initialValues = segment.initialValues;
|
|
912
|
+
transition.values = segment.values;
|
|
913
|
+
transition.steps = segment.steps;
|
|
914
|
+
transition.loops = segment.loops;
|
|
915
|
+
this.commitImmediateChildTransitionValues(transition.children, segment.values, segment.steps);
|
|
916
|
+
this.addChildTransitionLayoutTargets(transition);
|
|
917
|
+
var targetValue = this.targetValues[key];
|
|
918
|
+
if (targetValue) {
|
|
919
|
+
targetValue.steps = segment.maxSteps;
|
|
920
|
+
}
|
|
921
|
+
this.resetTargetStep(key);
|
|
922
|
+
this.resetTargetInitialValue(key);
|
|
923
|
+
this.setTargetStatus(key, "updating");
|
|
924
|
+
if (this.hasDom()) {
|
|
925
|
+
this.particleRenderer.setTargetParticles(segment.values, segment.steps, transition.generation).then(function (applied) {
|
|
926
|
+
if (applied && _this7.childTransitions[TargetUtil.getTargetName(key)] === transition) {
|
|
927
|
+
_this7.handleSpecialTargetStep(key);
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
return true;
|
|
932
|
+
}
|
|
933
|
+
}, {
|
|
934
|
+
key: "buildChildTransitionSegment",
|
|
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;
|
|
939
|
+
});
|
|
940
|
+
var steps = new Array(this.childHandles.length);
|
|
941
|
+
var loops = new Array(this.childHandles.length);
|
|
942
|
+
var maxSteps = 0;
|
|
943
|
+
var hasSegment = false;
|
|
944
|
+
var hasLoop = false;
|
|
945
|
+
var _iterator7 = _createForOfIteratorHelper(children),
|
|
946
|
+
_step7;
|
|
947
|
+
try {
|
|
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;
|
|
967
|
+
if (valueList) {
|
|
968
|
+
if (segmentIndex >= valueList.length - 1) {
|
|
969
|
+
continue;
|
|
970
|
+
}
|
|
971
|
+
value = valueList[segmentIndex + 1];
|
|
972
|
+
} else {
|
|
973
|
+
if (segmentIndex !== 0 || current[property] === transitionChild.target[property]) {
|
|
974
|
+
continue;
|
|
975
|
+
}
|
|
976
|
+
value = transitionChild.target[property];
|
|
977
|
+
}
|
|
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;
|
|
987
|
+
maxSteps = Math.max(maxSteps, propertySteps);
|
|
988
|
+
hasSegment = true;
|
|
989
|
+
if (childLoops[property]) {
|
|
990
|
+
hasLoop = true;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
if (target) {
|
|
994
|
+
initialValues[index] = initial;
|
|
995
|
+
values[index] = target;
|
|
996
|
+
steps[index] = childSteps;
|
|
997
|
+
loops[index] = childLoops;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
} catch (err) {
|
|
1001
|
+
_iterator7.e(err);
|
|
1002
|
+
} finally {
|
|
1003
|
+
_iterator7.f();
|
|
1004
|
+
}
|
|
1005
|
+
return {
|
|
1006
|
+
initialValues: initialValues,
|
|
1007
|
+
values: values,
|
|
1008
|
+
steps: steps,
|
|
1009
|
+
loops: loops,
|
|
1010
|
+
maxSteps: maxSteps,
|
|
1011
|
+
hasSegment: hasSegment,
|
|
1012
|
+
hasLoop: hasLoop
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
}, {
|
|
1016
|
+
key: "getChildPropertySteps",
|
|
1017
|
+
value: function getChildPropertySteps(child, property, segmentIndex, defaultSteps) {
|
|
1018
|
+
var steps = child.steps[property];
|
|
1019
|
+
if (Array.isArray(steps)) {
|
|
1020
|
+
if (!steps.length) {
|
|
1021
|
+
return defaultSteps;
|
|
1022
|
+
}
|
|
1023
|
+
return Math.max(0, Number(steps[segmentIndex % steps.length]) || 0);
|
|
1024
|
+
}
|
|
1025
|
+
return steps !== undefined ? Math.max(0, Number(steps) || 0) : defaultSteps;
|
|
1026
|
+
}
|
|
1027
|
+
}, {
|
|
1028
|
+
key: "getChildSegmentCount",
|
|
1029
|
+
value: function getChildSegmentCount(child) {
|
|
1030
|
+
var count = 0;
|
|
1031
|
+
for (var _i10 = 0, _Object$values4 = Object.values(child.valueLists); _i10 < _Object$values4.length; _i10++) {
|
|
1032
|
+
var valueList = _Object$values4[_i10];
|
|
1033
|
+
count = Math.max(count, valueList.length - 1);
|
|
1034
|
+
}
|
|
1035
|
+
return count;
|
|
1036
|
+
}
|
|
1037
|
+
}, {
|
|
1038
|
+
key: "getChildrenSegmentCount",
|
|
1039
|
+
value: function getChildrenSegmentCount(children) {
|
|
1040
|
+
var count = 0;
|
|
1041
|
+
var _iterator8 = _createForOfIteratorHelper(children),
|
|
1042
|
+
_step8;
|
|
1043
|
+
try {
|
|
1044
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
1045
|
+
var child = _step8.value;
|
|
1046
|
+
count = Math.max(count, this.getChildSegmentCount(child));
|
|
1047
|
+
}
|
|
1048
|
+
} catch (err) {
|
|
1049
|
+
_iterator8.e(err);
|
|
1050
|
+
} finally {
|
|
1051
|
+
_iterator8.f();
|
|
1052
|
+
}
|
|
1053
|
+
return count;
|
|
1054
|
+
}
|
|
1055
|
+
}, {
|
|
1056
|
+
key: "getActiveChildTransition",
|
|
1057
|
+
value: function getActiveChildTransition() {
|
|
1058
|
+
if (!this.activeChildTransitionKey) {
|
|
1059
|
+
return;
|
|
1060
|
+
}
|
|
1061
|
+
var targetName = TargetUtil.getTargetName(this.activeChildTransitionKey);
|
|
1062
|
+
return this.childTransitions[targetName];
|
|
1063
|
+
}
|
|
1064
|
+
}, {
|
|
1065
|
+
key: "handleSpecialTargetStep",
|
|
1066
|
+
value: function handleSpecialTargetStep(key) {
|
|
1067
|
+
var targetName = TargetUtil.getTargetName(key);
|
|
1068
|
+
var transition = this.childTransitions[targetName];
|
|
1069
|
+
if (!transition || transition.generation !== this.childGeneration) {
|
|
1070
|
+
return false;
|
|
1071
|
+
}
|
|
1072
|
+
this.particleRenderer.setTransitionStep(this.getTargetStep(key));
|
|
1073
|
+
return true;
|
|
1074
|
+
}
|
|
1075
|
+
}, {
|
|
1076
|
+
key: "handleSpecialTargetEnd",
|
|
1077
|
+
value: function handleSpecialTargetEnd(key) {
|
|
1078
|
+
var targetName = TargetUtil.getTargetName(key);
|
|
1079
|
+
var transition = this.childTransitions[targetName];
|
|
1080
|
+
if (!transition) {
|
|
1081
|
+
return false;
|
|
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
|
+
}
|
|
1094
|
+
if (this.advanceChildTransitionSegment(key, transition)) {
|
|
1095
|
+
return true;
|
|
1096
|
+
}
|
|
1097
|
+
if (transition.hasLoop) {
|
|
1098
|
+
this.restartChildTransition(key, transition);
|
|
1099
|
+
return true;
|
|
1100
|
+
}
|
|
1101
|
+
this.commitChildTransitionSegment(transition.children, transition.values, transition.steps);
|
|
1102
|
+
this.particleRenderer.completeTransition();
|
|
1103
|
+
delete this.childTransitions[targetName];
|
|
1104
|
+
delete this.childTargetValues[targetName];
|
|
1105
|
+
if (this.activeChildTransitionKey === key) {
|
|
1106
|
+
this.activeChildTransitionKey = undefined;
|
|
1107
|
+
}
|
|
1108
|
+
return true;
|
|
1109
|
+
}
|
|
1110
|
+
}, {
|
|
1111
|
+
key: "resolveInitialChildProperty",
|
|
1112
|
+
value: function resolveInitialChildProperty(value) {
|
|
1113
|
+
if (!TargetParser.isTargetSpecObject(value)) {
|
|
1114
|
+
return {
|
|
1115
|
+
initialValue: value,
|
|
1116
|
+
targetValue: value,
|
|
1117
|
+
valueList: undefined,
|
|
1118
|
+
steps: undefined,
|
|
1119
|
+
loop: false
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
var targetValue = value.value;
|
|
1123
|
+
var steps = Array.isArray(value.steps) ? value.steps.map(function (step) {
|
|
1124
|
+
return Math.max(0, Number(step) || 0);
|
|
1125
|
+
}) : value.steps !== undefined ? Math.max(0, Number(value.steps) || 0) : undefined;
|
|
1126
|
+
var loop = value.loop === true;
|
|
1127
|
+
if (Array.isArray(targetValue)) {
|
|
1128
|
+
if (targetValue.length < 2) {
|
|
1129
|
+
return;
|
|
1130
|
+
}
|
|
1131
|
+
return {
|
|
1132
|
+
initialValue: targetValue[0],
|
|
1133
|
+
targetValue: targetValue[1],
|
|
1134
|
+
valueList: _toConsumableArray(targetValue),
|
|
1135
|
+
steps: steps,
|
|
1136
|
+
loop: loop
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
return {
|
|
1140
|
+
initialValue: targetValue,
|
|
1141
|
+
targetValue: targetValue,
|
|
1142
|
+
valueList: undefined,
|
|
1143
|
+
steps: 0,
|
|
1144
|
+
loop: loop
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
}, {
|
|
1148
|
+
key: "restartChildTransition",
|
|
1149
|
+
value: function restartChildTransition(key, transition) {
|
|
1150
|
+
if (!(transition !== null && transition !== void 0 && transition.hasLoop)) {
|
|
1151
|
+
return false;
|
|
1152
|
+
}
|
|
1153
|
+
this.resetTargetStep(key);
|
|
1154
|
+
this.resetTargetInitialValue(key);
|
|
1155
|
+
this.setTargetStatus(key, "updating");
|
|
1156
|
+
this.addChildTransitionLayoutTargets(transition);
|
|
1157
|
+
this.handleSpecialTargetStep(key);
|
|
1158
|
+
return true;
|
|
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
|
+
}
|
|
1168
|
+
}, {
|
|
1169
|
+
key: "shouldCalculateChildren",
|
|
1170
|
+
value: function shouldCalculateChildren() {
|
|
1171
|
+
if (!this.gpuChildrenEnabled) {
|
|
1172
|
+
return _superPropGet(ParticleTModel, "shouldCalculateChildren", this, 3)([]);
|
|
1173
|
+
}
|
|
1174
|
+
if (!this.getDirtyLayout() && this.completeLayoutEpoch === this.layoutEpoch && !this.hasLayoutStateChanged()) {
|
|
1175
|
+
this.currentStatus = undefined;
|
|
1176
|
+
this.requestParticleRender();
|
|
1177
|
+
return false;
|
|
1178
|
+
}
|
|
1179
|
+
return _superPropGet(ParticleTModel, "shouldCalculateChildren", this, 3)([]);
|
|
1180
|
+
}
|
|
1181
|
+
}, {
|
|
1182
|
+
key: "getLayoutState",
|
|
1183
|
+
value: function getLayoutState() {
|
|
1184
|
+
return [this.getWidth(), this.getHeight(), this.val("gap"), this.getPaddingTop(), this.getPaddingRight(), this.getPaddingBottom(), this.getPaddingLeft(), this.getContainerOverflowMode()];
|
|
1185
|
+
}
|
|
1186
|
+
}, {
|
|
1187
|
+
key: "markLayoutComplete",
|
|
1188
|
+
value: function markLayoutComplete(epoch) {
|
|
1189
|
+
var _this8 = this;
|
|
1190
|
+
if (epoch !== this.layoutEpoch) {
|
|
1191
|
+
return;
|
|
1192
|
+
}
|
|
1193
|
+
this.completeLayoutEpoch = epoch;
|
|
1194
|
+
this.completeLayoutState = this.getLayoutState();
|
|
1195
|
+
if (this.particleRuntime.resolveInitialTargets()) {
|
|
1196
|
+
this.requestParticleRender();
|
|
1197
|
+
if (this.completeLayoutEpoch !== this.layoutEpoch) {
|
|
1198
|
+
getRunScheduler().schedule(0, "particleInitialTargets-".concat(this.oid));
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
this.particleRenderer.updateCanvasLayerWidthHeight();
|
|
1203
|
+
this.resolveLayoutCompleteWaiters();
|
|
1204
|
+
this.particleRuntime.startReady();
|
|
1205
|
+
var key = this.activeChildTransitionKey;
|
|
1206
|
+
if (!key) {
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1209
|
+
var targetName = TargetUtil.getTargetName(key);
|
|
1210
|
+
var transition = this.childTransitions[targetName];
|
|
1211
|
+
if (!transition) {
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
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()) {
|
|
1249
|
+
return;
|
|
1250
|
+
}
|
|
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()) {
|
|
1256
|
+
_this8.handleSpecialTargetStep(key);
|
|
1257
|
+
}
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1260
|
+
}, {
|
|
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;
|
|
1310
|
+
if (!previous || current.length !== previous.length) {
|
|
1311
|
+
return true;
|
|
1312
|
+
}
|
|
1313
|
+
return current.some(function (value, index) {
|
|
1314
|
+
return value !== previous[index];
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1317
|
+
}, {
|
|
1318
|
+
key: "invalidateLayout",
|
|
1319
|
+
value: function invalidateLayout() {
|
|
1320
|
+
this.layoutEpoch++;
|
|
1321
|
+
}
|
|
1322
|
+
}, {
|
|
1323
|
+
key: "getParticleCount",
|
|
1324
|
+
value: function getParticleCount() {
|
|
1325
|
+
return this.childHandles.length;
|
|
1326
|
+
}
|
|
1327
|
+
}, {
|
|
1328
|
+
key: "excludeRuntimeSnapshotField",
|
|
1329
|
+
value: function excludeRuntimeSnapshotField(key) {
|
|
1330
|
+
return ParticleUtil.isTransientRuntimeField(key);
|
|
1331
|
+
}
|
|
1332
|
+
}, {
|
|
1333
|
+
key: "restoreRuntimeDerivedState",
|
|
1334
|
+
value: function restoreRuntimeDerivedState() {
|
|
1335
|
+
var _this9 = this;
|
|
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;
|
|
1347
|
+
});
|
|
1348
|
+
this.childGeneration = Number.isInteger(this.childGeneration) ? this.childGeneration : 0;
|
|
1349
|
+
this.particleValuesDirty = false;
|
|
1350
|
+
this.particleRenderRequested = false;
|
|
1351
|
+
this.pendingGpuChildren = {};
|
|
1352
|
+
this.layoutEpoch = 0;
|
|
1353
|
+
this.completeLayoutEpoch = -1;
|
|
1354
|
+
this.completeLayoutState = undefined;
|
|
1355
|
+
this.layoutCompleteWaiters = [];
|
|
1356
|
+
this.particleSyncPromise = undefined;
|
|
1357
|
+
this.restoringParticleRuntime = true;
|
|
1358
|
+
this.particleRuntime = new ParticleRuntime(this);
|
|
1359
|
+
this.particleRuntime.prepareRestore();
|
|
1360
|
+
this.particleRenderer = new ParticleRenderer(this);
|
|
1361
|
+
}
|
|
1362
|
+
}, {
|
|
1363
|
+
key: "waitForLayoutComplete",
|
|
1364
|
+
value: function waitForLayoutComplete() {
|
|
1365
|
+
var _this10 = this;
|
|
1366
|
+
if (this.completeLayoutEpoch === this.layoutEpoch) {
|
|
1367
|
+
return Promise.resolve();
|
|
1368
|
+
}
|
|
1369
|
+
return new Promise(function (resolve) {
|
|
1370
|
+
_this10.layoutCompleteWaiters.push(resolve);
|
|
1371
|
+
});
|
|
1372
|
+
}
|
|
1373
|
+
}, {
|
|
1374
|
+
key: "resolveLayoutCompleteWaiters",
|
|
1375
|
+
value: function resolveLayoutCompleteWaiters() {
|
|
1376
|
+
var waiters = this.layoutCompleteWaiters.splice(0);
|
|
1377
|
+
var _iterator11 = _createForOfIteratorHelper(waiters),
|
|
1378
|
+
_step11;
|
|
1379
|
+
try {
|
|
1380
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
1381
|
+
var resolve = _step11.value;
|
|
1382
|
+
resolve();
|
|
1383
|
+
}
|
|
1384
|
+
} catch (err) {
|
|
1385
|
+
_iterator11.e(err);
|
|
1386
|
+
} finally {
|
|
1387
|
+
_iterator11.f();
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
}]);
|
|
1391
|
+
}(TModel);
|
|
1392
|
+
function isParticleTModel(targets) {
|
|
1393
|
+
if (!targets) {
|
|
1394
|
+
return false;
|
|
1395
|
+
}
|
|
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)) {
|
|
1401
|
+
continue;
|
|
1402
|
+
}
|
|
1403
|
+
if (!target || _typeof(target) !== "object") {
|
|
1404
|
+
continue;
|
|
1405
|
+
}
|
|
1406
|
+
if (target.renderer === "gpu") {
|
|
1407
|
+
return true;
|
|
1408
|
+
}
|
|
1409
|
+
if (target.renderer === "dom") {
|
|
1410
|
+
continue;
|
|
1411
|
+
}
|
|
1412
|
+
if (TUtil.isDefined(target.instances)) {
|
|
1413
|
+
return true;
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
return false;
|
|
1417
|
+
}
|
|
1418
|
+
function createParticleTModel(type, targets, oid) {
|
|
1419
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
1420
|
+
return new ParticleTModel(type, targets, oid, options);
|
|
1421
|
+
}
|
|
1422
|
+
TModelFactory.register(isParticleTModel, createParticleTModel);
|
|
1423
|
+
export { ParticleTModel };
|