@galacean/effects-specification 2.0.0-alpha.2 → 2.0.0-alpha.3

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/dist/fallback.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  * Name: @galacean/effects-specification
3
3
  * Description: Galacean Effects JSON Specification
4
4
  * Author: Ant Group CO., Ltd.
5
- * Version: v2.0.0-alpha.2
5
+ * Version: v2.0.0-alpha.3
6
6
  */
7
7
 
8
8
  const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
@@ -1537,7 +1537,7 @@ function version22Migration(json) {
1537
1537
  */
1538
1538
  function version30Migration(json) {
1539
1539
  var e_1, _a;
1540
- var _b, _c, _d, _e;
1540
+ var _b, _c, _d, _e, _f, _g, _h, _j;
1541
1541
  var result = Object.assign({}, json, {
1542
1542
  items: [],
1543
1543
  components: [],
@@ -1565,15 +1565,15 @@ function version30Migration(json) {
1565
1565
  }
1566
1566
  }
1567
1567
  var _loop_1 = function (composition) {
1568
- var e_2, _h, e_3, _j;
1568
+ var e_2, _m, e_3, _o;
1569
1569
  // composition 的 endbehaviour 兼容
1570
1570
  if (composition.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY || composition.endBehavior === END_BEHAVIOR_PAUSE) {
1571
1571
  composition.endBehavior = END_BEHAVIOR_FREEZE;
1572
1572
  }
1573
1573
  var itemGuidMap = {};
1574
1574
  try {
1575
- for (var _k = (e_2 = void 0, __values(composition.items)), _l = _k.next(); !_l.done; _l = _k.next()) {
1576
- var item = _l.value;
1575
+ for (var _p = (e_2 = void 0, __values(composition.items)), _q = _p.next(); !_q.done; _q = _p.next()) {
1576
+ var item = _q.value;
1577
1577
  itemGuidMap[item.id] = generateGUID();
1578
1578
  // TODO: 编辑器测试用,上线后删除
1579
1579
  //@ts-expect-error
@@ -1584,7 +1584,7 @@ function version30Migration(json) {
1584
1584
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
1585
1585
  finally {
1586
1586
  try {
1587
- if (_l && !_l.done && (_h = _k.return)) _h.call(_k);
1587
+ if (_q && !_q.done && (_m = _p.return)) _m.call(_p);
1588
1588
  }
1589
1589
  finally { if (e_2) throw e_2.error; }
1590
1590
  }
@@ -1605,8 +1605,8 @@ function version30Migration(json) {
1605
1605
  composition.items[index] = { id: item.id };
1606
1606
  });
1607
1607
  try {
1608
- for (var _m = (e_3 = void 0, __values(result.items)), _o = _m.next(); !_o.done; _o = _m.next()) {
1609
- var item = _o.value;
1608
+ for (var _r = (e_3 = void 0, __values(result.items)), _s = _r.next(); !_s.done; _s = _r.next()) {
1609
+ var item = _s.value;
1610
1610
  // 原 texture 索引转为统一 guid 索引
1611
1611
  if (item.content) {
1612
1612
  if (item.content.renderer) {
@@ -1655,13 +1655,10 @@ function version30Migration(json) {
1655
1655
  var startSize = item.transform.size;
1656
1656
  // 兼容旧JSON(anchor和particleOrigin可能同时存在)
1657
1657
  if (!renderer.anchor && renderer.particleOrigin !== undefined) {
1658
- //@ts-expect-error
1659
- item.transform.position.x += -realAnchor[0] * startSize.x;
1660
- //@ts-expect-error
1661
- item.transform.position.y += -realAnchor[1] * startSize.y;
1658
+ item.transform.position.x += -realAnchor[0] * ((_f = startSize === null || startSize === void 0 ? void 0 : startSize.x) !== null && _f !== void 0 ? _f : 1);
1659
+ item.transform.position.y += -realAnchor[1] * ((_g = startSize === null || startSize === void 0 ? void 0 : startSize.y) !== null && _g !== void 0 ? _g : 1);
1662
1660
  }
1663
- //@ts-expect-error
1664
- item.transform.anchor = { x: realAnchor[0] * startSize.x, y: realAnchor[1] * startSize.y };
1661
+ item.transform.anchor = { x: realAnchor[0] * ((_h = startSize === null || startSize === void 0 ? void 0 : startSize.x) !== null && _h !== void 0 ? _h : 1), y: realAnchor[1] * ((_j = startSize === null || startSize === void 0 ? void 0 : startSize.y) !== null && _j !== void 0 ? _j : 1) };
1665
1662
  }
1666
1663
  }
1667
1664
  if (item.type === ItemType.particle) {
@@ -1813,22 +1810,22 @@ function version30Migration(json) {
1813
1810
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
1814
1811
  finally {
1815
1812
  try {
1816
- if (_o && !_o.done && (_j = _m.return)) _j.call(_m);
1813
+ if (_s && !_s.done && (_o = _r.return)) _o.call(_r);
1817
1814
  }
1818
1815
  finally { if (e_3) throw e_3.error; }
1819
1816
  }
1820
1817
  };
1821
1818
  try {
1822
1819
  // 更正Composition.endBehavior
1823
- for (var _f = __values(json.compositions), _g = _f.next(); !_g.done; _g = _f.next()) {
1824
- var composition = _g.value;
1820
+ for (var _k = __values(json.compositions), _l = _k.next(); !_l.done; _l = _k.next()) {
1821
+ var composition = _l.value;
1825
1822
  _loop_1(composition);
1826
1823
  }
1827
1824
  }
1828
1825
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
1829
1826
  finally {
1830
1827
  try {
1831
- if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
1828
+ if (_l && !_l.done && (_a = _k.return)) _a.call(_k);
1832
1829
  }
1833
1830
  finally { if (e_1) throw e_1.error; }
1834
1831
  }