targetj 1.1.0 → 1.1.1
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/build/AnimationManager.js +220 -152
- package/build/AnimationUtil.js +0 -1
- package/build/App.js +79 -39
- package/build/BaseModel.js +43 -11
- package/build/Easing.js +5 -0
- package/build/EventListener.js +29 -9
- package/build/HtmlToCanvas.js +411 -0
- package/build/LocationManager.js +44 -14
- package/build/PageManager.js +84 -33
- package/build/ParticleChild.js +12 -11
- package/build/ParticleExplode.js +360 -0
- package/build/ParticleRenderer.js +669 -188
- package/build/ParticleRuntime.js +844 -311
- package/build/ParticleTModel.js +362 -174
- package/build/ParticleUtil.js +2 -2
- package/build/RunScheduler.js +13 -8
- package/build/StateManager.js +125 -33
- package/build/StateUtil.js +141 -82
- package/build/TModel.js +171 -72
- package/build/TModelManager.js +51 -43
- package/build/TModelUtil.js +230 -143
- package/build/TUtil.js +4 -4
- package/build/TargetData.js +20 -12
- package/build/TargetExecutor.js +37 -14
- package/build/TargetManager.js +13 -18
- package/build/TargetParser.js +36 -2
- package/build/TargetUtil.js +189 -128
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/build/ParticleRuntime.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
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); }
|
|
2
|
+
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; }
|
|
3
|
+
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); }
|
|
4
|
+
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); }); }; }
|
|
2
5
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
3
6
|
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."); }
|
|
4
7
|
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; } }
|
|
5
8
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
6
|
-
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; }
|
|
7
|
-
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); }
|
|
8
|
-
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); }); }; }
|
|
9
9
|
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; } } }; }
|
|
10
10
|
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; }
|
|
11
11
|
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; }
|
|
@@ -49,16 +49,24 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
49
49
|
this.startQueueIndex = 0;
|
|
50
50
|
this.disposed = false;
|
|
51
51
|
this.animationFrameId = undefined;
|
|
52
|
+
this.loopQueue = [];
|
|
53
|
+
this.queuedLoops = new WeakMap();
|
|
54
|
+
this.runningLoops = new WeakMap();
|
|
55
|
+
this.imperativeCompletionFrame = undefined;
|
|
56
|
+
this.visibilityPaused = false;
|
|
57
|
+
this.restorePending = false;
|
|
58
|
+
this.propertyOwners = new WeakMap();
|
|
59
|
+
this.imperativeSequenceCount = 0;
|
|
52
60
|
}
|
|
53
61
|
return _createClass(ParticleRuntime, [{
|
|
54
62
|
key: "registerChild",
|
|
55
|
-
value: function registerChild(index,
|
|
63
|
+
value: function registerChild(index, originalTargetName, compiled) {
|
|
56
64
|
var hasRuntime = compiled.runtimeTargets.some(function (target) {
|
|
57
65
|
return target.requiresRuntime !== false;
|
|
58
66
|
});
|
|
59
67
|
this.tmodel.childRuntimePrograms[index] = compiled.runtimeTargets;
|
|
60
68
|
this.tmodel.childRuntimeStates[index] = {
|
|
61
|
-
|
|
69
|
+
originalTargetName: originalTargetName,
|
|
62
70
|
nextTargetIndex: 0,
|
|
63
71
|
activationCount: 0,
|
|
64
72
|
executions: {},
|
|
@@ -66,10 +74,13 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
66
74
|
startQueued: false,
|
|
67
75
|
renderReady: false,
|
|
68
76
|
started: false,
|
|
69
|
-
done: !hasRuntime
|
|
77
|
+
done: !hasRuntime,
|
|
78
|
+
targetCycles: {},
|
|
79
|
+
loopTargets: {},
|
|
80
|
+
mainFinished: false
|
|
70
81
|
};
|
|
71
82
|
if (hasRuntime) {
|
|
72
|
-
this.tmodel.pendingGpuChildRuntimeCounts[
|
|
83
|
+
this.tmodel.pendingGpuChildRuntimeCounts[originalTargetName] = (this.tmodel.pendingGpuChildRuntimeCounts[originalTargetName] || 0) + 1;
|
|
73
84
|
}
|
|
74
85
|
return hasRuntime;
|
|
75
86
|
}
|
|
@@ -79,6 +90,7 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
79
90
|
var state = this.tmodel.childRuntimeStates[index];
|
|
80
91
|
if (state) {
|
|
81
92
|
state.cancelled = true;
|
|
93
|
+
state.loopTargets = {};
|
|
82
94
|
if (!state.done) {
|
|
83
95
|
this.complete(index);
|
|
84
96
|
}
|
|
@@ -134,17 +146,22 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
134
146
|
if (completionScope === "none") {
|
|
135
147
|
return false;
|
|
136
148
|
}
|
|
137
|
-
var targetName = TargetUtil.getTargetName(key);
|
|
138
149
|
return this.tmodel.childRuntimeStates.some(function (state, index) {
|
|
139
|
-
if (!state || state.
|
|
150
|
+
if (!state || key !== undefined && state.originalTargetName !== key) {
|
|
140
151
|
return false;
|
|
141
152
|
}
|
|
142
153
|
if (completionScope === "visible" && TargetUtil.shouldIgnoreChildForCompletion(_this.tmodel.childHandles[index], "visible")) {
|
|
143
154
|
return false;
|
|
144
155
|
}
|
|
145
|
-
return !state.done || Object.keys(_this.activeTargets[index] || {}).length > 0;
|
|
156
|
+
return !state.renderReady || !state.done || Object.keys(_this.activeTargets[index] || {}).length > 0;
|
|
146
157
|
});
|
|
147
158
|
}
|
|
159
|
+
}, {
|
|
160
|
+
key: "hasPendingAny",
|
|
161
|
+
value: function hasPendingAny() {
|
|
162
|
+
var completionScope = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "all";
|
|
163
|
+
return this.hasPending(undefined, completionScope);
|
|
164
|
+
}
|
|
148
165
|
}, {
|
|
149
166
|
key: "isIntervalTarget",
|
|
150
167
|
value: function isIntervalTarget(runtimeTarget) {
|
|
@@ -153,17 +170,21 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
153
170
|
}, {
|
|
154
171
|
key: "prepareRestore",
|
|
155
172
|
value: function prepareRestore() {
|
|
173
|
+
this.restorePending = true;
|
|
156
174
|
this.restoredMainIndexes = [];
|
|
157
175
|
this.restoredActivationSequences = [];
|
|
158
176
|
this.restoredImperativeExecutions = [];
|
|
159
177
|
for (var index = 0; index < this.tmodel.childRuntimeStates.length; index++) {
|
|
160
|
-
var _state$executions, _state$activationCoun;
|
|
178
|
+
var _state$executions, _state$activationCoun, _state$targetCycles, _state$loopTargets, _state$mainFinished;
|
|
161
179
|
var state = this.tmodel.childRuntimeStates[index];
|
|
162
180
|
if (!state) {
|
|
163
181
|
continue;
|
|
164
182
|
}
|
|
165
183
|
(_state$executions = state.executions) !== null && _state$executions !== void 0 ? _state$executions : state.executions = {};
|
|
166
184
|
(_state$activationCoun = state.activationCount) !== null && _state$activationCoun !== void 0 ? _state$activationCoun : state.activationCount = 0;
|
|
185
|
+
(_state$targetCycles = state.targetCycles) !== null && _state$targetCycles !== void 0 ? _state$targetCycles : state.targetCycles = {};
|
|
186
|
+
(_state$loopTargets = state.loopTargets) !== null && _state$loopTargets !== void 0 ? _state$loopTargets : state.loopTargets = {};
|
|
187
|
+
(_state$mainFinished = state.mainFinished) !== null && _state$mainFinished !== void 0 ? _state$mainFinished : state.mainFinished = false;
|
|
167
188
|
var executions = Object.values(state.executions);
|
|
168
189
|
var mainExecutions = executions.filter(function (execution) {
|
|
169
190
|
return execution.sequenceId === "main";
|
|
@@ -195,6 +216,11 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
195
216
|
var _execution$sequenceId;
|
|
196
217
|
var execution = _executions[_i2];
|
|
197
218
|
if ((_execution$sequenceId = execution.sequenceId) !== null && _execution$sequenceId !== void 0 && _execution$sequenceId.startsWith("imperative:")) {
|
|
219
|
+
var lastPart = execution.sequenceId.split(":").pop();
|
|
220
|
+
var count = Number(lastPart);
|
|
221
|
+
if (Number.isFinite(count)) {
|
|
222
|
+
this.imperativeSequenceCount = Math.max(this.imperativeSequenceCount, count);
|
|
223
|
+
}
|
|
198
224
|
this.restoredImperativeExecutions.push({
|
|
199
225
|
index: index,
|
|
200
226
|
execution: execution
|
|
@@ -209,6 +235,10 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
209
235
|
}, {
|
|
210
236
|
key: "resumeRestored",
|
|
211
237
|
value: function resumeRestored() {
|
|
238
|
+
if (this.disposed || !this.restorePending || !this.tmodel.isVisible()) {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
this.restorePending = false;
|
|
212
242
|
var mainIndexes = this.restoredMainIndexes.splice(0);
|
|
213
243
|
var activationSequences = this.restoredActivationSequences.splice(0);
|
|
214
244
|
var imperativeExecutions = this.restoredImperativeExecutions.splice(0);
|
|
@@ -216,8 +246,8 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
216
246
|
_step2;
|
|
217
247
|
try {
|
|
218
248
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
219
|
-
var
|
|
220
|
-
this.resumeMainProgram(
|
|
249
|
+
var _index = _step2.value;
|
|
250
|
+
this.resumeMainProgram(_index);
|
|
221
251
|
}
|
|
222
252
|
} catch (err) {
|
|
223
253
|
_iterator2.e(err);
|
|
@@ -229,9 +259,9 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
229
259
|
try {
|
|
230
260
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
231
261
|
var _step3$value = _step3.value,
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
this.resumeActivationSequence(
|
|
262
|
+
_index2 = _step3$value.index,
|
|
263
|
+
_sequenceId = _step3$value.sequenceId;
|
|
264
|
+
this.resumeActivationSequence(_index2, _sequenceId);
|
|
235
265
|
}
|
|
236
266
|
} catch (err) {
|
|
237
267
|
_iterator3.e(err);
|
|
@@ -243,15 +273,41 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
243
273
|
try {
|
|
244
274
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
245
275
|
var _step4$value = _step4.value,
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
this.resumeImperativeExecution(
|
|
276
|
+
_index3 = _step4$value.index,
|
|
277
|
+
_execution = _step4$value.execution;
|
|
278
|
+
this.resumeImperativeExecution(_index3, _execution);
|
|
249
279
|
}
|
|
250
280
|
} catch (err) {
|
|
251
281
|
_iterator4.e(err);
|
|
252
282
|
} finally {
|
|
253
283
|
_iterator4.f();
|
|
254
284
|
}
|
|
285
|
+
for (var index = 0; index < this.tmodel.childRuntimeStates.length; index++) {
|
|
286
|
+
var state = this.tmodel.childRuntimeStates[index];
|
|
287
|
+
if (!state || state.done) {
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
for (var _i3 = 0, _Object$entries = Object.entries(state.loopTargets || {}); _i3 < _Object$entries.length; _i3++) {
|
|
291
|
+
var _state$executions2;
|
|
292
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i3], 2),
|
|
293
|
+
key = _Object$entries$_i[0],
|
|
294
|
+
active = _Object$entries$_i[1];
|
|
295
|
+
if (!active) {
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
var targetIndex = Number(key);
|
|
299
|
+
var sequenceId = "loop:".concat(targetIndex);
|
|
300
|
+
var execution = (_state$executions2 = state.executions) === null || _state$executions2 === void 0 ? void 0 : _state$executions2[this.getExecutionId(sequenceId, targetIndex)];
|
|
301
|
+
if (execution !== null && execution !== void 0 && execution.segmentReady && execution.interval > 0) {
|
|
302
|
+
execution.segmentStartTime = TUtil.now() - execution.step * execution.interval;
|
|
303
|
+
execution.pausedAt = undefined;
|
|
304
|
+
}
|
|
305
|
+
this.queueLoop(index, targetIndex);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if (this.tmodel.pendingImperativeCompletions.size) {
|
|
309
|
+
this.queueImperativeCompletion();
|
|
310
|
+
}
|
|
255
311
|
}
|
|
256
312
|
}, {
|
|
257
313
|
key: "resumeActivationSequence",
|
|
@@ -276,8 +332,10 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
276
332
|
var activeTargets = (_this$activeTargets$i = (_this$activeTargets = this.activeTargets)[index]) !== null && _this$activeTargets$i !== void 0 ? _this$activeTargets$i : _this$activeTargets[index] = {};
|
|
277
333
|
var promise = Promise.all(executions.map(function (execution) {
|
|
278
334
|
return _this2.resumeExecution(index, execution);
|
|
279
|
-
})).then(function () {
|
|
280
|
-
|
|
335
|
+
})).then(function (results) {
|
|
336
|
+
if (results.every(Boolean)) {
|
|
337
|
+
return _this2.continueActivatedSequence(index, currentTargetIndex + 1, sequenceId);
|
|
338
|
+
}
|
|
281
339
|
}).catch(function (error) {
|
|
282
340
|
console.error(error);
|
|
283
341
|
}).finally(function () {
|
|
@@ -289,7 +347,8 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
289
347
|
}, {
|
|
290
348
|
key: "resumeImperativeExecution",
|
|
291
349
|
value: function resumeImperativeExecution(index, execution) {
|
|
292
|
-
var
|
|
350
|
+
var _runtimeTarget$target,
|
|
351
|
+
_this3 = this;
|
|
293
352
|
var child = this.tmodel.childHandles[index];
|
|
294
353
|
var state = this.tmodel.childRuntimeStates[index];
|
|
295
354
|
var runtimeTarget = execution === null || execution === void 0 ? void 0 : execution.imperativeTarget;
|
|
@@ -314,23 +373,24 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
314
373
|
value: runtimeTarget.target.value,
|
|
315
374
|
steps: runtimeTarget.target.steps || 0,
|
|
316
375
|
interval: runtimeTarget.target.interval || 0,
|
|
317
|
-
easing: runtimeTarget.target.easing
|
|
376
|
+
easing: runtimeTarget.target.easing,
|
|
377
|
+
cycles: (_runtimeTarget$target = runtimeTarget.target.cycles) !== null && _runtimeTarget$target !== void 0 ? _runtimeTarget$target : 1
|
|
318
378
|
};
|
|
319
379
|
child.targetValues[imperativeKey] = targetValue;
|
|
320
380
|
child.addToUpdatingTargets(imperativeKey);
|
|
321
|
-
var promise =
|
|
381
|
+
var promise = this.runTarget(index, runtimeTarget, execution.targetIndex, execution.sequenceId, targetValue);
|
|
322
382
|
Promise.resolve(promise).catch(function (error) {
|
|
323
383
|
console.error(error);
|
|
324
|
-
|
|
384
|
+
return false;
|
|
385
|
+
}).then(function (completed) {
|
|
325
386
|
if (_this3.disposed || child.targetValues[imperativeKey] !== targetValue) {
|
|
326
387
|
return;
|
|
327
388
|
}
|
|
328
|
-
targetValue.status = "done";
|
|
389
|
+
targetValue.status = completed ? "done" : "cancelled";
|
|
329
390
|
child.removeFromUpdatingTargets(imperativeKey);
|
|
330
|
-
if (
|
|
331
|
-
|
|
391
|
+
if (completed) {
|
|
392
|
+
_this3.queueImperativeCompletion(runtimeTarget.originalTargetIsParent ? _this3.tmodel : undefined, runtimeTarget.originalTargetName);
|
|
332
393
|
}
|
|
333
|
-
getRunScheduler().schedule(1, "gpuImperativeComplete-".concat(child.oid, "-").concat(imperativeKey));
|
|
334
394
|
});
|
|
335
395
|
return true;
|
|
336
396
|
}
|
|
@@ -338,7 +398,7 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
338
398
|
key: "continueActivatedSequence",
|
|
339
399
|
value: function () {
|
|
340
400
|
var _continueActivatedSequence = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(index, nextTargetIndex, sequenceId) {
|
|
341
|
-
var program, runtimeTarget;
|
|
401
|
+
var program, runtimeTarget, completed;
|
|
342
402
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
343
403
|
while (1) switch (_context.prev = _context.next) {
|
|
344
404
|
case 0:
|
|
@@ -356,7 +416,7 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
356
416
|
return _context.abrupt("return");
|
|
357
417
|
case 5:
|
|
358
418
|
if (!(!this.disposed && nextTargetIndex < program.length)) {
|
|
359
|
-
_context.next =
|
|
419
|
+
_context.next = 17;
|
|
360
420
|
break;
|
|
361
421
|
}
|
|
362
422
|
runtimeTarget = program[nextTargetIndex];
|
|
@@ -364,15 +424,22 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
364
424
|
_context.next = 9;
|
|
365
425
|
break;
|
|
366
426
|
}
|
|
367
|
-
return _context.abrupt("break",
|
|
427
|
+
return _context.abrupt("break", 17);
|
|
368
428
|
case 9:
|
|
369
429
|
_context.next = 11;
|
|
370
430
|
return this.runTarget(index, runtimeTarget, nextTargetIndex, sequenceId);
|
|
371
431
|
case 11:
|
|
432
|
+
completed = _context.sent;
|
|
433
|
+
if (completed) {
|
|
434
|
+
_context.next = 14;
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
return _context.abrupt("return");
|
|
438
|
+
case 14:
|
|
372
439
|
nextTargetIndex++;
|
|
373
440
|
_context.next = 5;
|
|
374
441
|
break;
|
|
375
|
-
case
|
|
442
|
+
case 17:
|
|
376
443
|
case "end":
|
|
377
444
|
return _context.stop();
|
|
378
445
|
}
|
|
@@ -402,7 +469,7 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
402
469
|
}).catch(function (error) {
|
|
403
470
|
console.error(error);
|
|
404
471
|
}).finally(function () {
|
|
405
|
-
_this4.
|
|
472
|
+
_this4.finishMainProgram(index, state);
|
|
406
473
|
});
|
|
407
474
|
}
|
|
408
475
|
}, {
|
|
@@ -413,21 +480,11 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
413
480
|
if (!runtimeTarget) {
|
|
414
481
|
return Promise.resolve();
|
|
415
482
|
}
|
|
416
|
-
|
|
417
|
-
return this.runIntervalTarget(index, runtimeTarget, execution.targetIndex, execution.sequenceId);
|
|
418
|
-
}
|
|
419
|
-
if (execution.kind === "render") {
|
|
420
|
-
return this.runRenderTarget(index, runtimeTarget, execution.targetIndex, execution.sequenceId);
|
|
421
|
-
}
|
|
422
|
-
if (execution.kind === "runtime") {
|
|
423
|
-
return this.runRuntimeTarget(index, runtimeTarget, execution.targetIndex, execution.sequenceId);
|
|
424
|
-
}
|
|
425
|
-
return Promise.resolve();
|
|
483
|
+
return this.runTarget(index, runtimeTarget, execution.targetIndex, execution.sequenceId);
|
|
426
484
|
}
|
|
427
485
|
}, {
|
|
428
486
|
key: "complete",
|
|
429
487
|
value: function complete(index) {
|
|
430
|
-
var _tmodel$pendingTarget;
|
|
431
488
|
if (this.disposed) {
|
|
432
489
|
return;
|
|
433
490
|
}
|
|
@@ -438,24 +495,27 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
438
495
|
}
|
|
439
496
|
state.done = true;
|
|
440
497
|
state.started = false;
|
|
441
|
-
var
|
|
442
|
-
var count = Math.max(0, (tmodel.pendingGpuChildRuntimeCounts[
|
|
498
|
+
var originalTargetName = state.originalTargetName;
|
|
499
|
+
var count = Math.max(0, (tmodel.pendingGpuChildRuntimeCounts[originalTargetName] || 0) - 1);
|
|
443
500
|
if (count > 0) {
|
|
444
|
-
tmodel.pendingGpuChildRuntimeCounts[
|
|
501
|
+
tmodel.pendingGpuChildRuntimeCounts[originalTargetName] = count;
|
|
445
502
|
} else {
|
|
446
|
-
delete tmodel.pendingGpuChildRuntimeCounts[
|
|
503
|
+
delete tmodel.pendingGpuChildRuntimeCounts[originalTargetName];
|
|
447
504
|
getRunScheduler().schedule(1, "gpuChildRuntimeComplete-".concat(tmodel.oid));
|
|
448
505
|
}
|
|
449
|
-
TargetUtil.cleanupVisibleComplete(tmodel,
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
506
|
+
TargetUtil.cleanupVisibleComplete(tmodel, originalTargetName);
|
|
507
|
+
this.completeOriginalTarget(originalTargetName);
|
|
508
|
+
}
|
|
509
|
+
}, {
|
|
510
|
+
key: "completeOriginalTarget",
|
|
511
|
+
value: function completeOriginalTarget(originalTargetName) {
|
|
512
|
+
var tmodel = this.tmodel;
|
|
513
|
+
if (!tmodel.isTargetDone(originalTargetName) || !tmodel.isTargetTreeComplete(originalTargetName)) {
|
|
514
|
+
return false;
|
|
458
515
|
}
|
|
516
|
+
TargetUtil.cleanupTarget(tmodel, originalTargetName);
|
|
517
|
+
TargetUtil.shouldActivateNextTarget(tmodel, originalTargetName);
|
|
518
|
+
return true;
|
|
459
519
|
}
|
|
460
520
|
}, {
|
|
461
521
|
key: "queueStart",
|
|
@@ -469,15 +529,18 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
469
529
|
}, {
|
|
470
530
|
key: "markRenderReady",
|
|
471
531
|
value: function markRenderReady(indexes) {
|
|
532
|
+
var originalTargetNames = new Set();
|
|
472
533
|
var _iterator5 = _createForOfIteratorHelper(indexes),
|
|
473
534
|
_step5;
|
|
474
535
|
try {
|
|
475
536
|
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
476
537
|
var index = _step5.value;
|
|
477
538
|
var state = this.tmodel.childRuntimeStates[index];
|
|
478
|
-
if (state) {
|
|
479
|
-
|
|
539
|
+
if (!state) {
|
|
540
|
+
continue;
|
|
480
541
|
}
|
|
542
|
+
state.renderReady = true;
|
|
543
|
+
originalTargetNames.add(state.originalTargetName);
|
|
481
544
|
}
|
|
482
545
|
} catch (err) {
|
|
483
546
|
_iterator5.e(err);
|
|
@@ -485,25 +548,34 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
485
548
|
_iterator5.f();
|
|
486
549
|
}
|
|
487
550
|
this.startReady();
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
key: "markPendingRenderReady",
|
|
491
|
-
value: function markPendingRenderReady() {
|
|
492
|
-
var _iterator6 = _createForOfIteratorHelper(this.tmodel.childRuntimeStates),
|
|
551
|
+
var tmodel = this.tmodel;
|
|
552
|
+
var _iterator6 = _createForOfIteratorHelper(originalTargetNames),
|
|
493
553
|
_step6;
|
|
494
554
|
try {
|
|
495
555
|
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
496
|
-
var
|
|
497
|
-
|
|
498
|
-
state.renderReady = true;
|
|
499
|
-
}
|
|
556
|
+
var originalTargetName = _step6.value;
|
|
557
|
+
this.completeOriginalTarget(originalTargetName);
|
|
500
558
|
}
|
|
501
559
|
} catch (err) {
|
|
502
560
|
_iterator6.e(err);
|
|
503
561
|
} finally {
|
|
504
562
|
_iterator6.f();
|
|
505
563
|
}
|
|
506
|
-
|
|
564
|
+
if (originalTargetNames.size > 0) {
|
|
565
|
+
getRunScheduler().schedule(1, "gpuChildrenRenderReady-".concat(tmodel.oid));
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}, {
|
|
569
|
+
key: "markPendingRenderReady",
|
|
570
|
+
value: function markPendingRenderReady() {
|
|
571
|
+
var indexes = [];
|
|
572
|
+
for (var i = 0; i < this.tmodel.childRuntimeStates.length; i++) {
|
|
573
|
+
var state = this.tmodel.childRuntimeStates[i];
|
|
574
|
+
if (state && !state.renderReady) {
|
|
575
|
+
indexes.push(i);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
this.markRenderReady(indexes);
|
|
507
579
|
}
|
|
508
580
|
}, {
|
|
509
581
|
key: "startReady",
|
|
@@ -512,7 +584,7 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
512
584
|
return;
|
|
513
585
|
}
|
|
514
586
|
var tmodel = this.tmodel;
|
|
515
|
-
if (!tmodel.hasDom() || tmodel.completeLayoutEpoch !== tmodel.layoutEpoch) {
|
|
587
|
+
if (!tmodel.isVisible() || !tmodel.hasDom() || tmodel.completeLayoutEpoch !== tmodel.layoutEpoch) {
|
|
516
588
|
return false;
|
|
517
589
|
}
|
|
518
590
|
var queued = false;
|
|
@@ -571,7 +643,7 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
571
643
|
Promise.resolve(this.runProgram(index)).catch(function (error) {
|
|
572
644
|
console.error(error);
|
|
573
645
|
}).finally(function () {
|
|
574
|
-
_this5.
|
|
646
|
+
_this5.finishMainProgram(index, state);
|
|
575
647
|
});
|
|
576
648
|
}
|
|
577
649
|
}, {
|
|
@@ -639,68 +711,346 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
639
711
|
key: "runTarget",
|
|
640
712
|
value: function () {
|
|
641
713
|
var _runTarget = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(index, runtimeTarget, targetIndex) {
|
|
714
|
+
var _state$targetCycles2,
|
|
715
|
+
_this6 = this;
|
|
642
716
|
var sequenceId,
|
|
717
|
+
owner,
|
|
718
|
+
state,
|
|
643
719
|
child,
|
|
720
|
+
targetName,
|
|
721
|
+
automaticLoop,
|
|
722
|
+
owners,
|
|
723
|
+
ownership,
|
|
724
|
+
cycleKey,
|
|
725
|
+
isCancelled,
|
|
726
|
+
completedCycles,
|
|
727
|
+
cycles,
|
|
644
728
|
_args3 = arguments;
|
|
645
729
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
646
730
|
while (1) switch (_context3.prev = _context3.next) {
|
|
647
731
|
case 0:
|
|
648
732
|
sequenceId = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : "main";
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
}
|
|
653
|
-
return _context3.abrupt("return");
|
|
654
|
-
case 3:
|
|
655
|
-
if (!(runtimeTarget.requiresRuntime === false)) {
|
|
656
|
-
_context3.next = 5;
|
|
733
|
+
owner = _args3.length > 4 ? _args3[4] : undefined;
|
|
734
|
+
if (!(this.disposed || runtimeTarget.requiresRuntime === false)) {
|
|
735
|
+
_context3.next = 4;
|
|
657
736
|
break;
|
|
658
737
|
}
|
|
659
|
-
return _context3.abrupt("return");
|
|
660
|
-
case
|
|
738
|
+
return _context3.abrupt("return", false);
|
|
739
|
+
case 4:
|
|
740
|
+
state = this.tmodel.childRuntimeStates[index];
|
|
661
741
|
child = this.tmodel.childHandles[index];
|
|
662
|
-
if (child) {
|
|
742
|
+
if (!(!state || !child || state.cancelled)) {
|
|
663
743
|
_context3.next = 8;
|
|
664
744
|
break;
|
|
665
745
|
}
|
|
666
|
-
return _context3.abrupt("return");
|
|
746
|
+
return _context3.abrupt("return", false);
|
|
667
747
|
case 8:
|
|
748
|
+
targetName = ParticleUtil.getTargetName(runtimeTarget.targetName);
|
|
749
|
+
automaticLoop = sequenceId.startsWith("loop:");
|
|
750
|
+
if (!(automaticLoop && this.isTargetUpdating(index, targetName, sequenceId, targetIndex))) {
|
|
751
|
+
_context3.next = 13;
|
|
752
|
+
break;
|
|
753
|
+
}
|
|
754
|
+
this.blockLoop(index, targetIndex);
|
|
755
|
+
return _context3.abrupt("return", false);
|
|
756
|
+
case 13:
|
|
757
|
+
// Any newly activated target replaces the previous property owner.
|
|
758
|
+
this.cancelPropertyExecutions(index, targetName, sequenceId, targetIndex);
|
|
759
|
+
owners = this.propertyOwners.get(state);
|
|
760
|
+
if (!owners) {
|
|
761
|
+
owners = new Map();
|
|
762
|
+
this.propertyOwners.set(state, owners);
|
|
763
|
+
}
|
|
764
|
+
ownership = {
|
|
765
|
+
sequenceId: sequenceId,
|
|
766
|
+
targetIndex: targetIndex
|
|
767
|
+
};
|
|
768
|
+
owners.set(targetName, ownership);
|
|
769
|
+
cycleKey = this.getExecutionId(sequenceId, targetIndex);
|
|
770
|
+
(_state$targetCycles2 = state.targetCycles) !== null && _state$targetCycles2 !== void 0 ? _state$targetCycles2 : state.targetCycles = {};
|
|
771
|
+
isCancelled = function isCancelled() {
|
|
772
|
+
return _this6.disposed || state.cancelled || _this6.tmodel.childHandles[index] !== child || owners.get(targetName) !== ownership || owner && child.targetValues[runtimeTarget.imperativeKey] !== owner;
|
|
773
|
+
};
|
|
774
|
+
_context3.prev = 21;
|
|
775
|
+
case 22:
|
|
776
|
+
if (isCancelled()) {
|
|
777
|
+
_context3.next = 44;
|
|
778
|
+
break;
|
|
779
|
+
}
|
|
668
780
|
if (!this.isIntervalTarget(runtimeTarget)) {
|
|
669
|
-
_context3.next =
|
|
781
|
+
_context3.next = 28;
|
|
670
782
|
break;
|
|
671
783
|
}
|
|
672
|
-
_context3.next =
|
|
673
|
-
return this.runIntervalTarget(index, runtimeTarget, targetIndex, sequenceId);
|
|
674
|
-
case
|
|
675
|
-
|
|
676
|
-
|
|
784
|
+
_context3.next = 26;
|
|
785
|
+
return this.runIntervalTarget(index, runtimeTarget, targetIndex, sequenceId, isCancelled);
|
|
786
|
+
case 26:
|
|
787
|
+
_context3.next = 35;
|
|
788
|
+
break;
|
|
789
|
+
case 28:
|
|
677
790
|
if (!runtimeTarget.renderable) {
|
|
678
|
-
_context3.next =
|
|
791
|
+
_context3.next = 33;
|
|
679
792
|
break;
|
|
680
793
|
}
|
|
681
|
-
_context3.next =
|
|
682
|
-
return this.runRenderTarget(index, runtimeTarget, targetIndex, sequenceId);
|
|
683
|
-
case
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
794
|
+
_context3.next = 31;
|
|
795
|
+
return this.runRenderTarget(index, runtimeTarget, targetIndex, sequenceId, isCancelled);
|
|
796
|
+
case 31:
|
|
797
|
+
_context3.next = 35;
|
|
798
|
+
break;
|
|
799
|
+
case 33:
|
|
800
|
+
_context3.next = 35;
|
|
801
|
+
return this.runRuntimeTarget(index, runtimeTarget, targetIndex, sequenceId, isCancelled);
|
|
802
|
+
case 35:
|
|
803
|
+
if (!isCancelled()) {
|
|
804
|
+
_context3.next = 37;
|
|
805
|
+
break;
|
|
806
|
+
}
|
|
807
|
+
return _context3.abrupt("return", false);
|
|
808
|
+
case 37:
|
|
809
|
+
completedCycles = (state.targetCycles[cycleKey] || 0) + 1;
|
|
810
|
+
cycles = this.getTargetCycles(runtimeTarget, child, completedCycles - 1);
|
|
811
|
+
if (!(completedCycles >= cycles)) {
|
|
812
|
+
_context3.next = 41;
|
|
813
|
+
break;
|
|
814
|
+
}
|
|
815
|
+
return _context3.abrupt("break", 44);
|
|
816
|
+
case 41:
|
|
817
|
+
state.targetCycles[cycleKey] = completedCycles;
|
|
818
|
+
_context3.next = 22;
|
|
819
|
+
break;
|
|
820
|
+
case 44:
|
|
821
|
+
if (!isCancelled()) {
|
|
822
|
+
_context3.next = 46;
|
|
823
|
+
break;
|
|
824
|
+
}
|
|
825
|
+
return _context3.abrupt("return", false);
|
|
826
|
+
case 46:
|
|
827
|
+
if (!sequenceId.startsWith("imperative:") && this.isTargetInLoop(runtimeTarget, child)) {
|
|
828
|
+
this.queueLoop(index, targetIndex);
|
|
829
|
+
} else if (automaticLoop) {
|
|
830
|
+
delete state.loopTargets[targetIndex];
|
|
831
|
+
this.completeIfReady(index);
|
|
832
|
+
}
|
|
833
|
+
return _context3.abrupt("return", true);
|
|
834
|
+
case 48:
|
|
835
|
+
_context3.prev = 48;
|
|
836
|
+
if (owners.get(targetName) === ownership) {
|
|
837
|
+
owners.delete(targetName);
|
|
838
|
+
this.queueBlockedLoops(index, targetName);
|
|
839
|
+
}
|
|
840
|
+
delete state.targetCycles[cycleKey];
|
|
841
|
+
return _context3.finish(48);
|
|
842
|
+
case 52:
|
|
689
843
|
case "end":
|
|
690
844
|
return _context3.stop();
|
|
691
845
|
}
|
|
692
|
-
}, _callee3, this);
|
|
846
|
+
}, _callee3, this, [[21,, 48, 52]]);
|
|
693
847
|
}));
|
|
694
848
|
function runTarget(_x5, _x6, _x7) {
|
|
695
849
|
return _runTarget.apply(this, arguments);
|
|
696
850
|
}
|
|
697
851
|
return runTarget;
|
|
698
852
|
}()
|
|
853
|
+
}, {
|
|
854
|
+
key: "isTargetUpdating",
|
|
855
|
+
value: function isTargetUpdating(index, key, sequenceId, targetIndex) {
|
|
856
|
+
var _this$propertyOwners$;
|
|
857
|
+
var state = this.tmodel.childRuntimeStates[index];
|
|
858
|
+
var property = ParticleUtil.getTargetName(key);
|
|
859
|
+
var owner = (_this$propertyOwners$ = this.propertyOwners.get(state)) === null || _this$propertyOwners$ === void 0 ? void 0 : _this$propertyOwners$.get(property);
|
|
860
|
+
if (owner && !(owner.sequenceId === sequenceId && owner.targetIndex === targetIndex)) {
|
|
861
|
+
return true;
|
|
862
|
+
}
|
|
863
|
+
return Object.values((state === null || state === void 0 ? void 0 : state.executions) || {}).some(function (execution) {
|
|
864
|
+
return !execution.cancelled && execution.targetName === property && !(execution.sequenceId === sequenceId && execution.targetIndex === targetIndex);
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
}, {
|
|
868
|
+
key: "blockLoop",
|
|
869
|
+
value: function blockLoop(index, targetIndex) {
|
|
870
|
+
var _state$blockedLoops;
|
|
871
|
+
var state = this.tmodel.childRuntimeStates[index];
|
|
872
|
+
if (!state) {
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
((_state$blockedLoops = state.blockedLoops) !== null && _state$blockedLoops !== void 0 ? _state$blockedLoops : state.blockedLoops = {})[targetIndex] = true;
|
|
876
|
+
}
|
|
877
|
+
}, {
|
|
878
|
+
key: "queueBlockedLoops",
|
|
879
|
+
value: function queueBlockedLoops(index, key) {
|
|
880
|
+
var state = this.tmodel.childRuntimeStates[index];
|
|
881
|
+
var program = this.tmodel.childRuntimePrograms[index];
|
|
882
|
+
if (!state || !program || state.cancelled || this.disposed || this.isTargetUpdating(index, key)) {
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
var running = this.runningLoops.get(state);
|
|
886
|
+
for (var _i4 = 0, _Object$keys = Object.keys(state.blockedLoops || {}); _i4 < _Object$keys.length; _i4++) {
|
|
887
|
+
var _program$targetIndex, _state$loopTargets2;
|
|
888
|
+
var id = _Object$keys[_i4];
|
|
889
|
+
var targetIndex = Number(id);
|
|
890
|
+
if (((_program$targetIndex = program[targetIndex]) === null || _program$targetIndex === void 0 ? void 0 : _program$targetIndex.targetName) !== key || !((_state$loopTargets2 = state.loopTargets) !== null && _state$loopTargets2 !== void 0 && _state$loopTargets2[targetIndex]) || running !== null && running !== void 0 && running.has(targetIndex)) {
|
|
891
|
+
continue;
|
|
892
|
+
}
|
|
893
|
+
delete state.blockedLoops[id];
|
|
894
|
+
this.queueLoop(index, targetIndex);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}, {
|
|
898
|
+
key: "cancelPropertyExecutions",
|
|
899
|
+
value: function cancelPropertyExecutions(index, key, sequenceId, targetIndex) {
|
|
900
|
+
var _this7 = this;
|
|
901
|
+
var state = this.tmodel.childRuntimeStates[index];
|
|
902
|
+
var child = this.tmodel.childHandles[index];
|
|
903
|
+
var program = this.tmodel.childRuntimePrograms[index];
|
|
904
|
+
if (!state || !child) {
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
var property = ParticleUtil.getTargetName(key);
|
|
908
|
+
var owners = this.propertyOwners.get(state);
|
|
909
|
+
var previous = owners === null || owners === void 0 ? void 0 : owners.get(property);
|
|
910
|
+
var rememberLoop = function rememberLoop(previousSequence, previousIndex) {
|
|
911
|
+
if (previousSequence !== null && previousSequence !== void 0 && previousSequence.startsWith("imperative:")) {
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
var target = program === null || program === void 0 ? void 0 : program[previousIndex];
|
|
915
|
+
if ((target === null || target === void 0 ? void 0 : target.targetName) === property && _this7.isTargetInLoop(target, child)) {
|
|
916
|
+
var _state$loopTargets3;
|
|
917
|
+
(_state$loopTargets3 = state.loopTargets) !== null && _state$loopTargets3 !== void 0 ? _state$loopTargets3 : state.loopTargets = {};
|
|
918
|
+
state.loopTargets[previousIndex] = true;
|
|
919
|
+
_this7.blockLoop(index, previousIndex);
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
if (previous && !(previous.sequenceId === sequenceId && previous.targetIndex === targetIndex)) {
|
|
923
|
+
rememberLoop(previous.sequenceId, previous.targetIndex);
|
|
924
|
+
owners.delete(property);
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
// Preserve previously queued loops.
|
|
928
|
+
for (var _i5 = 0, _Object$entries2 = Object.entries(state.loopTargets || {}); _i5 < _Object$entries2.length; _i5++) {
|
|
929
|
+
var _program$Number;
|
|
930
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i5], 2),
|
|
931
|
+
id = _Object$entries2$_i[0],
|
|
932
|
+
pending = _Object$entries2$_i[1];
|
|
933
|
+
if (pending && (program === null || program === void 0 || (_program$Number = program[Number(id)]) === null || _program$Number === void 0 ? void 0 : _program$Number.targetName) === property) {
|
|
934
|
+
this.blockLoop(index, Number(id));
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
// Cancel every previous execution of the same property.
|
|
939
|
+
for (var _i6 = 0, _Object$entries3 = Object.entries(state.executions || {}); _i6 < _Object$entries3.length; _i6++) {
|
|
940
|
+
var _execution$cancelWait;
|
|
941
|
+
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i6], 2),
|
|
942
|
+
_id = _Object$entries3$_i[0],
|
|
943
|
+
execution = _Object$entries3$_i[1];
|
|
944
|
+
if (execution.cancelled || execution.targetName !== property || execution.sequenceId === sequenceId && execution.targetIndex === targetIndex) {
|
|
945
|
+
continue;
|
|
946
|
+
}
|
|
947
|
+
rememberLoop(execution.sequenceId, execution.targetIndex);
|
|
948
|
+
execution.cancelled = true;
|
|
949
|
+
(_execution$cancelWait = execution.cancelWait) === null || _execution$cancelWait === void 0 || _execution$cancelWait.call(execution);
|
|
950
|
+
execution.cancelWait = undefined;
|
|
951
|
+
this.activeRenderExecutions.delete(execution);
|
|
952
|
+
delete state.executions[_id];
|
|
953
|
+
var resolve = execution.resolve;
|
|
954
|
+
execution.resolve = undefined;
|
|
955
|
+
resolve === null || resolve === void 0 || resolve();
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
}, {
|
|
959
|
+
key: "queueLoop",
|
|
960
|
+
value: function queueLoop(index, targetIndex) {
|
|
961
|
+
var _state$loopTargets4, _this$tmodel$childRun;
|
|
962
|
+
var state = this.tmodel.childRuntimeStates[index];
|
|
963
|
+
if (this.disposed || !state || state.cancelled) {
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
(_state$loopTargets4 = state.loopTargets) !== null && _state$loopTargets4 !== void 0 ? _state$loopTargets4 : state.loopTargets = {};
|
|
967
|
+
state.loopTargets[targetIndex] = true;
|
|
968
|
+
var targetName = (_this$tmodel$childRun = this.tmodel.childRuntimePrograms[index]) === null || _this$tmodel$childRun === void 0 || (_this$tmodel$childRun = _this$tmodel$childRun[targetIndex]) === null || _this$tmodel$childRun === void 0 ? void 0 : _this$tmodel$childRun.targetName;
|
|
969
|
+
if (targetName && this.isTargetUpdating(index, targetName)) {
|
|
970
|
+
this.blockLoop(index, targetIndex);
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
973
|
+
var queued = this.queuedLoops.get(state);
|
|
974
|
+
if (!queued) {
|
|
975
|
+
queued = new Set();
|
|
976
|
+
this.queuedLoops.set(state, queued);
|
|
977
|
+
}
|
|
978
|
+
if (queued.has(targetIndex)) {
|
|
979
|
+
return;
|
|
980
|
+
}
|
|
981
|
+
queued.add(targetIndex);
|
|
982
|
+
this.loopQueue.push({
|
|
983
|
+
state: state,
|
|
984
|
+
targetIndex: targetIndex
|
|
985
|
+
});
|
|
986
|
+
this.requestAnimationFrame();
|
|
987
|
+
}
|
|
988
|
+
}, {
|
|
989
|
+
key: "startQueuedLoops",
|
|
990
|
+
value: function startQueuedLoops() {
|
|
991
|
+
var _this8 = this;
|
|
992
|
+
var queue = this.loopQueue.splice(0);
|
|
993
|
+
var _iterator7 = _createForOfIteratorHelper(queue),
|
|
994
|
+
_step7;
|
|
995
|
+
try {
|
|
996
|
+
var _loop = function _loop() {
|
|
997
|
+
var _this8$queuedLoops$ge, _state$loopTargets5, _this8$tmodel$childRu;
|
|
998
|
+
var _step7$value = _step7.value,
|
|
999
|
+
state = _step7$value.state,
|
|
1000
|
+
targetIndex = _step7$value.targetIndex;
|
|
1001
|
+
(_this8$queuedLoops$ge = _this8.queuedLoops.get(state)) === null || _this8$queuedLoops$ge === void 0 || _this8$queuedLoops$ge.delete(targetIndex);
|
|
1002
|
+
var index = _this8.tmodel.childRuntimeStates.indexOf(state);
|
|
1003
|
+
if (_this8.disposed || index < 0 || state.cancelled || !((_state$loopTargets5 = state.loopTargets) !== null && _state$loopTargets5 !== void 0 && _state$loopTargets5[targetIndex])) {
|
|
1004
|
+
return 0; // continue
|
|
1005
|
+
}
|
|
1006
|
+
var runtimeTarget = (_this8$tmodel$childRu = _this8.tmodel.childRuntimePrograms[index]) === null || _this8$tmodel$childRu === void 0 ? void 0 : _this8$tmodel$childRu[targetIndex];
|
|
1007
|
+
if (!runtimeTarget) {
|
|
1008
|
+
delete state.loopTargets[targetIndex];
|
|
1009
|
+
_this8.completeIfReady(index);
|
|
1010
|
+
return 0; // continue
|
|
1011
|
+
}
|
|
1012
|
+
var running = _this8.runningLoops.get(state);
|
|
1013
|
+
if (!running) {
|
|
1014
|
+
running = new Set();
|
|
1015
|
+
_this8.runningLoops.set(state, running);
|
|
1016
|
+
}
|
|
1017
|
+
if (running.has(targetIndex) || _this8.isTargetUpdating(index, runtimeTarget.targetName)) {
|
|
1018
|
+
_this8.blockLoop(index, targetIndex);
|
|
1019
|
+
return 0; // continue
|
|
1020
|
+
}
|
|
1021
|
+
running.add(targetIndex);
|
|
1022
|
+
_this8.runTarget(index, runtimeTarget, targetIndex, "loop:".concat(targetIndex)).catch(function (error) {
|
|
1023
|
+
console.error(error);
|
|
1024
|
+
delete state.loopTargets[targetIndex];
|
|
1025
|
+
var currentIndex = _this8.tmodel.childRuntimeStates.indexOf(state);
|
|
1026
|
+
if (currentIndex >= 0) {
|
|
1027
|
+
_this8.completeIfReady(currentIndex);
|
|
1028
|
+
}
|
|
1029
|
+
}).finally(function () {
|
|
1030
|
+
running.delete(targetIndex);
|
|
1031
|
+
var currentIndex = _this8.tmodel.childRuntimeStates.indexOf(state);
|
|
1032
|
+
if (currentIndex >= 0) {
|
|
1033
|
+
_this8.queueBlockedLoops(currentIndex, runtimeTarget.targetName);
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
},
|
|
1037
|
+
_ret;
|
|
1038
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
1039
|
+
_ret = _loop();
|
|
1040
|
+
if (_ret === 0) continue;
|
|
1041
|
+
}
|
|
1042
|
+
} catch (err) {
|
|
1043
|
+
_iterator7.e(err);
|
|
1044
|
+
} finally {
|
|
1045
|
+
_iterator7.f();
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
699
1048
|
}, {
|
|
700
1049
|
key: "runRuntimeTarget",
|
|
701
1050
|
value: function () {
|
|
702
1051
|
var _runRuntimeTarget = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(index, runtimeTarget, targetIndex) {
|
|
703
1052
|
var sequenceId,
|
|
1053
|
+
isCancelled,
|
|
704
1054
|
child,
|
|
705
1055
|
target,
|
|
706
1056
|
targetName,
|
|
@@ -715,53 +1065,60 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
715
1065
|
while (1) switch (_context4.prev = _context4.next) {
|
|
716
1066
|
case 0:
|
|
717
1067
|
sequenceId = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : "main";
|
|
1068
|
+
isCancelled = _args4.length > 4 ? _args4[4] : undefined;
|
|
1069
|
+
if (!isCancelled()) {
|
|
1070
|
+
_context4.next = 4;
|
|
1071
|
+
break;
|
|
1072
|
+
}
|
|
1073
|
+
return _context4.abrupt("return");
|
|
1074
|
+
case 4:
|
|
718
1075
|
child = this.tmodel.childHandles[index];
|
|
719
1076
|
target = runtimeTarget.target;
|
|
720
1077
|
targetName = runtimeTarget.targetName;
|
|
721
1078
|
execution = this.getExecution(index, sequenceId, targetIndex);
|
|
722
1079
|
if (execution) {
|
|
723
|
-
_context4.next =
|
|
1080
|
+
_context4.next = 28;
|
|
724
1081
|
break;
|
|
725
1082
|
}
|
|
726
1083
|
value = target.value;
|
|
727
1084
|
if (!(typeof value === "function")) {
|
|
728
|
-
_context4.next =
|
|
1085
|
+
_context4.next = 18;
|
|
729
1086
|
break;
|
|
730
1087
|
}
|
|
731
1088
|
value = value.call(child);
|
|
732
1089
|
if (!((_value = value) !== null && _value !== void 0 && _value.then)) {
|
|
733
|
-
_context4.next =
|
|
1090
|
+
_context4.next = 16;
|
|
734
1091
|
break;
|
|
735
1092
|
}
|
|
736
|
-
_context4.next =
|
|
1093
|
+
_context4.next = 15;
|
|
737
1094
|
return value;
|
|
738
|
-
case
|
|
1095
|
+
case 15:
|
|
739
1096
|
value = _context4.sent;
|
|
740
|
-
case
|
|
741
|
-
if (!
|
|
742
|
-
_context4.next =
|
|
1097
|
+
case 16:
|
|
1098
|
+
if (!isCancelled()) {
|
|
1099
|
+
_context4.next = 18;
|
|
743
1100
|
break;
|
|
744
1101
|
}
|
|
745
1102
|
return _context4.abrupt("return");
|
|
746
|
-
case
|
|
747
|
-
if (TUtil.isDefined(value)) {
|
|
748
|
-
_context4.next =
|
|
1103
|
+
case 18:
|
|
1104
|
+
if (!(isCancelled() || !TUtil.isDefined(value))) {
|
|
1105
|
+
_context4.next = 20;
|
|
749
1106
|
break;
|
|
750
1107
|
}
|
|
751
1108
|
return _context4.abrupt("return");
|
|
752
|
-
case
|
|
1109
|
+
case 20:
|
|
753
1110
|
isValueList = Array.isArray(value);
|
|
754
1111
|
currentValue = child.actualValues[targetName];
|
|
755
1112
|
values = isValueList ? value : [TUtil.isDefined(currentValue) ? currentValue : value, value];
|
|
756
1113
|
if (!(values.length < 2)) {
|
|
757
|
-
_context4.next =
|
|
1114
|
+
_context4.next = 26;
|
|
758
1115
|
break;
|
|
759
1116
|
}
|
|
760
1117
|
if (values.length) {
|
|
761
1118
|
child.actualValues[targetName] = values[0];
|
|
762
1119
|
}
|
|
763
1120
|
return _context4.abrupt("return");
|
|
764
|
-
case
|
|
1121
|
+
case 26:
|
|
765
1122
|
execution = {
|
|
766
1123
|
sequenceId: sequenceId,
|
|
767
1124
|
targetIndex: targetIndex,
|
|
@@ -787,34 +1144,46 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
787
1144
|
} : undefined
|
|
788
1145
|
};
|
|
789
1146
|
this.setExecution(index, sequenceId, targetIndex, execution);
|
|
790
|
-
case
|
|
1147
|
+
case 28:
|
|
791
1148
|
if (!(execution.segmentIndex < execution.values.length - 1)) {
|
|
792
|
-
_context4.next =
|
|
1149
|
+
_context4.next = 46;
|
|
1150
|
+
break;
|
|
1151
|
+
}
|
|
1152
|
+
if (!(execution.cancelled || isCancelled())) {
|
|
1153
|
+
_context4.next = 31;
|
|
793
1154
|
break;
|
|
794
1155
|
}
|
|
1156
|
+
return _context4.abrupt("return");
|
|
1157
|
+
case 31:
|
|
795
1158
|
if (!execution.segmentReady) {
|
|
796
1159
|
this.prepareRenderSegment(execution, runtimeTarget, child);
|
|
797
1160
|
}
|
|
798
|
-
|
|
1161
|
+
if (!(execution.cancelled || isCancelled())) {
|
|
1162
|
+
_context4.next = 34;
|
|
1163
|
+
break;
|
|
1164
|
+
}
|
|
1165
|
+
return _context4.abrupt("return");
|
|
1166
|
+
case 34:
|
|
1167
|
+
_context4.next = 36;
|
|
799
1168
|
return this.animateExecution(index, execution);
|
|
800
|
-
case
|
|
801
|
-
if (!execution.cancelled) {
|
|
802
|
-
_context4.next =
|
|
1169
|
+
case 36:
|
|
1170
|
+
if (!(execution.cancelled || isCancelled())) {
|
|
1171
|
+
_context4.next = 38;
|
|
803
1172
|
break;
|
|
804
1173
|
}
|
|
805
1174
|
return _context4.abrupt("return");
|
|
806
|
-
case
|
|
1175
|
+
case 38:
|
|
807
1176
|
execution.segmentIndex++;
|
|
808
1177
|
execution.segmentReady = false;
|
|
809
1178
|
execution.step = 0;
|
|
810
1179
|
execution.segmentStartTime = 0;
|
|
811
1180
|
execution.waiting = false;
|
|
812
1181
|
execution.startTime = 0;
|
|
813
|
-
_context4.next =
|
|
1182
|
+
_context4.next = 28;
|
|
814
1183
|
break;
|
|
815
|
-
case
|
|
1184
|
+
case 46:
|
|
816
1185
|
this.clearExecution(index, sequenceId, targetIndex);
|
|
817
|
-
case
|
|
1186
|
+
case 47:
|
|
818
1187
|
case "end":
|
|
819
1188
|
return _context4.stop();
|
|
820
1189
|
}
|
|
@@ -833,19 +1202,19 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
833
1202
|
}, {
|
|
834
1203
|
key: "getExecution",
|
|
835
1204
|
value: function getExecution(index, sequenceId, targetIndex) {
|
|
836
|
-
var _state$
|
|
1205
|
+
var _state$executions3;
|
|
837
1206
|
var state = this.tmodel.childRuntimeStates[index];
|
|
838
|
-
return state === null || state === void 0 || (_state$
|
|
1207
|
+
return state === null || state === void 0 || (_state$executions3 = state.executions) === null || _state$executions3 === void 0 ? void 0 : _state$executions3[this.getExecutionId(sequenceId, targetIndex)];
|
|
839
1208
|
}
|
|
840
1209
|
}, {
|
|
841
1210
|
key: "setExecution",
|
|
842
1211
|
value: function setExecution(index, sequenceId, targetIndex, execution) {
|
|
843
|
-
var _state$
|
|
1212
|
+
var _state$executions4;
|
|
844
1213
|
var state = this.tmodel.childRuntimeStates[index];
|
|
845
1214
|
if (!state) {
|
|
846
1215
|
return;
|
|
847
1216
|
}
|
|
848
|
-
(_state$
|
|
1217
|
+
(_state$executions4 = state.executions) !== null && _state$executions4 !== void 0 ? _state$executions4 : state.executions = {};
|
|
849
1218
|
state.executions[this.getExecutionId(sequenceId, targetIndex)] = execution;
|
|
850
1219
|
}
|
|
851
1220
|
}, {
|
|
@@ -860,7 +1229,7 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
860
1229
|
}, {
|
|
861
1230
|
key: "runIntervalTarget",
|
|
862
1231
|
value: function () {
|
|
863
|
-
var _runIntervalTarget = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(index, runtimeTarget, targetIndex, sequenceId) {
|
|
1232
|
+
var _runIntervalTarget = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(index, runtimeTarget, targetIndex, sequenceId, isCancelled) {
|
|
864
1233
|
var child, execution;
|
|
865
1234
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
866
1235
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -872,6 +1241,7 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
872
1241
|
sequenceId: sequenceId,
|
|
873
1242
|
targetIndex: targetIndex,
|
|
874
1243
|
kind: "interval",
|
|
1244
|
+
targetName: runtimeTarget.targetName,
|
|
875
1245
|
interval: Math.max(0, Number(this.resolveOption(runtimeTarget.target.interval, child)) || 0),
|
|
876
1246
|
waiting: false,
|
|
877
1247
|
startTime: 0
|
|
@@ -879,22 +1249,25 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
879
1249
|
this.setExecution(index, sequenceId, targetIndex, execution);
|
|
880
1250
|
}
|
|
881
1251
|
_context5.next = 5;
|
|
882
|
-
return this.waitForExecution(execution)
|
|
1252
|
+
return Promise.race([this.waitForExecution(execution), new Promise(function (resolve) {
|
|
1253
|
+
execution.cancelWait = resolve;
|
|
1254
|
+
})]);
|
|
883
1255
|
case 5:
|
|
884
|
-
|
|
885
|
-
|
|
1256
|
+
execution.cancelWait = undefined;
|
|
1257
|
+
if (!(isCancelled() || execution.cancelled)) {
|
|
1258
|
+
_context5.next = 8;
|
|
886
1259
|
break;
|
|
887
1260
|
}
|
|
888
1261
|
return _context5.abrupt("return");
|
|
889
|
-
case 7:
|
|
890
|
-
this.clearExecution(index, sequenceId, targetIndex);
|
|
891
1262
|
case 8:
|
|
1263
|
+
this.clearExecution(index, sequenceId, targetIndex);
|
|
1264
|
+
case 9:
|
|
892
1265
|
case "end":
|
|
893
1266
|
return _context5.stop();
|
|
894
1267
|
}
|
|
895
1268
|
}, _callee5, this);
|
|
896
1269
|
}));
|
|
897
|
-
function runIntervalTarget(_x11, _x12, _x13, _x14) {
|
|
1270
|
+
function runIntervalTarget(_x11, _x12, _x13, _x14, _x15) {
|
|
898
1271
|
return _runIntervalTarget.apply(this, arguments);
|
|
899
1272
|
}
|
|
900
1273
|
return runIntervalTarget;
|
|
@@ -929,7 +1302,7 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
929
1302
|
}
|
|
930
1303
|
}, _callee6, this);
|
|
931
1304
|
}));
|
|
932
|
-
function waitForExecution(
|
|
1305
|
+
function waitForExecution(_x16) {
|
|
933
1306
|
return _waitForExecution.apply(this, arguments);
|
|
934
1307
|
}
|
|
935
1308
|
return waitForExecution;
|
|
@@ -942,20 +1315,20 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
942
1315
|
var flowLayoutChanged = false;
|
|
943
1316
|
for (var index = 0; index < tmodel.childRuntimePrograms.length; index++) {
|
|
944
1317
|
var program = tmodel.childRuntimePrograms[index];
|
|
945
|
-
var
|
|
946
|
-
if (!program || !
|
|
1318
|
+
var _child = tmodel.childHandles[index];
|
|
1319
|
+
if (!program || !_child) {
|
|
947
1320
|
continue;
|
|
948
1321
|
}
|
|
949
|
-
var
|
|
950
|
-
|
|
1322
|
+
var _iterator8 = _createForOfIteratorHelper(program),
|
|
1323
|
+
_step8;
|
|
951
1324
|
try {
|
|
952
|
-
for (
|
|
953
|
-
var runtimeTarget =
|
|
1325
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
1326
|
+
var runtimeTarget = _step8.value;
|
|
954
1327
|
var isLayoutTarget = runtimeTarget.requiresRuntime === false && ParticleUtil.affectsChildLayout(runtimeTarget.targetName);
|
|
955
1328
|
if (!isLayoutTarget && !runtimeTarget.requiresInitialResolution) {
|
|
956
1329
|
continue;
|
|
957
1330
|
}
|
|
958
|
-
var resolved = ParticleUtil.resolveValue(runtimeTarget.target,
|
|
1331
|
+
var resolved = ParticleUtil.resolveValue(runtimeTarget.target, _child);
|
|
959
1332
|
var value = TargetParser.isTargetSpecObject(resolved) ? resolved.value : resolved;
|
|
960
1333
|
var initialValue = Array.isArray(value) ? value[0] : value;
|
|
961
1334
|
if (runtimeTarget.requiresInitialResolution) {
|
|
@@ -974,9 +1347,9 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
974
1347
|
changed = true;
|
|
975
1348
|
}
|
|
976
1349
|
} catch (err) {
|
|
977
|
-
|
|
1350
|
+
_iterator8.e(err);
|
|
978
1351
|
} finally {
|
|
979
|
-
|
|
1352
|
+
_iterator8.f();
|
|
980
1353
|
}
|
|
981
1354
|
}
|
|
982
1355
|
if (flowLayoutChanged) {
|
|
@@ -987,98 +1360,114 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
987
1360
|
}, {
|
|
988
1361
|
key: "runRenderTarget",
|
|
989
1362
|
value: function () {
|
|
990
|
-
var _runRenderTarget = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(index, runtimeTarget, targetIndex) {
|
|
991
|
-
var
|
|
992
|
-
tmodel,
|
|
993
|
-
child,
|
|
994
|
-
target,
|
|
995
|
-
targetName,
|
|
996
|
-
execution,
|
|
997
|
-
value,
|
|
998
|
-
isValueList,
|
|
999
|
-
values,
|
|
1000
|
-
_args7 = arguments;
|
|
1363
|
+
var _runRenderTarget = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(index, runtimeTarget, targetIndex, sequenceId, isCancelled) {
|
|
1364
|
+
var tmodel, child, target, targetName, execution, value, isValueList, values;
|
|
1001
1365
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
1002
1366
|
while (1) switch (_context7.prev = _context7.next) {
|
|
1003
1367
|
case 0:
|
|
1004
|
-
|
|
1368
|
+
if (!isCancelled()) {
|
|
1369
|
+
_context7.next = 2;
|
|
1370
|
+
break;
|
|
1371
|
+
}
|
|
1372
|
+
return _context7.abrupt("return");
|
|
1373
|
+
case 2:
|
|
1005
1374
|
tmodel = this.tmodel;
|
|
1006
1375
|
child = tmodel.childHandles[index];
|
|
1007
1376
|
target = runtimeTarget.target;
|
|
1008
1377
|
targetName = runtimeTarget.targetName;
|
|
1009
1378
|
execution = this.getExecution(index, sequenceId, targetIndex);
|
|
1010
|
-
if (
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1379
|
+
if (execution) {
|
|
1380
|
+
_context7.next = 15;
|
|
1381
|
+
break;
|
|
1382
|
+
}
|
|
1383
|
+
if (sequenceId === "main" && TUtil.hasProperty(runtimeTarget, "initialResolvedValue")) {
|
|
1384
|
+
value = runtimeTarget.initialResolvedValue;
|
|
1385
|
+
delete runtimeTarget.initialResolvedValue;
|
|
1386
|
+
} else {
|
|
1387
|
+
value = target.value;
|
|
1388
|
+
if (typeof value === "function") {
|
|
1389
|
+
value = value.call(child);
|
|
1019
1390
|
}
|
|
1020
|
-
isValueList = Array.isArray(value);
|
|
1021
|
-
values = isValueList ? value : [tmodel.getChildValue(index, targetName), value];
|
|
1022
|
-
execution = {
|
|
1023
|
-
sequenceId: sequenceId,
|
|
1024
|
-
targetIndex: targetIndex,
|
|
1025
|
-
kind: "render",
|
|
1026
|
-
targetName: targetName,
|
|
1027
|
-
imperativeKey: runtimeTarget.imperativeKey,
|
|
1028
|
-
values: values,
|
|
1029
|
-
isValueList: isValueList,
|
|
1030
|
-
pauseOn: target.pauseOn,
|
|
1031
|
-
segmentIndex: 0,
|
|
1032
|
-
segmentReady: false,
|
|
1033
|
-
step: 0,
|
|
1034
|
-
segmentStartTime: 0,
|
|
1035
|
-
waiting: false,
|
|
1036
|
-
startTime: 0,
|
|
1037
|
-
imperativeTarget: sequenceId.startsWith("imperative:") ? {
|
|
1038
|
-
targetName: runtimeTarget.targetName,
|
|
1039
|
-
imperativeKey: runtimeTarget.imperativeKey,
|
|
1040
|
-
renderable: runtimeTarget.renderable,
|
|
1041
|
-
originalTargetName: runtimeTarget.originalTargetName,
|
|
1042
|
-
originalTargetIsParent: runtimeTarget.originalTargetIsParent,
|
|
1043
|
-
target: _objectSpread({}, runtimeTarget.target)
|
|
1044
|
-
} : undefined
|
|
1045
|
-
};
|
|
1046
|
-
this.setExecution(index, sequenceId, targetIndex, execution);
|
|
1047
1391
|
}
|
|
1048
|
-
|
|
1392
|
+
isValueList = Array.isArray(value);
|
|
1393
|
+
if (!isCancelled()) {
|
|
1394
|
+
_context7.next = 12;
|
|
1395
|
+
break;
|
|
1396
|
+
}
|
|
1397
|
+
return _context7.abrupt("return");
|
|
1398
|
+
case 12:
|
|
1399
|
+
values = isValueList ? value : [tmodel.getChildValue(index, targetName), value];
|
|
1400
|
+
execution = {
|
|
1401
|
+
sequenceId: sequenceId,
|
|
1402
|
+
targetIndex: targetIndex,
|
|
1403
|
+
kind: "render",
|
|
1404
|
+
targetName: targetName,
|
|
1405
|
+
imperativeKey: runtimeTarget.imperativeKey,
|
|
1406
|
+
values: values,
|
|
1407
|
+
isValueList: isValueList,
|
|
1408
|
+
pauseOn: target.pauseOn,
|
|
1409
|
+
segmentIndex: 0,
|
|
1410
|
+
segmentReady: false,
|
|
1411
|
+
step: 0,
|
|
1412
|
+
segmentStartTime: 0,
|
|
1413
|
+
waiting: false,
|
|
1414
|
+
startTime: 0,
|
|
1415
|
+
imperativeTarget: sequenceId.startsWith("imperative:") ? {
|
|
1416
|
+
targetName: runtimeTarget.targetName,
|
|
1417
|
+
imperativeKey: runtimeTarget.imperativeKey,
|
|
1418
|
+
renderable: runtimeTarget.renderable,
|
|
1419
|
+
originalTargetName: runtimeTarget.originalTargetName,
|
|
1420
|
+
originalTargetIsParent: runtimeTarget.originalTargetIsParent,
|
|
1421
|
+
target: _objectSpread({}, runtimeTarget.target)
|
|
1422
|
+
} : undefined
|
|
1423
|
+
};
|
|
1424
|
+
this.setExecution(index, sequenceId, targetIndex, execution);
|
|
1425
|
+
case 15:
|
|
1049
1426
|
if (!(execution.segmentIndex < execution.values.length - 1)) {
|
|
1050
|
-
_context7.next =
|
|
1427
|
+
_context7.next = 33;
|
|
1051
1428
|
break;
|
|
1052
1429
|
}
|
|
1430
|
+
if (!(isCancelled() || execution.cancelled)) {
|
|
1431
|
+
_context7.next = 18;
|
|
1432
|
+
break;
|
|
1433
|
+
}
|
|
1434
|
+
return _context7.abrupt("return");
|
|
1435
|
+
case 18:
|
|
1053
1436
|
if (!execution.segmentReady) {
|
|
1054
1437
|
this.prepareRenderSegment(execution, runtimeTarget, child);
|
|
1055
1438
|
}
|
|
1056
|
-
|
|
1439
|
+
if (!(isCancelled() || execution.cancelled)) {
|
|
1440
|
+
_context7.next = 21;
|
|
1441
|
+
break;
|
|
1442
|
+
}
|
|
1443
|
+
return _context7.abrupt("return");
|
|
1444
|
+
case 21:
|
|
1445
|
+
_context7.next = 23;
|
|
1057
1446
|
return this.animateExecution(index, execution);
|
|
1058
|
-
case
|
|
1059
|
-
if (!execution.cancelled) {
|
|
1060
|
-
_context7.next =
|
|
1447
|
+
case 23:
|
|
1448
|
+
if (!(isCancelled() || execution.cancelled)) {
|
|
1449
|
+
_context7.next = 25;
|
|
1061
1450
|
break;
|
|
1062
1451
|
}
|
|
1063
1452
|
return _context7.abrupt("return");
|
|
1064
|
-
case
|
|
1453
|
+
case 25:
|
|
1065
1454
|
execution.segmentIndex++;
|
|
1066
1455
|
execution.segmentReady = false;
|
|
1067
1456
|
execution.step = 0;
|
|
1068
1457
|
execution.segmentStartTime = 0;
|
|
1069
1458
|
execution.waiting = false;
|
|
1070
1459
|
execution.startTime = 0;
|
|
1071
|
-
_context7.next =
|
|
1460
|
+
_context7.next = 15;
|
|
1072
1461
|
break;
|
|
1073
|
-
case
|
|
1462
|
+
case 33:
|
|
1074
1463
|
this.clearExecution(index, sequenceId, targetIndex);
|
|
1075
|
-
case
|
|
1464
|
+
case 34:
|
|
1076
1465
|
case "end":
|
|
1077
1466
|
return _context7.stop();
|
|
1078
1467
|
}
|
|
1079
1468
|
}, _callee7, this);
|
|
1080
1469
|
}));
|
|
1081
|
-
function runRenderTarget(
|
|
1470
|
+
function runRenderTarget(_x17, _x18, _x19, _x20, _x21) {
|
|
1082
1471
|
return _runRenderTarget.apply(this, arguments);
|
|
1083
1472
|
}
|
|
1084
1473
|
return runRenderTarget;
|
|
@@ -1096,11 +1485,33 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
1096
1485
|
execution.interval = 8;
|
|
1097
1486
|
}
|
|
1098
1487
|
execution.easingName = this.resolveOption(target.easing, child, segmentIndex);
|
|
1099
|
-
if (!execution.segmentStartTime) {
|
|
1100
|
-
execution.segmentStartTime = TUtil.now() - execution.step * execution.interval;
|
|
1101
|
-
}
|
|
1102
1488
|
execution.segmentReady = true;
|
|
1103
1489
|
}
|
|
1490
|
+
}, {
|
|
1491
|
+
key: "isTargetInLoop",
|
|
1492
|
+
value: function isTargetInLoop(runtimeTarget, child) {
|
|
1493
|
+
var loop = runtimeTarget.target.loop;
|
|
1494
|
+
return (typeof loop === "function" ? loop.call(child, runtimeTarget.key) : loop) === true;
|
|
1495
|
+
}
|
|
1496
|
+
}, {
|
|
1497
|
+
key: "getTargetCycles",
|
|
1498
|
+
value: function getTargetCycles(runtimeTarget, child, cycle) {
|
|
1499
|
+
var option = runtimeTarget.target.cycles;
|
|
1500
|
+
var cycles = typeof option === "function" ? option.call(child, cycle) : option;
|
|
1501
|
+
return Math.max(1, Math.floor(Number(cycles) || 1));
|
|
1502
|
+
}
|
|
1503
|
+
}, {
|
|
1504
|
+
key: "completeIfReady",
|
|
1505
|
+
value: function completeIfReady(index) {
|
|
1506
|
+
var state = this.tmodel.childRuntimeStates[index];
|
|
1507
|
+
if (!state || state.done || !state.mainFinished) {
|
|
1508
|
+
return;
|
|
1509
|
+
}
|
|
1510
|
+
if (Object.values(state.loopTargets || {}).some(Boolean) || Object.keys(this.activeTargets[index] || {}).length > 0) {
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1513
|
+
this.complete(index);
|
|
1514
|
+
}
|
|
1104
1515
|
}, {
|
|
1105
1516
|
key: "resolveOption",
|
|
1106
1517
|
value: function resolveOption(value, child) {
|
|
@@ -1116,7 +1527,7 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
1116
1527
|
}, {
|
|
1117
1528
|
key: "animateExecution",
|
|
1118
1529
|
value: function animateExecution(index, execution) {
|
|
1119
|
-
var
|
|
1530
|
+
var _this9 = this;
|
|
1120
1531
|
if (execution.steps <= 0) {
|
|
1121
1532
|
var changed = this.setExecutionValue(index, execution, execution.to);
|
|
1122
1533
|
if (changed && execution.kind === "render") {
|
|
@@ -1127,8 +1538,8 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
1127
1538
|
return new Promise(function (resolve) {
|
|
1128
1539
|
execution.index = index;
|
|
1129
1540
|
execution.resolve = resolve;
|
|
1130
|
-
|
|
1131
|
-
|
|
1541
|
+
_this9.activeRenderExecutions.add(execution);
|
|
1542
|
+
_this9.requestAnimationFrame();
|
|
1132
1543
|
});
|
|
1133
1544
|
}
|
|
1134
1545
|
}, {
|
|
@@ -1155,42 +1566,62 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
1155
1566
|
};
|
|
1156
1567
|
return requestAnimationFrame;
|
|
1157
1568
|
}(function () {
|
|
1158
|
-
var
|
|
1159
|
-
if (this.disposed || this.animationFrameRequested) {
|
|
1569
|
+
var _this10 = this;
|
|
1570
|
+
if (this.disposed || this.visibilityPaused || !this.tmodel.isVisible() || this.animationFrameRequested) {
|
|
1160
1571
|
return;
|
|
1161
1572
|
}
|
|
1162
1573
|
this.animationFrameRequested = true;
|
|
1163
1574
|
this.animationFrameId = requestAnimationFrame(function () {
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
if (!
|
|
1167
|
-
|
|
1575
|
+
_this10.animationFrameId = undefined;
|
|
1576
|
+
_this10.animationFrameRequested = false;
|
|
1577
|
+
if (!_this10.disposed) {
|
|
1578
|
+
_this10.updateRenderExecutions();
|
|
1168
1579
|
}
|
|
1169
1580
|
});
|
|
1170
1581
|
})
|
|
1582
|
+
}, {
|
|
1583
|
+
key: "finishMainProgram",
|
|
1584
|
+
value: function finishMainProgram(index, state) {
|
|
1585
|
+
if (this.disposed || this.tmodel.childRuntimeStates[index] !== state || state.cancelled) {
|
|
1586
|
+
return;
|
|
1587
|
+
}
|
|
1588
|
+
state.started = false;
|
|
1589
|
+
state.mainFinished = true;
|
|
1590
|
+
this.completeIfReady(index);
|
|
1591
|
+
}
|
|
1171
1592
|
}, {
|
|
1172
1593
|
key: "updateRenderExecutions",
|
|
1173
1594
|
value: function updateRenderExecutions() {
|
|
1174
1595
|
if (this.disposed) {
|
|
1175
1596
|
return;
|
|
1176
1597
|
}
|
|
1598
|
+
if (!this.tmodel.isVisible()) {
|
|
1599
|
+
this.pauseForVisibility();
|
|
1600
|
+
return;
|
|
1601
|
+
}
|
|
1177
1602
|
this.startQueuedPrograms();
|
|
1603
|
+
this.startQueuedLoops();
|
|
1178
1604
|
var now = TUtil.now();
|
|
1179
1605
|
var renderChanged = false;
|
|
1180
1606
|
var layoutChanged = false;
|
|
1181
|
-
var
|
|
1182
|
-
|
|
1607
|
+
var _iterator9 = _createForOfIteratorHelper(this.activeRenderExecutions),
|
|
1608
|
+
_step9;
|
|
1183
1609
|
try {
|
|
1184
|
-
for (
|
|
1185
|
-
var execution =
|
|
1186
|
-
var
|
|
1187
|
-
var paused = typeof execution.pauseOn === "function" ? execution.pauseOn.call(
|
|
1610
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
1611
|
+
var execution = _step9.value;
|
|
1612
|
+
var _child2 = this.tmodel.childHandles[execution.index];
|
|
1613
|
+
var paused = typeof execution.pauseOn === "function" ? execution.pauseOn.call(_child2) : execution.pauseOn === true;
|
|
1188
1614
|
if (paused) {
|
|
1189
|
-
|
|
1190
|
-
|
|
1615
|
+
if (execution.segmentStartTime) {
|
|
1616
|
+
var _execution$pausedAt;
|
|
1617
|
+
(_execution$pausedAt = execution.pausedAt) !== null && _execution$pausedAt !== void 0 ? _execution$pausedAt : execution.pausedAt = now;
|
|
1618
|
+
}
|
|
1191
1619
|
continue;
|
|
1192
1620
|
}
|
|
1193
|
-
if (execution.
|
|
1621
|
+
if (!execution.segmentStartTime) {
|
|
1622
|
+
execution.segmentStartTime = now - execution.step * execution.interval;
|
|
1623
|
+
execution.pausedAt = undefined;
|
|
1624
|
+
} else if (execution.pausedAt !== undefined) {
|
|
1194
1625
|
execution.segmentStartTime += now - execution.pausedAt;
|
|
1195
1626
|
execution.pausedAt = undefined;
|
|
1196
1627
|
}
|
|
@@ -1219,9 +1650,9 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
1219
1650
|
}
|
|
1220
1651
|
}
|
|
1221
1652
|
} catch (err) {
|
|
1222
|
-
|
|
1653
|
+
_iterator9.e(err);
|
|
1223
1654
|
} finally {
|
|
1224
|
-
|
|
1655
|
+
_iterator9.f();
|
|
1225
1656
|
}
|
|
1226
1657
|
if (layoutChanged) {
|
|
1227
1658
|
this.tmodel.invalidateLayout();
|
|
@@ -1229,7 +1660,7 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
1229
1660
|
if (renderChanged) {
|
|
1230
1661
|
this.tmodel.requestParticleRender();
|
|
1231
1662
|
}
|
|
1232
|
-
if (this.startQueueIndex < this.startQueue.length || this.activeRenderExecutions.size) {
|
|
1663
|
+
if (this.startQueueIndex < this.startQueue.length || this.loopQueue.length || this.activeRenderExecutions.size) {
|
|
1233
1664
|
this.requestAnimationFrame();
|
|
1234
1665
|
}
|
|
1235
1666
|
}
|
|
@@ -1237,7 +1668,7 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
1237
1668
|
key: "wait",
|
|
1238
1669
|
value: function wait(interval) {
|
|
1239
1670
|
var _this$waitBuckets,
|
|
1240
|
-
|
|
1671
|
+
_this11 = this;
|
|
1241
1672
|
if (this.disposed) {
|
|
1242
1673
|
return Promise.resolve();
|
|
1243
1674
|
}
|
|
@@ -1253,7 +1684,7 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
1253
1684
|
bucket.promise = new Promise(function (resolve) {
|
|
1254
1685
|
bucket.resolve = resolve;
|
|
1255
1686
|
bucket.timeoutId = setTimeout(function () {
|
|
1256
|
-
|
|
1687
|
+
_this11.waitBuckets.delete(deadline);
|
|
1257
1688
|
resolve();
|
|
1258
1689
|
}, Math.max(0, deadline - TUtil.now()));
|
|
1259
1690
|
});
|
|
@@ -1283,7 +1714,7 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
1283
1714
|
key: "runActivatedSequence",
|
|
1284
1715
|
value: function () {
|
|
1285
1716
|
var _runActivatedSequence = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(index, startIndex, sequenceId) {
|
|
1286
|
-
var program;
|
|
1717
|
+
var program, completed;
|
|
1287
1718
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
1288
1719
|
while (1) switch (_context8.prev = _context8.next) {
|
|
1289
1720
|
case 0:
|
|
@@ -1303,43 +1734,39 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
1303
1734
|
_context8.next = 7;
|
|
1304
1735
|
return this.runTarget(index, program[startIndex], startIndex, sequenceId);
|
|
1305
1736
|
case 7:
|
|
1306
|
-
|
|
1307
|
-
|
|
1737
|
+
completed = _context8.sent;
|
|
1738
|
+
if (!(completed && !this.disposed)) {
|
|
1739
|
+
_context8.next = 11;
|
|
1308
1740
|
break;
|
|
1309
1741
|
}
|
|
1310
|
-
_context8.next =
|
|
1742
|
+
_context8.next = 11;
|
|
1311
1743
|
return this.continueActivatedSequence(index, startIndex + 1, sequenceId);
|
|
1312
|
-
case
|
|
1744
|
+
case 11:
|
|
1313
1745
|
case "end":
|
|
1314
1746
|
return _context8.stop();
|
|
1315
1747
|
}
|
|
1316
1748
|
}, _callee8, this);
|
|
1317
1749
|
}));
|
|
1318
|
-
function runActivatedSequence(
|
|
1750
|
+
function runActivatedSequence(_x22, _x23, _x24) {
|
|
1319
1751
|
return _runActivatedSequence.apply(this, arguments);
|
|
1320
1752
|
}
|
|
1321
1753
|
return runActivatedSequence;
|
|
1322
1754
|
}()
|
|
1323
|
-
}, {
|
|
1324
|
-
key: "cancelImperativeExecution",
|
|
1325
|
-
value: function cancelImperativeExecution(index, imperativeKey) {
|
|
1326
|
-
for (var _i3 = 0, _arr2 = _toConsumableArray(this.activeRenderExecutions); _i3 < _arr2.length; _i3++) {
|
|
1327
|
-
var execution = _arr2[_i3];
|
|
1328
|
-
if (execution.index !== index || execution.imperativeKey !== imperativeKey) {
|
|
1329
|
-
continue;
|
|
1330
|
-
}
|
|
1331
|
-
this.activeRenderExecutions.delete(execution);
|
|
1332
|
-
execution.cancelled = true;
|
|
1333
|
-
this.clearExecution(index, execution.sequenceId, execution.targetIndex);
|
|
1334
|
-
var resolve = execution.resolve;
|
|
1335
|
-
execution.resolve = undefined;
|
|
1336
|
-
resolve === null || resolve === void 0 || resolve();
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
1755
|
}, {
|
|
1340
1756
|
key: "setImperativeTarget",
|
|
1341
1757
|
value: function setImperativeTarget(index, key, rawTarget, steps, interval, easing, originalTargetName, originalTModel) {
|
|
1342
|
-
var
|
|
1758
|
+
var _ref,
|
|
1759
|
+
_ref2,
|
|
1760
|
+
_target$steps,
|
|
1761
|
+
_ref3,
|
|
1762
|
+
_ref4,
|
|
1763
|
+
_target$interval,
|
|
1764
|
+
_ref5,
|
|
1765
|
+
_target$easing,
|
|
1766
|
+
_ref6,
|
|
1767
|
+
_target$cycles,
|
|
1768
|
+
_target$pauseOn,
|
|
1769
|
+
_this12 = this;
|
|
1343
1770
|
if (this.disposed) {
|
|
1344
1771
|
return;
|
|
1345
1772
|
}
|
|
@@ -1348,25 +1775,23 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
1348
1775
|
return;
|
|
1349
1776
|
}
|
|
1350
1777
|
var imperativeKey = key.endsWith("+") ? key : "".concat(key, "+");
|
|
1351
|
-
|
|
1352
|
-
|
|
1778
|
+
|
|
1779
|
+
// List targets carry their animation options beside the list, not beside a `value` property.
|
|
1780
|
+
// Unwrap them without calling TargetParser.getValueStepsCycles(), which requires a full TModel.
|
|
1781
|
+
var outerList = TargetParser.isListTarget(rawTarget) ? rawTarget : undefined;
|
|
1782
|
+
var target = outerList ? {
|
|
1783
|
+
value: outerList.list
|
|
1784
|
+
} : TargetParser.isTargetSpecObject(rawTarget) ? _objectSpread({}, rawTarget) : {
|
|
1353
1785
|
value: rawTarget
|
|
1354
1786
|
};
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
}
|
|
1364
|
-
var _TargetParser$getValu = TargetParser.getValueStepsCycles(child, imperativeKey, target, 0),
|
|
1365
|
-
_TargetParser$getValu2 = _slicedToArray(_TargetParser$getValu, 4),
|
|
1366
|
-
value = _TargetParser$getValu2[0],
|
|
1367
|
-
parsedSteps = _TargetParser$getValu2[1],
|
|
1368
|
-
parsedInterval = _TargetParser$getValu2[2],
|
|
1369
|
-
parsedEasing = _TargetParser$getValu2[3];
|
|
1787
|
+
var innerList = TargetParser.isListTarget(target.value) ? target.value : undefined;
|
|
1788
|
+
var listOptions = outerList !== null && outerList !== void 0 ? outerList : innerList;
|
|
1789
|
+
var value = listOptions ? listOptions.list : target.value;
|
|
1790
|
+
var parsedSteps = (_ref = (_ref2 = (_target$steps = target.steps) !== null && _target$steps !== void 0 ? _target$steps : listOptions === null || listOptions === void 0 ? void 0 : listOptions.steps) !== null && _ref2 !== void 0 ? _ref2 : steps) !== null && _ref !== void 0 ? _ref : 0;
|
|
1791
|
+
var parsedInterval = (_ref3 = (_ref4 = (_target$interval = target.interval) !== null && _target$interval !== void 0 ? _target$interval : listOptions === null || listOptions === void 0 ? void 0 : listOptions.interval) !== null && _ref4 !== void 0 ? _ref4 : interval) !== null && _ref3 !== void 0 ? _ref3 : 0;
|
|
1792
|
+
var parsedEasing = (_ref5 = (_target$easing = target.easing) !== null && _target$easing !== void 0 ? _target$easing : listOptions === null || listOptions === void 0 ? void 0 : listOptions.easing) !== null && _ref5 !== void 0 ? _ref5 : easing;
|
|
1793
|
+
var cycles = (_ref6 = (_target$cycles = target.cycles) !== null && _target$cycles !== void 0 ? _target$cycles : listOptions === null || listOptions === void 0 ? void 0 : listOptions.cycles) !== null && _ref6 !== void 0 ? _ref6 : 1;
|
|
1794
|
+
var pauseOn = (_target$pauseOn = target.pauseOn) !== null && _target$pauseOn !== void 0 ? _target$pauseOn : listOptions === null || listOptions === void 0 ? void 0 : listOptions.pauseOn;
|
|
1370
1795
|
var targetValue = {
|
|
1371
1796
|
isImperative: true,
|
|
1372
1797
|
originalTargetName: originalTargetName,
|
|
@@ -1375,45 +1800,97 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
1375
1800
|
value: value,
|
|
1376
1801
|
steps: parsedSteps || 0,
|
|
1377
1802
|
interval: parsedInterval || 0,
|
|
1378
|
-
easing: parsedEasing
|
|
1803
|
+
easing: parsedEasing,
|
|
1804
|
+
cycles: cycles
|
|
1379
1805
|
};
|
|
1380
1806
|
child.targetValues[imperativeKey] = targetValue;
|
|
1381
1807
|
child.addToUpdatingTargets(imperativeKey);
|
|
1382
1808
|
var runtimeTarget = {
|
|
1383
|
-
targetName: key,
|
|
1809
|
+
targetName: ParticleUtil.getTargetName(key),
|
|
1384
1810
|
imperativeKey: imperativeKey,
|
|
1385
1811
|
renderable: ParticleUtil.isGpuTarget(key),
|
|
1386
1812
|
originalTargetName: originalTargetName,
|
|
1387
1813
|
originalTargetIsParent: originalTModel === this.tmodel,
|
|
1388
1814
|
target: {
|
|
1389
|
-
value:
|
|
1815
|
+
value: value,
|
|
1390
1816
|
steps: parsedSteps,
|
|
1391
1817
|
interval: parsedInterval,
|
|
1392
1818
|
easing: parsedEasing,
|
|
1393
|
-
|
|
1819
|
+
cycles: cycles,
|
|
1820
|
+
pauseOn: pauseOn
|
|
1394
1821
|
}
|
|
1395
1822
|
};
|
|
1396
|
-
var sequenceId = "imperative:".concat(index, ":").concat(imperativeKey, ":").concat(
|
|
1397
|
-
var promise =
|
|
1398
|
-
promise.
|
|
1399
|
-
if (
|
|
1823
|
+
var sequenceId = "imperative:".concat(index, ":").concat(imperativeKey, ":").concat(++this.imperativeSequenceCount);
|
|
1824
|
+
var promise = this.runTarget(index, runtimeTarget, 0, sequenceId, targetValue);
|
|
1825
|
+
promise.then(function (completed) {
|
|
1826
|
+
if (_this12.disposed || child.targetValues[imperativeKey] !== targetValue) {
|
|
1400
1827
|
return;
|
|
1401
1828
|
}
|
|
1402
|
-
targetValue.status = "done";
|
|
1829
|
+
targetValue.status = completed ? "done" : "cancelled";
|
|
1403
1830
|
child.removeFromUpdatingTargets(imperativeKey);
|
|
1404
|
-
if (
|
|
1405
|
-
|
|
1831
|
+
if (completed) {
|
|
1832
|
+
_this12.queueImperativeCompletion(originalTModel, originalTargetName);
|
|
1406
1833
|
}
|
|
1407
|
-
getRunScheduler().schedule(1, "gpuImperativeComplete-".concat(child.oid, "-").concat(imperativeKey));
|
|
1408
1834
|
});
|
|
1409
1835
|
return promise;
|
|
1410
1836
|
}
|
|
1837
|
+
}, {
|
|
1838
|
+
key: "queueImperativeCompletion",
|
|
1839
|
+
value: function queueImperativeCompletion(originalTModel, originalTargetName) {
|
|
1840
|
+
var _this13 = this;
|
|
1841
|
+
var pending = this.tmodel.pendingImperativeCompletions;
|
|
1842
|
+
if (originalTModel && originalTargetName) {
|
|
1843
|
+
var targets = pending.get(originalTModel);
|
|
1844
|
+
if (!targets) {
|
|
1845
|
+
targets = new Set();
|
|
1846
|
+
pending.set(originalTModel, targets);
|
|
1847
|
+
}
|
|
1848
|
+
targets.add(originalTargetName);
|
|
1849
|
+
}
|
|
1850
|
+
if (this.imperativeCompletionFrame !== undefined) {
|
|
1851
|
+
return;
|
|
1852
|
+
}
|
|
1853
|
+
this.imperativeCompletionFrame = requestAnimationFrame(function () {
|
|
1854
|
+
_this13.imperativeCompletionFrame = undefined;
|
|
1855
|
+
if (_this13.disposed) {
|
|
1856
|
+
return;
|
|
1857
|
+
}
|
|
1858
|
+
var completions = _this13.tmodel.pendingImperativeCompletions;
|
|
1859
|
+
_this13.tmodel.pendingImperativeCompletions = new Map();
|
|
1860
|
+
var _iterator10 = _createForOfIteratorHelper(completions),
|
|
1861
|
+
_step10;
|
|
1862
|
+
try {
|
|
1863
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
1864
|
+
var _step10$value = _slicedToArray(_step10.value, 2),
|
|
1865
|
+
tmodel = _step10$value[0],
|
|
1866
|
+
_targets = _step10$value[1];
|
|
1867
|
+
var _iterator11 = _createForOfIteratorHelper(_targets),
|
|
1868
|
+
_step11;
|
|
1869
|
+
try {
|
|
1870
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
1871
|
+
var key = _step11.value;
|
|
1872
|
+
TargetUtil.shouldActivateNextTarget(tmodel, key, 1, 0, true, "complete");
|
|
1873
|
+
}
|
|
1874
|
+
} catch (err) {
|
|
1875
|
+
_iterator11.e(err);
|
|
1876
|
+
} finally {
|
|
1877
|
+
_iterator11.f();
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
} catch (err) {
|
|
1881
|
+
_iterator10.e(err);
|
|
1882
|
+
} finally {
|
|
1883
|
+
_iterator10.f();
|
|
1884
|
+
}
|
|
1885
|
+
getRunScheduler().schedule(1, "gpuImperativeComplete-".concat(_this13.tmodel.oid));
|
|
1886
|
+
});
|
|
1887
|
+
}
|
|
1411
1888
|
}, {
|
|
1412
1889
|
key: "activateTarget",
|
|
1413
1890
|
value: function activateTarget(index, key) {
|
|
1414
1891
|
var _this$activeTargets2,
|
|
1415
1892
|
_this$activeTargets2$,
|
|
1416
|
-
|
|
1893
|
+
_this14 = this;
|
|
1417
1894
|
var state = this.tmodel.childRuntimeStates[index];
|
|
1418
1895
|
var program = this.tmodel.childRuntimePrograms[index];
|
|
1419
1896
|
if (!state || !program) {
|
|
@@ -1430,19 +1907,70 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
1430
1907
|
var activationId = "".concat(runtimeTarget.key, "-").concat(++state.activationCount);
|
|
1431
1908
|
var sequenceId = "activation:".concat(activationId);
|
|
1432
1909
|
var activeTargets = (_this$activeTargets2$ = (_this$activeTargets2 = this.activeTargets)[index]) !== null && _this$activeTargets2$ !== void 0 ? _this$activeTargets2$ : _this$activeTargets2[index] = {};
|
|
1910
|
+
if (state.done) {
|
|
1911
|
+
state.done = false;
|
|
1912
|
+
this.tmodel.pendingGpuChildRuntimeCounts[state.originalTargetName] = (this.tmodel.pendingGpuChildRuntimeCounts[state.originalTargetName] || 0) + 1;
|
|
1913
|
+
}
|
|
1914
|
+
;
|
|
1433
1915
|
var promise = Promise.resolve().then(function () {
|
|
1434
|
-
return
|
|
1916
|
+
return _this14.runActivatedSequence(index, startIndex, sequenceId);
|
|
1435
1917
|
}).catch(function (error) {
|
|
1436
1918
|
console.error(error);
|
|
1437
1919
|
}).finally(function () {
|
|
1438
1920
|
delete activeTargets[activationId];
|
|
1439
|
-
if (!
|
|
1440
|
-
|
|
1921
|
+
if (!_this14.disposed) {
|
|
1922
|
+
_this14.completeIfReady(index);
|
|
1923
|
+
TargetUtil.cleanupVisibleComplete(_this14.tmodel, state.originalTargetName);
|
|
1441
1924
|
}
|
|
1442
1925
|
});
|
|
1443
1926
|
activeTargets[activationId] = promise;
|
|
1444
1927
|
return true;
|
|
1445
1928
|
}
|
|
1929
|
+
}, {
|
|
1930
|
+
key: "pauseForVisibility",
|
|
1931
|
+
value: function pauseForVisibility() {
|
|
1932
|
+
if (this.disposed || this.visibilityPaused) {
|
|
1933
|
+
return;
|
|
1934
|
+
}
|
|
1935
|
+
this.visibilityPaused = true;
|
|
1936
|
+
var now = TUtil.now();
|
|
1937
|
+
var _iterator12 = _createForOfIteratorHelper(this.activeRenderExecutions),
|
|
1938
|
+
_step12;
|
|
1939
|
+
try {
|
|
1940
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
1941
|
+
var execution = _step12.value;
|
|
1942
|
+
if (execution.segmentStartTime) {
|
|
1943
|
+
var _execution$pausedAt2;
|
|
1944
|
+
(_execution$pausedAt2 = execution.pausedAt) !== null && _execution$pausedAt2 !== void 0 ? _execution$pausedAt2 : execution.pausedAt = now;
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
} catch (err) {
|
|
1948
|
+
_iterator12.e(err);
|
|
1949
|
+
} finally {
|
|
1950
|
+
_iterator12.f();
|
|
1951
|
+
}
|
|
1952
|
+
if (this.animationFrameId !== undefined) {
|
|
1953
|
+
cancelAnimationFrame(this.animationFrameId);
|
|
1954
|
+
this.animationFrameId = undefined;
|
|
1955
|
+
}
|
|
1956
|
+
this.animationFrameRequested = false;
|
|
1957
|
+
}
|
|
1958
|
+
}, {
|
|
1959
|
+
key: "resumeForVisibility",
|
|
1960
|
+
value: function resumeForVisibility() {
|
|
1961
|
+
if (this.disposed || !this.tmodel.isVisible()) {
|
|
1962
|
+
return;
|
|
1963
|
+
}
|
|
1964
|
+
this.visibilityPaused = false;
|
|
1965
|
+
this.resumeRestored();
|
|
1966
|
+
this.startReady();
|
|
1967
|
+
if (this.startQueueIndex < this.startQueue.length || this.loopQueue.length || this.activeRenderExecutions.size) {
|
|
1968
|
+
this.requestAnimationFrame();
|
|
1969
|
+
}
|
|
1970
|
+
if (this.tmodel.particleValuesDirty || this.tmodel.activeChildTransitionKey) {
|
|
1971
|
+
this.tmodel.requestParticleRender();
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1446
1974
|
}, {
|
|
1447
1975
|
key: "dispose",
|
|
1448
1976
|
value: function dispose() {
|
|
@@ -1458,53 +1986,58 @@ var ParticleRuntime = /*#__PURE__*/function () {
|
|
|
1458
1986
|
this.animationFrameRequested = false;
|
|
1459
1987
|
this.startQueue.length = 0;
|
|
1460
1988
|
this.startQueueIndex = 0;
|
|
1461
|
-
|
|
1462
|
-
|
|
1989
|
+
this.loopQueue.length = 0;
|
|
1990
|
+
if (this.imperativeCompletionFrame !== undefined) {
|
|
1991
|
+
cancelAnimationFrame(this.imperativeCompletionFrame);
|
|
1992
|
+
this.imperativeCompletionFrame = undefined;
|
|
1993
|
+
}
|
|
1994
|
+
var _iterator13 = _createForOfIteratorHelper(this.tmodel.childRuntimeStates),
|
|
1995
|
+
_step13;
|
|
1463
1996
|
try {
|
|
1464
|
-
for (
|
|
1465
|
-
var
|
|
1466
|
-
if (!
|
|
1997
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
1998
|
+
var _state = _step13.value;
|
|
1999
|
+
if (!_state) {
|
|
1467
2000
|
continue;
|
|
1468
2001
|
}
|
|
1469
|
-
|
|
1470
|
-
for (var
|
|
1471
|
-
var execution = _Object$values[
|
|
2002
|
+
_state.cancelled = true;
|
|
2003
|
+
for (var _i7 = 0, _Object$values = Object.values(_state.executions || {}); _i7 < _Object$values.length; _i7++) {
|
|
2004
|
+
var execution = _Object$values[_i7];
|
|
1472
2005
|
execution.cancelled = true;
|
|
1473
2006
|
}
|
|
1474
2007
|
}
|
|
1475
2008
|
} catch (err) {
|
|
1476
|
-
|
|
2009
|
+
_iterator13.e(err);
|
|
1477
2010
|
} finally {
|
|
1478
|
-
|
|
2011
|
+
_iterator13.f();
|
|
1479
2012
|
}
|
|
1480
|
-
var
|
|
1481
|
-
|
|
2013
|
+
var _iterator14 = _createForOfIteratorHelper(this.activeRenderExecutions),
|
|
2014
|
+
_step14;
|
|
1482
2015
|
try {
|
|
1483
|
-
for (
|
|
1484
|
-
var
|
|
1485
|
-
|
|
1486
|
-
var resolve =
|
|
1487
|
-
|
|
2016
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
2017
|
+
var _execution2 = _step14.value;
|
|
2018
|
+
_execution2.cancelled = true;
|
|
2019
|
+
var resolve = _execution2.resolve;
|
|
2020
|
+
_execution2.resolve = undefined;
|
|
1488
2021
|
resolve === null || resolve === void 0 || resolve();
|
|
1489
2022
|
}
|
|
1490
2023
|
} catch (err) {
|
|
1491
|
-
|
|
2024
|
+
_iterator14.e(err);
|
|
1492
2025
|
} finally {
|
|
1493
|
-
|
|
2026
|
+
_iterator14.f();
|
|
1494
2027
|
}
|
|
1495
2028
|
this.activeRenderExecutions.clear();
|
|
1496
|
-
var
|
|
1497
|
-
|
|
2029
|
+
var _iterator15 = _createForOfIteratorHelper((_this$waitBuckets$val = (_this$waitBuckets3 = this.waitBuckets) === null || _this$waitBuckets3 === void 0 ? void 0 : _this$waitBuckets3.values()) !== null && _this$waitBuckets$val !== void 0 ? _this$waitBuckets$val : []),
|
|
2030
|
+
_step15;
|
|
1498
2031
|
try {
|
|
1499
|
-
for (
|
|
1500
|
-
var bucket =
|
|
2032
|
+
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
|
2033
|
+
var bucket = _step15.value;
|
|
1501
2034
|
clearTimeout(bucket.timeoutId);
|
|
1502
2035
|
bucket.resolve();
|
|
1503
2036
|
}
|
|
1504
2037
|
} catch (err) {
|
|
1505
|
-
|
|
2038
|
+
_iterator15.e(err);
|
|
1506
2039
|
} finally {
|
|
1507
|
-
|
|
2040
|
+
_iterator15.f();
|
|
1508
2041
|
}
|
|
1509
2042
|
(_this$waitBuckets2 = this.waitBuckets) === null || _this$waitBuckets2 === void 0 || _this$waitBuckets2.clear();
|
|
1510
2043
|
}
|