@galacean/effects-core 2.2.5 → 2.2.7

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.
@@ -7,6 +7,11 @@ export declare function version21Migration(json: JSONSceneLegacy): JSONSceneLega
7
7
  * 2.2 以下版本数据适配(mars-player@2.5.0 及以上版本支持 2.2 以下数据的适配)
8
8
  */
9
9
  export declare function version22Migration(json: JSONSceneLegacy): JSONSceneLegacy;
10
+ /**
11
+ * 3.1 版本数据适配
12
+ * - 富文本插件名称的适配
13
+ */
14
+ export declare function version31Migration(json: JSONSceneLegacy): JSONSceneLegacy;
10
15
  /**
11
16
  * 3.0 以下版本数据适配(runtime 2.0及以上版本支持)
12
17
  */
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime core for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.2.5
6
+ * Version: v2.2.7
7
7
  */
8
8
 
9
9
  'use strict';
@@ -957,7 +957,7 @@ var pluginInfoMap = {
957
957
  "video": "@galacean/effects-plugin-multimedia",
958
958
  "audio": "@galacean/effects-plugin-multimedia",
959
959
  "orientation-transformer": "@galacean/effects-plugin-orientation-transformer",
960
- "richtext": "@galacean/effects-plugin-rich-text",
960
+ "rich-text": "@galacean/effects-plugin-rich-text",
961
961
  "spine": "@galacean/effects-plugin-spine"
962
962
  };
963
963
  function getPluginUsageInfo(name) {
@@ -11719,25 +11719,35 @@ function numberToFix(a, fixed) {
11719
11719
  }
11720
11720
 
11721
11721
  var keyframeInfo = {
11722
+ pointIndexCache: {
11723
+ xIndex: 0,
11724
+ yIndex: 0
11725
+ },
11722
11726
  /**
11723
11727
  * 根据不同关键帧类型,获取位于曲线上的点
11724
11728
  */ getPointInCurve: function getPointInCurve(keyframe) {
11725
11729
  keyframe[0]; var data = keyframe[1];
11726
- var _this_getPointIndexInCurve = this.getPointIndexInCurve(keyframe), xIndex = _this_getPointIndexInCurve.xIndex, yIndex = _this_getPointIndexInCurve.yIndex;
11730
+ var _this_getPointIndexInCurve = this.getPointIndexInCurve(keyframe, this.pointIndexCache), xIndex = _this_getPointIndexInCurve.xIndex, yIndex = _this_getPointIndexInCurve.yIndex;
11727
11731
  var time = data[xIndex];
11728
11732
  var value = data[yIndex];
11729
11733
  return new Vector2(time, value);
11730
11734
  },
11731
11735
  /**
11732
11736
  * 根据不同关键帧类型,获取位于曲线上的点的索引
11733
- */ getPointIndexInCurve: function getPointIndexInCurve(keyframe) {
11737
+ */ getPointIndexInCurve: function getPointIndexInCurve(keyframe, res) {
11734
11738
  var type = keyframe[0], markType = keyframe[2];
11735
11739
  // 不同类型,存放的时间不同
11736
11740
  var index = type === BezierKeyframeType.LINE ? 0 : type === BezierKeyframeType.EASE_OUT ? 0 : type === BezierKeyframeType.EASE_IN ? 2 : type === BezierKeyframeType.EASE ? 2 : type === BezierKeyframeType.HOLD ? markType === BezierKeyframeType.EASE_IN ? 2 : 0 : 0;
11737
- return {
11738
- xIndex: index,
11739
- yIndex: index + 1
11740
- };
11741
+ if (res) {
11742
+ res.xIndex = index;
11743
+ res.yIndex = index + 1;
11744
+ return res;
11745
+ } else {
11746
+ return {
11747
+ xIndex: index,
11748
+ yIndex: index + 1
11749
+ };
11750
+ }
11741
11751
  },
11742
11752
  /**
11743
11753
  * 关键帧左侧是否为缓动类型(否则为线段)
@@ -12644,6 +12654,8 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
12644
12654
  timeEnd: Number(e.x)
12645
12655
  };
12646
12656
  }
12657
+ this.startKeyframe = keyframes[0];
12658
+ this.endKeyframe = keyframes[keyframes.length - 1];
12647
12659
  this.keyTimeData = Object.keys(this.curveMap);
12648
12660
  };
12649
12661
  _proto.getValue = function getValue(time) {
@@ -12651,13 +12663,13 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
12651
12663
  var keyTimeData = this.keyTimeData;
12652
12664
  var keyTimeStart = this.curveMap[keyTimeData[0]].timeStart;
12653
12665
  var keyTimeEnd = this.curveMap[keyTimeData[keyTimeData.length - 1]].timeEnd;
12654
- // const keyTimeStart = Number(keyTimeData[0].split('&')[0]);
12655
- // const keyTimeEnd = Number(keyTimeData[keyTimeData.length - 1].split('&')[1]);
12656
12666
  if (time <= keyTimeStart) {
12657
- return this.getCurveValue(keyTimeData[0], keyTimeStart);
12667
+ keyframeInfo.getPointIndexInCurve(this.startKeyframe, keyframeInfo.pointIndexCache);
12668
+ return this.startKeyframe[1][keyframeInfo.pointIndexCache.yIndex];
12658
12669
  }
12659
12670
  if (time >= keyTimeEnd) {
12660
- return this.getCurveValue(keyTimeData[keyTimeData.length - 1], keyTimeEnd);
12671
+ keyframeInfo.getPointIndexInCurve(this.endKeyframe, keyframeInfo.pointIndexCache);
12672
+ return this.endKeyframe[1][keyframeInfo.pointIndexCache.yIndex];
12661
12673
  }
12662
12674
  for(var i = 0; i < keyTimeData.length; i++){
12663
12675
  var xMin = this.curveMap[keyTimeData[i]].timeStart;
@@ -16260,7 +16272,7 @@ var EventSystem = /*#__PURE__*/ function() {
16260
16272
  var vy = 0;
16261
16273
  var ts = performance.now();
16262
16274
  if (!_this.target) {
16263
- logger.error("Trigger TouchEvent after EventSystem is disposed.");
16275
+ logger.warn("Trigger TouchEvent after EventSystem is disposed.");
16264
16276
  return {
16265
16277
  x: x,
16266
16278
  y: y,
@@ -26002,6 +26014,18 @@ function getStandardInteractContent(ui) {
26002
26014
  });
26003
26015
  return json;
26004
26016
  }
26017
+ /**
26018
+ * 3.1 版本数据适配
26019
+ * - 富文本插件名称的适配
26020
+ */ function version31Migration(json) {
26021
+ var _json_plugins;
26022
+ (_json_plugins = json.plugins) == null ? void 0 : _json_plugins.forEach(function(plugin, index) {
26023
+ if (plugin === "richtext") {
26024
+ json.plugins[index] = "rich-text";
26025
+ }
26026
+ });
26027
+ return json;
26028
+ }
26005
26029
  /**
26006
26030
  * 3.0 以下版本数据适配(runtime 2.0及以上版本支持)
26007
26031
  */ function version30Migration(json) {
@@ -26829,6 +26853,8 @@ function getStandardJSON(json) {
26829
26853
  }
26830
26854
  // 修正老版本数据中,meshItem 以及 lightItem 结束行为错误问题
26831
26855
  version22Migration(json);
26856
+ // 修正老版本数据中,富文本插件名称的问题
26857
+ version31Migration(json);
26832
26858
  if (v0.test(json.version)) {
26833
26859
  var _exec;
26834
26860
  reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
@@ -31371,7 +31397,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
31371
31397
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
31372
31398
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
31373
31399
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
31374
- var version = "2.2.5";
31400
+ var version = "2.2.7";
31375
31401
  logger.info("Core version: " + version + ".");
31376
31402
 
31377
31403
  exports.AbstractPlugin = AbstractPlugin;