@galacean/effects-threejs 1.2.1 → 1.2.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/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v1.2.1
6
+ * Version: v1.2.3
7
7
  */
8
8
 
9
9
  'use strict';
@@ -19994,9 +19994,10 @@ var TextItem = /** @class */ (function (_super) {
19994
19994
  if (this.textStyle.fontSize === value) {
19995
19995
  return;
19996
19996
  }
19997
+ // 保证字号变化后位置正常
19998
+ var diff = this.textStyle.fontSize - value;
19999
+ this.textLayout.lineHeight += diff;
19997
20000
  this.textStyle.fontSize = value;
19998
- // 1.5175 = 31.43 / 20
19999
- this.textLayout.lineHeight = this.textStyle.fontSize * 1.5175;
20000
20001
  this.isDirty = true;
20001
20002
  };
20002
20003
  /**
@@ -23491,6 +23492,26 @@ var AssetManager = /** @class */ (function () {
23491
23492
  var _a = options.timeout, timeout = _a === void 0 ? 10 : _a;
23492
23493
  this.timeout = timeout;
23493
23494
  };
23495
+ /**
23496
+ * 根据用户传入的参数修改场景数据
23497
+ */
23498
+ AssetManager.prototype.updateSceneData = function (compositions) {
23499
+ var variables = this.options.variables;
23500
+ if (!variables || Object.keys(variables).length <= 0) {
23501
+ return compositions;
23502
+ }
23503
+ compositions.forEach(function (composition) {
23504
+ composition.items.forEach(function (item) {
23505
+ if (item.type === ItemType$1.text) {
23506
+ var textVariable = variables[item.name];
23507
+ if (textVariable) {
23508
+ item.content.options.text = textVariable;
23509
+ }
23510
+ }
23511
+ });
23512
+ });
23513
+ return compositions;
23514
+ };
23494
23515
  /**
23495
23516
  * 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
23496
23517
  * @param url - json 的 URL 链接或者 json 对象
@@ -23582,6 +23603,7 @@ var AssetManager = /** @class */ (function () {
23582
23603
  for (i = 0; i < scene.images.length; i++) {
23583
23604
  scene.textureOptions[i].image = scene.images[i];
23584
23605
  }
23606
+ scene.jsonScene.compositions = this.updateSceneData(scene.jsonScene.compositions);
23585
23607
  _e.label = 5;
23586
23608
  case 5: return [3 /*break*/, 12];
23587
23609
  case 6: return [4 /*yield*/, hookTimeInfo('processJSON', function () { return _this.processJSON(rawJSON); })];
@@ -23601,6 +23623,7 @@ var AssetManager = /** @class */ (function () {
23601
23623
  return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(loadedImages_1, loadedBins_1, jsonScene_1); })];
23602
23624
  case 10:
23603
23625
  loadedTextures = _e.sent();
23626
+ jsonScene_1.compositions = this.updateSceneData(jsonScene_1.compositions);
23604
23627
  scene = {
23605
23628
  url: url,
23606
23629
  renderLevel: this.options.renderLevel,
@@ -26912,7 +26935,7 @@ Geometry.create = function (engine, options) {
26912
26935
  Mesh.create = function (engine, props) {
26913
26936
  return new ThreeMesh(engine, props);
26914
26937
  };
26915
- var version = "1.2.1";
26938
+ var version = "1.2.3";
26916
26939
  logger.info('THREEJS plugin version: ' + version);
26917
26940
 
26918
26941
  exports.AbstractPlugin = AbstractPlugin;