@galacean/effects 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/index.js +42 -10
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +42 -10
- package/dist/index.mjs.map +1 -1
- package/dist/player.d.ts +1 -2
- package/dist/weapp.js +41 -9
- package/dist/weapp.js.map +1 -1
- package/dist/weapp.mjs +41 -9
- 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.2
|
|
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
|
/**
|
|
@@ -23454,6 +23455,10 @@ var AssetManager = /** @class */ (function () {
|
|
|
23454
23455
|
*/
|
|
23455
23456
|
this.assets = {};
|
|
23456
23457
|
this.id = seed$5++;
|
|
23458
|
+
/**
|
|
23459
|
+
* 场景加载的超时定时器
|
|
23460
|
+
*/
|
|
23461
|
+
this.timers = [];
|
|
23457
23462
|
this.updateOptions(options);
|
|
23458
23463
|
}
|
|
23459
23464
|
AssetManager.prototype.updateOptions = function (options) {
|
|
@@ -23486,25 +23491,33 @@ var AssetManager = /** @class */ (function () {
|
|
|
23486
23491
|
compressedTexture = (_c = gpuInstance === null || gpuInstance === void 0 ? void 0 : gpuInstance.detail.compressedTexture) !== null && _c !== void 0 ? _c : 0;
|
|
23487
23492
|
cancelLoading = false;
|
|
23488
23493
|
waitPromise = new Promise(function (resolve, reject) {
|
|
23489
|
-
|
|
23494
|
+
loadTimer = window.setTimeout(function () {
|
|
23490
23495
|
cancelLoading = true;
|
|
23496
|
+
_this.removeTimer(loadTimer);
|
|
23491
23497
|
var totalTime = performance.now() - startTime;
|
|
23492
23498
|
reject("Load time out: totalTime: ".concat(totalTime.toFixed(4), "ms ").concat(timeInfos.join(' '), ", url: ").concat(assetUrl));
|
|
23493
23499
|
}, _this.timeout * 1000);
|
|
23500
|
+
_this.timers.push(loadTimer);
|
|
23494
23501
|
});
|
|
23495
23502
|
hookTimeInfo = function (label, func) { return __awaiter(_this, void 0, void 0, function () {
|
|
23496
|
-
var st, result;
|
|
23503
|
+
var st, result, e_1;
|
|
23497
23504
|
return __generator(this, function (_a) {
|
|
23498
23505
|
switch (_a.label) {
|
|
23499
23506
|
case 0:
|
|
23500
|
-
if (!!cancelLoading) return [3 /*break*/,
|
|
23507
|
+
if (!!cancelLoading) return [3 /*break*/, 4];
|
|
23501
23508
|
st = performance.now();
|
|
23502
|
-
|
|
23509
|
+
_a.label = 1;
|
|
23503
23510
|
case 1:
|
|
23511
|
+
_a.trys.push([1, 3, , 4]);
|
|
23512
|
+
return [4 /*yield*/, func()];
|
|
23513
|
+
case 2:
|
|
23504
23514
|
result = _a.sent();
|
|
23505
23515
|
timeInfos.push("[".concat(label, ": ").concat((performance.now() - st).toFixed(2), "]"));
|
|
23506
23516
|
return [2 /*return*/, result];
|
|
23507
|
-
case
|
|
23517
|
+
case 3:
|
|
23518
|
+
e_1 = _a.sent();
|
|
23519
|
+
throw new Error("load error in ".concat(label, ", ").concat(e_1));
|
|
23520
|
+
case 4: throw new Error('load canceled.');
|
|
23508
23521
|
}
|
|
23509
23522
|
});
|
|
23510
23523
|
}); };
|
|
@@ -23588,6 +23601,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23588
23601
|
totalTime = performance.now() - startTime;
|
|
23589
23602
|
logger.info("Load asset: totalTime: ".concat(totalTime.toFixed(4), "ms ").concat(timeInfos.join(' '), ", url: ").concat(assetUrl));
|
|
23590
23603
|
window.clearTimeout(loadTimer);
|
|
23604
|
+
this.removeTimer(loadTimer);
|
|
23591
23605
|
scene.totalTime = totalTime;
|
|
23592
23606
|
scene.startTime = startTime;
|
|
23593
23607
|
return [2 /*return*/, scene];
|
|
@@ -23896,16 +23910,26 @@ var AssetManager = /** @class */ (function () {
|
|
|
23896
23910
|
});
|
|
23897
23911
|
});
|
|
23898
23912
|
};
|
|
23913
|
+
AssetManager.prototype.removeTimer = function (id) {
|
|
23914
|
+
var index = this.timers.indexOf(id);
|
|
23915
|
+
if (index !== -1) {
|
|
23916
|
+
this.timers.splice(index, 1);
|
|
23917
|
+
}
|
|
23918
|
+
};
|
|
23899
23919
|
/**
|
|
23900
23920
|
* 销毁方法
|
|
23901
23921
|
*/
|
|
23902
23922
|
AssetManager.prototype.dispose = function () {
|
|
23903
23923
|
var _a;
|
|
23924
|
+
if (this.timers.length) {
|
|
23925
|
+
this.timers.map(function (id) { return window.clearTimeout(id); });
|
|
23926
|
+
}
|
|
23904
23927
|
for (var key in this.assets) {
|
|
23905
23928
|
var asset = this.assets[key];
|
|
23906
23929
|
(_a = asset === null || asset === void 0 ? void 0 : asset.dispose) === null || _a === void 0 ? void 0 : _a.call(asset);
|
|
23907
23930
|
}
|
|
23908
23931
|
this.assets = {};
|
|
23932
|
+
this.timers = [];
|
|
23909
23933
|
};
|
|
23910
23934
|
/**
|
|
23911
23935
|
* 自定义文本缓存,随页面销毁而销毁
|
|
@@ -29859,6 +29883,10 @@ var Player = /** @class */ (function () {
|
|
|
29859
29883
|
return [4 /*yield*/, this.assetManager.loadScene(source, this.renderer, { env: this.env })];
|
|
29860
29884
|
case 1:
|
|
29861
29885
|
scene = _a.sent();
|
|
29886
|
+
// 加载期间 player 销毁
|
|
29887
|
+
if (this.disposed) {
|
|
29888
|
+
throw new Error('Disposed player can not used to create Composition');
|
|
29889
|
+
}
|
|
29862
29890
|
composition = new Composition(__assign$1(__assign$1({}, opts), { renderer: renderer, width: renderer.getWidth(), height: renderer.getHeight(), event: this.event, onPlayerPause: this.handlePlayerPause, onMessageItem: this.handleMessageItem }), scene);
|
|
29863
29891
|
if (this.ticker) {
|
|
29864
29892
|
if (composition.renderLevel === RenderLevel$1.B) {
|
|
@@ -30217,6 +30245,10 @@ var Player = /** @class */ (function () {
|
|
|
30217
30245
|
this.resize = throwErrorFunc;
|
|
30218
30246
|
this.loadScene = throwErrorPromiseFunc;
|
|
30219
30247
|
this.play = throwErrorPromiseFunc;
|
|
30248
|
+
this.gotoAndPlay = throwErrorPromiseFunc;
|
|
30249
|
+
this.gotoAndStop = throwErrorPromiseFunc;
|
|
30250
|
+
this.playSequence = throwErrorFunc;
|
|
30251
|
+
this.destroyCurrentCompositions = throwErrorFunc;
|
|
30220
30252
|
this.resume = throwErrorPromiseFunc;
|
|
30221
30253
|
this.disposed = true;
|
|
30222
30254
|
};
|
|
@@ -30262,7 +30294,7 @@ var Player = /** @class */ (function () {
|
|
|
30262
30294
|
}());
|
|
30263
30295
|
function isSceneWithOptions(scene) {
|
|
30264
30296
|
// TODO: 判断不太优雅,后期试情况优化
|
|
30265
|
-
return isObject(scene) && 'scene' in scene;
|
|
30297
|
+
return isObject(scene) && 'scene' in scene && 'options' in scene;
|
|
30266
30298
|
}
|
|
30267
30299
|
/**
|
|
30268
30300
|
* 禁止/允许创建新的播放器,已创建的不受影响
|
|
@@ -30392,7 +30424,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
30392
30424
|
Engine.create = function (gl) {
|
|
30393
30425
|
return new GLEngine(gl);
|
|
30394
30426
|
};
|
|
30395
|
-
var version = "1.2.
|
|
30427
|
+
var version = "1.2.2";
|
|
30396
30428
|
logger.info('player version: ' + version);
|
|
30397
30429
|
|
|
30398
30430
|
exports.AbstractPlugin = AbstractPlugin;
|