@galacean/effects-core 1.2.0 → 1.2.2
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/asset-manager.d.ts +10 -2
- package/dist/composition.d.ts +2 -2
- package/dist/index.js +32 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -8
- package/dist/index.mjs.map +1 -1
- package/dist/render/render-pass.d.ts +1 -1
- package/dist/scene.d.ts +2 -2
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.mjs
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: v1.2.
|
|
6
|
+
* Version: v1.2.2
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/******************************************************************************
|
|
@@ -19968,9 +19968,10 @@ var TextItem = /** @class */ (function (_super) {
|
|
|
19968
19968
|
if (this.textStyle.fontSize === value) {
|
|
19969
19969
|
return;
|
|
19970
19970
|
}
|
|
19971
|
+
// 保证字号变化后位置正常
|
|
19972
|
+
var diff = this.textStyle.fontSize - value;
|
|
19973
|
+
this.textLayout.lineHeight += diff;
|
|
19971
19974
|
this.textStyle.fontSize = value;
|
|
19972
|
-
// 1.5175 = 31.43 / 20
|
|
19973
|
-
this.textLayout.lineHeight = this.textStyle.fontSize * 1.5175;
|
|
19974
19975
|
this.isDirty = true;
|
|
19975
19976
|
};
|
|
19976
19977
|
/**
|
|
@@ -23450,6 +23451,10 @@ var AssetManager = /** @class */ (function () {
|
|
|
23450
23451
|
*/
|
|
23451
23452
|
this.assets = {};
|
|
23452
23453
|
this.id = seed$1++;
|
|
23454
|
+
/**
|
|
23455
|
+
* 场景加载的超时定时器
|
|
23456
|
+
*/
|
|
23457
|
+
this.timers = [];
|
|
23453
23458
|
this.updateOptions(options);
|
|
23454
23459
|
}
|
|
23455
23460
|
AssetManager.prototype.updateOptions = function (options) {
|
|
@@ -23482,25 +23487,33 @@ var AssetManager = /** @class */ (function () {
|
|
|
23482
23487
|
compressedTexture = (_c = gpuInstance === null || gpuInstance === void 0 ? void 0 : gpuInstance.detail.compressedTexture) !== null && _c !== void 0 ? _c : 0;
|
|
23483
23488
|
cancelLoading = false;
|
|
23484
23489
|
waitPromise = new Promise(function (resolve, reject) {
|
|
23485
|
-
|
|
23490
|
+
loadTimer = window.setTimeout(function () {
|
|
23486
23491
|
cancelLoading = true;
|
|
23492
|
+
_this.removeTimer(loadTimer);
|
|
23487
23493
|
var totalTime = performance.now() - startTime;
|
|
23488
23494
|
reject("Load time out: totalTime: ".concat(totalTime.toFixed(4), "ms ").concat(timeInfos.join(' '), ", url: ").concat(assetUrl));
|
|
23489
23495
|
}, _this.timeout * 1000);
|
|
23496
|
+
_this.timers.push(loadTimer);
|
|
23490
23497
|
});
|
|
23491
23498
|
hookTimeInfo = function (label, func) { return __awaiter(_this, void 0, void 0, function () {
|
|
23492
|
-
var st, result;
|
|
23499
|
+
var st, result, e_1;
|
|
23493
23500
|
return __generator(this, function (_a) {
|
|
23494
23501
|
switch (_a.label) {
|
|
23495
23502
|
case 0:
|
|
23496
|
-
if (!!cancelLoading) return [3 /*break*/,
|
|
23503
|
+
if (!!cancelLoading) return [3 /*break*/, 4];
|
|
23497
23504
|
st = performance.now();
|
|
23498
|
-
|
|
23505
|
+
_a.label = 1;
|
|
23499
23506
|
case 1:
|
|
23507
|
+
_a.trys.push([1, 3, , 4]);
|
|
23508
|
+
return [4 /*yield*/, func()];
|
|
23509
|
+
case 2:
|
|
23500
23510
|
result = _a.sent();
|
|
23501
23511
|
timeInfos.push("[".concat(label, ": ").concat((performance.now() - st).toFixed(2), "]"));
|
|
23502
23512
|
return [2 /*return*/, result];
|
|
23503
|
-
case
|
|
23513
|
+
case 3:
|
|
23514
|
+
e_1 = _a.sent();
|
|
23515
|
+
throw new Error("load error in ".concat(label, ", ").concat(e_1));
|
|
23516
|
+
case 4: throw new Error('load canceled.');
|
|
23504
23517
|
}
|
|
23505
23518
|
});
|
|
23506
23519
|
}); };
|
|
@@ -23584,6 +23597,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23584
23597
|
totalTime = performance.now() - startTime;
|
|
23585
23598
|
logger.info("Load asset: totalTime: ".concat(totalTime.toFixed(4), "ms ").concat(timeInfos.join(' '), ", url: ").concat(assetUrl));
|
|
23586
23599
|
window.clearTimeout(loadTimer);
|
|
23600
|
+
this.removeTimer(loadTimer);
|
|
23587
23601
|
scene.totalTime = totalTime;
|
|
23588
23602
|
scene.startTime = startTime;
|
|
23589
23603
|
return [2 /*return*/, scene];
|
|
@@ -23892,16 +23906,26 @@ var AssetManager = /** @class */ (function () {
|
|
|
23892
23906
|
});
|
|
23893
23907
|
});
|
|
23894
23908
|
};
|
|
23909
|
+
AssetManager.prototype.removeTimer = function (id) {
|
|
23910
|
+
var index = this.timers.indexOf(id);
|
|
23911
|
+
if (index !== -1) {
|
|
23912
|
+
this.timers.splice(index, 1);
|
|
23913
|
+
}
|
|
23914
|
+
};
|
|
23895
23915
|
/**
|
|
23896
23916
|
* 销毁方法
|
|
23897
23917
|
*/
|
|
23898
23918
|
AssetManager.prototype.dispose = function () {
|
|
23899
23919
|
var _a;
|
|
23920
|
+
if (this.timers.length) {
|
|
23921
|
+
this.timers.map(function (id) { return window.clearTimeout(id); });
|
|
23922
|
+
}
|
|
23900
23923
|
for (var key in this.assets) {
|
|
23901
23924
|
var asset = this.assets[key];
|
|
23902
23925
|
(_a = asset === null || asset === void 0 ? void 0 : asset.dispose) === null || _a === void 0 ? void 0 : _a.call(asset);
|
|
23903
23926
|
}
|
|
23904
23927
|
this.assets = {};
|
|
23928
|
+
this.timers = [];
|
|
23905
23929
|
};
|
|
23906
23930
|
/**
|
|
23907
23931
|
* 自定义文本缓存,随页面销毁而销毁
|