@galacean/effects 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 +28 -5
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +3 -3
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +28 -5
- package/dist/index.mjs.map +1 -1
- package/dist/player.d.ts +1 -2
- package/dist/weapp.js +27 -4
- package/dist/weapp.js.map +1 -1
- package/dist/weapp.mjs +27 -4
- package/dist/weapp.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime player for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v1.2.
|
|
6
|
+
* Version: v1.2.3
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -19972,9 +19972,10 @@ var TextItem = /** @class */ (function (_super) {
|
|
|
19972
19972
|
if (this.textStyle.fontSize === value) {
|
|
19973
19973
|
return;
|
|
19974
19974
|
}
|
|
19975
|
+
// 保证字号变化后位置正常
|
|
19976
|
+
var diff = this.textStyle.fontSize - value;
|
|
19977
|
+
this.textLayout.lineHeight += diff;
|
|
19975
19978
|
this.textStyle.fontSize = value;
|
|
19976
|
-
// 1.5175 = 31.43 / 20
|
|
19977
|
-
this.textLayout.lineHeight = this.textStyle.fontSize * 1.5175;
|
|
19978
19979
|
this.isDirty = true;
|
|
19979
19980
|
};
|
|
19980
19981
|
/**
|
|
@@ -23469,6 +23470,26 @@ var AssetManager = /** @class */ (function () {
|
|
|
23469
23470
|
var _a = options.timeout, timeout = _a === void 0 ? 10 : _a;
|
|
23470
23471
|
this.timeout = timeout;
|
|
23471
23472
|
};
|
|
23473
|
+
/**
|
|
23474
|
+
* 根据用户传入的参数修改场景数据
|
|
23475
|
+
*/
|
|
23476
|
+
AssetManager.prototype.updateSceneData = function (compositions) {
|
|
23477
|
+
var variables = this.options.variables;
|
|
23478
|
+
if (!variables || Object.keys(variables).length <= 0) {
|
|
23479
|
+
return compositions;
|
|
23480
|
+
}
|
|
23481
|
+
compositions.forEach(function (composition) {
|
|
23482
|
+
composition.items.forEach(function (item) {
|
|
23483
|
+
if (item.type === ItemType$1.text) {
|
|
23484
|
+
var textVariable = variables[item.name];
|
|
23485
|
+
if (textVariable) {
|
|
23486
|
+
item.content.options.text = textVariable;
|
|
23487
|
+
}
|
|
23488
|
+
}
|
|
23489
|
+
});
|
|
23490
|
+
});
|
|
23491
|
+
return compositions;
|
|
23492
|
+
};
|
|
23472
23493
|
/**
|
|
23473
23494
|
* 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
|
|
23474
23495
|
* @param url - json 的 URL 链接或者 json 对象
|
|
@@ -23560,6 +23581,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23560
23581
|
for (i = 0; i < scene.images.length; i++) {
|
|
23561
23582
|
scene.textureOptions[i].image = scene.images[i];
|
|
23562
23583
|
}
|
|
23584
|
+
scene.jsonScene.compositions = this.updateSceneData(scene.jsonScene.compositions);
|
|
23563
23585
|
_e.label = 5;
|
|
23564
23586
|
case 5: return [3 /*break*/, 12];
|
|
23565
23587
|
case 6: return [4 /*yield*/, hookTimeInfo('processJSON', function () { return _this.processJSON(rawJSON); })];
|
|
@@ -23579,6 +23601,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23579
23601
|
return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(loadedImages_1, loadedBins_1, jsonScene_1); })];
|
|
23580
23602
|
case 10:
|
|
23581
23603
|
loadedTextures = _e.sent();
|
|
23604
|
+
jsonScene_1.compositions = this.updateSceneData(jsonScene_1.compositions);
|
|
23582
23605
|
scene = {
|
|
23583
23606
|
url: url,
|
|
23584
23607
|
renderLevel: this.options.renderLevel,
|
|
@@ -30293,7 +30316,7 @@ var Player = /** @class */ (function () {
|
|
|
30293
30316
|
}());
|
|
30294
30317
|
function isSceneWithOptions(scene) {
|
|
30295
30318
|
// TODO: 判断不太优雅,后期试情况优化
|
|
30296
|
-
return isObject(scene) && 'scene' in scene;
|
|
30319
|
+
return isObject(scene) && 'scene' in scene && 'options' in scene;
|
|
30297
30320
|
}
|
|
30298
30321
|
/**
|
|
30299
30322
|
* 禁止/允许创建新的播放器,已创建的不受影响
|
|
@@ -30423,7 +30446,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
30423
30446
|
Engine.create = function (gl) {
|
|
30424
30447
|
return new GLEngine(gl);
|
|
30425
30448
|
};
|
|
30426
|
-
var version = "1.2.
|
|
30449
|
+
var version = "1.2.3";
|
|
30427
30450
|
logger.info('player version: ' + version);
|
|
30428
30451
|
|
|
30429
30452
|
exports.AbstractPlugin = AbstractPlugin;
|