@galacean/effects-core 2.7.0-beta.0 → 2.7.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.
@@ -16,6 +16,7 @@ export declare function version31Migration(json: JSONScene): JSONScene;
16
16
  export declare function version32Migration(json: JSONScene): JSONScene;
17
17
  export declare function version33Migration(json: JSONScene): JSONScene;
18
18
  export declare function version34Migration(json: JSONScene): JSONScene;
19
+ export declare function version35Migration(json: JSONScene): JSONScene;
19
20
  export declare function processContent(composition: spec.CompositionData): void;
20
21
  export declare function processMask(renderContent: any): void;
21
22
  /**
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.7.0-beta.0
6
+ * Version: v2.7.1
7
7
  */
8
8
 
9
9
  'use strict';
@@ -25321,7 +25321,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
25321
25321
  };
25322
25322
  _proto.fromData = function fromData(data) {
25323
25323
  EffectsObject.prototype.fromData.call(this, data);
25324
- var id = data.id, name = data.name, parentId = data.parentId, endBehavior = data.endBehavior, transform = data.transform, _data_duration = data.duration, duration = _data_duration === void 0 ? 0 : _data_duration;
25324
+ var id = data.id, name = data.name, parentId = data.parentId, endBehavior = data.endBehavior, transform = data.transform, _data_duration = data.duration, duration = _data_duration === void 0 ? 0 : _data_duration, _data_visible = data.visible, visible = _data_visible === void 0 ? true : _data_visible;
25325
25325
  this.props = data;
25326
25326
  this.type = data.type;
25327
25327
  this.id = id.toString(); // TODO 老数据 id 是 number,需要转换
@@ -25359,6 +25359,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
25359
25359
  if (VFXItem.isComposition(this)) {
25360
25360
  this.instantiatePreComposition();
25361
25361
  }
25362
+ this.setVisible(visible);
25362
25363
  };
25363
25364
  _proto.toData = function toData() {
25364
25365
  var _this_parent;
@@ -29233,7 +29234,8 @@ var TextComponentBase = /*#__PURE__*/ function() {
29233
29234
  _proto.getLineCount = function getLineCount(text, init) {
29234
29235
  var context = this.context;
29235
29236
  var _this_textLayout = this.textLayout, letterSpace = _this_textLayout.letterSpace, overflow = _this_textLayout.overflow;
29236
- var fontScale = init ? this.textStyle.fontSize / 10 : 1 / this.textStyle.fontScale;
29237
+ // const fontScale = init ? this.textStyle.fontSize / 10 : 1 / this.textStyle.fontScale;
29238
+ this.maxLineWidth = 0;
29237
29239
  var width = this.textLayout.width + this.textStyle.fontOffset;
29238
29240
  var lineCount = 1;
29239
29241
  var x = 0;
@@ -29245,7 +29247,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
29245
29247
  var _context_measureText;
29246
29248
  var str = text[i];
29247
29249
  var _context_measureText_width;
29248
- var textMetrics = ((_context_measureText_width = context == null ? void 0 : (_context_measureText = context.measureText(str)) == null ? void 0 : _context_measureText.width) != null ? _context_measureText_width : 0) * fontScale;
29250
+ var textMetrics = (_context_measureText_width = context == null ? void 0 : (_context_measureText = context.measureText(str)) == null ? void 0 : _context_measureText.width) != null ? _context_measureText_width : 0;
29249
29251
  // 和浏览器行为保持一致
29250
29252
  x += letterSpace;
29251
29253
  // 处理文本结束行为
@@ -30653,42 +30655,41 @@ function version34Migration(json) {
30653
30655
  }
30654
30656
  }
30655
30657
  }
30656
- // 处理富文本lineGap兼容性
30657
- processRichTextLineGapCompatibility(json);
30658
30658
  //@ts-expect-error
30659
30659
  json.version = "3.5";
30660
30660
  return json;
30661
30661
  }
30662
- /**
30663
- * 处理富文本 lineGap 兼容性
30664
- */ function processRichTextLineGapCompatibility(json) {
30665
- if (!json.components) {
30666
- return;
30667
- }
30668
- // 遍历所有组件,处理富文本组件
30669
- for(var _iterator = _create_for_of_iterator_helper_loose(json.components), _step; !(_step = _iterator()).done;){
30670
- var component = _step.value;
30671
- // 识别富文本组件并处理 lineGap 兼容性
30672
- if (component.dataType === DataType.RichTextComponent && component.options) {
30673
- ensureRichTextLineGap(component.options);
30662
+ function version35Migration(json) {
30663
+ // 处理富文本 lineGap 兼容性
30664
+ if (json.components) {
30665
+ // 遍历所有组件,处理富文本组件
30666
+ for(var _iterator = _create_for_of_iterator_helper_loose(json.components), _step; !(_step = _iterator()).done;){
30667
+ var component = _step.value;
30668
+ // 识别富文本组件并处理 lineGap 兼容性
30669
+ if (component.dataType === DataType.RichTextComponent) {
30670
+ var richTextComponent = component;
30671
+ if (richTextComponent.options) {
30672
+ // 检查是否已经处理过
30673
+ //@ts-expect-error
30674
+ if (richTextComponent.options.useLegacyRichText === undefined) {
30675
+ // 根据是否存在 lineGap 字段来判断版本
30676
+ if (richTextComponent.options.lineGap === undefined) {
30677
+ // 旧版本(没有 lineGap 字段)
30678
+ //@ts-expect-error
30679
+ richTextComponent.options.useLegacyRichText = true;
30680
+ } else {
30681
+ // 新版本(有 lineGap 字段)
30682
+ //@ts-expect-error
30683
+ richTextComponent.options.useLegacyRichText = false;
30684
+ }
30685
+ }
30686
+ }
30687
+ }
30674
30688
  }
30675
30689
  }
30676
- }
30677
- /**
30678
- * 确保富文本组件有版本标识字段
30679
- */ function ensureRichTextLineGap(options) {
30680
- // 检查是否已经处理过
30681
- if (!options || options.useLegacyRichText !== undefined) {
30682
- return;
30683
- }
30684
- // 根据是否存在 lineGap 字段来判断版本
30685
- if (options.lineGap === undefined) {
30686
- // 旧版本(没有 lineGap 字段)
30687
- options.useLegacyRichText = true;
30688
- } else {
30689
- // 新版本(有 lineGap 字段)
30690
- options.useLegacyRichText = false;
30691
- }
30690
+ //@ts-expect-error
30691
+ json.version = "3.6";
30692
+ return json;
30692
30693
  }
30693
30694
  /**
30694
30695
  * 根据形状获取形状几何体数据
@@ -31612,7 +31613,7 @@ function getStandardSpriteContent(sprite, transform) {
31612
31613
  return ret;
31613
31614
  }
31614
31615
 
31615
- var version$1 = "2.7.0-beta.0";
31616
+ var version$1 = "2.7.1";
31616
31617
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
31617
31618
  var standardVersion = /^(\d+)\.(\d+)$/;
31618
31619
  var reverseParticle = false;
@@ -31630,7 +31631,7 @@ function getStandardJSON(json) {
31630
31631
  if (v0.test(json.version)) {
31631
31632
  var _exec;
31632
31633
  reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
31633
- return version34Migration(version33Migration(version32Migration(version31Migration(version30Migration(version21Migration(getStandardJSONFromV0(json)))))));
31634
+ return version35Migration(version34Migration(version33Migration(version32Migration(version31Migration(version30Migration(version21Migration(getStandardJSONFromV0(json))))))));
31634
31635
  }
31635
31636
  reverseParticle = false;
31636
31637
  var vs = standardVersion.exec(json.version) || [];
@@ -31661,6 +31662,9 @@ function getStandardJSON(json) {
31661
31662
  if (minorVersion < 5) {
31662
31663
  json = version34Migration(json);
31663
31664
  }
31665
+ if (minorVersion < 6) {
31666
+ json = version35Migration(json);
31667
+ }
31664
31668
  }
31665
31669
  return json;
31666
31670
  }
@@ -34885,7 +34889,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
34885
34889
  registerPlugin("particle", ParticleLoader, exports.VFXItem);
34886
34890
  registerPlugin("cal", CalculateLoader, exports.VFXItem);
34887
34891
  registerPlugin("interact", InteractLoader, exports.VFXItem);
34888
- var version = "2.7.0-beta.0";
34892
+ var version = "2.7.1";
34889
34893
  logger.info("Core version: " + version + ".");
34890
34894
 
34891
34895
  exports.AbstractPlugin = AbstractPlugin;