@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/player.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Disposable,
|
|
1
|
+
import type { Disposable, LostHandler, RestoreHandler, SceneLoadOptions, SceneType, math, GPUCapability } from '@galacean/effects-core';
|
|
2
2
|
import { Ticker, Composition, Renderer } from '@galacean/effects-core';
|
|
3
3
|
/**
|
|
4
4
|
* `onItemClicked` 点击回调函数的传入参数
|
|
@@ -119,7 +119,6 @@ export interface PlayerConfig {
|
|
|
119
119
|
reportGPUTime?: (time: number) => void;
|
|
120
120
|
[key: string]: any;
|
|
121
121
|
}
|
|
122
|
-
export type SceneType = string | JSONValue | Scene;
|
|
123
122
|
export type SceneWithOptionsType = {
|
|
124
123
|
scene: SceneType;
|
|
125
124
|
options: SceneLoadOptions;
|
package/dist/weapp.js
CHANGED
|
@@ -19966,9 +19966,10 @@ var TextItem = /** @class */ (function (_super) {
|
|
|
19966
19966
|
if (this.textStyle.fontSize === value) {
|
|
19967
19967
|
return;
|
|
19968
19968
|
}
|
|
19969
|
+
// 保证字号变化后位置正常
|
|
19970
|
+
var diff = this.textStyle.fontSize - value;
|
|
19971
|
+
this.textLayout.lineHeight += diff;
|
|
19969
19972
|
this.textStyle.fontSize = value;
|
|
19970
|
-
// 1.5175 = 31.43 / 20
|
|
19971
|
-
this.textLayout.lineHeight = this.textStyle.fontSize * 1.5175;
|
|
19972
19973
|
this.isDirty = true;
|
|
19973
19974
|
};
|
|
19974
19975
|
/**
|
|
@@ -23448,6 +23449,10 @@ var AssetManager = /** @class */ (function () {
|
|
|
23448
23449
|
*/
|
|
23449
23450
|
this.assets = {};
|
|
23450
23451
|
this.id = seed$5++;
|
|
23452
|
+
/**
|
|
23453
|
+
* 场景加载的超时定时器
|
|
23454
|
+
*/
|
|
23455
|
+
this.timers = [];
|
|
23451
23456
|
this.updateOptions(options);
|
|
23452
23457
|
}
|
|
23453
23458
|
AssetManager.prototype.updateOptions = function (options) {
|
|
@@ -23480,25 +23485,33 @@ var AssetManager = /** @class */ (function () {
|
|
|
23480
23485
|
compressedTexture = (_c = gpuInstance === null || gpuInstance === void 0 ? void 0 : gpuInstance.detail.compressedTexture) !== null && _c !== void 0 ? _c : 0;
|
|
23481
23486
|
cancelLoading = false;
|
|
23482
23487
|
waitPromise = new Promise(function (resolve, reject) {
|
|
23483
|
-
|
|
23488
|
+
loadTimer = weapp.window.setTimeout(function () {
|
|
23484
23489
|
cancelLoading = true;
|
|
23490
|
+
_this.removeTimer(loadTimer);
|
|
23485
23491
|
var totalTime = weapp.performance.now() - startTime;
|
|
23486
23492
|
reject("Load time out: totalTime: ".concat(totalTime.toFixed(4), "ms ").concat(timeInfos.join(' '), ", url: ").concat(assetUrl));
|
|
23487
23493
|
}, _this.timeout * 1000);
|
|
23494
|
+
_this.timers.push(loadTimer);
|
|
23488
23495
|
});
|
|
23489
23496
|
hookTimeInfo = function (label, func) { return __awaiter(_this, void 0, void 0, function () {
|
|
23490
|
-
var st, result;
|
|
23497
|
+
var st, result, e_1;
|
|
23491
23498
|
return __generator(this, function (_a) {
|
|
23492
23499
|
switch (_a.label) {
|
|
23493
23500
|
case 0:
|
|
23494
|
-
if (!!cancelLoading) return [3 /*break*/,
|
|
23501
|
+
if (!!cancelLoading) return [3 /*break*/, 4];
|
|
23495
23502
|
st = weapp.performance.now();
|
|
23496
|
-
|
|
23503
|
+
_a.label = 1;
|
|
23497
23504
|
case 1:
|
|
23505
|
+
_a.trys.push([1, 3, , 4]);
|
|
23506
|
+
return [4 /*yield*/, func()];
|
|
23507
|
+
case 2:
|
|
23498
23508
|
result = _a.sent();
|
|
23499
23509
|
timeInfos.push("[".concat(label, ": ").concat((weapp.performance.now() - st).toFixed(2), "]"));
|
|
23500
23510
|
return [2 /*return*/, result];
|
|
23501
|
-
case
|
|
23511
|
+
case 3:
|
|
23512
|
+
e_1 = _a.sent();
|
|
23513
|
+
throw new Error("load error in ".concat(label, ", ").concat(e_1));
|
|
23514
|
+
case 4: throw new Error('load canceled.');
|
|
23502
23515
|
}
|
|
23503
23516
|
});
|
|
23504
23517
|
}); };
|
|
@@ -23582,6 +23595,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23582
23595
|
totalTime = weapp.performance.now() - startTime;
|
|
23583
23596
|
logger.info("Load asset: totalTime: ".concat(totalTime.toFixed(4), "ms ").concat(timeInfos.join(' '), ", url: ").concat(assetUrl));
|
|
23584
23597
|
weapp.window.clearTimeout(loadTimer);
|
|
23598
|
+
this.removeTimer(loadTimer);
|
|
23585
23599
|
scene.totalTime = totalTime;
|
|
23586
23600
|
scene.startTime = startTime;
|
|
23587
23601
|
return [2 /*return*/, scene];
|
|
@@ -23890,16 +23904,26 @@ var AssetManager = /** @class */ (function () {
|
|
|
23890
23904
|
});
|
|
23891
23905
|
});
|
|
23892
23906
|
};
|
|
23907
|
+
AssetManager.prototype.removeTimer = function (id) {
|
|
23908
|
+
var index = this.timers.indexOf(id);
|
|
23909
|
+
if (index !== -1) {
|
|
23910
|
+
this.timers.splice(index, 1);
|
|
23911
|
+
}
|
|
23912
|
+
};
|
|
23893
23913
|
/**
|
|
23894
23914
|
* 销毁方法
|
|
23895
23915
|
*/
|
|
23896
23916
|
AssetManager.prototype.dispose = function () {
|
|
23897
23917
|
var _a;
|
|
23918
|
+
if (this.timers.length) {
|
|
23919
|
+
this.timers.map(function (id) { return weapp.window.clearTimeout(id); });
|
|
23920
|
+
}
|
|
23898
23921
|
for (var key in this.assets) {
|
|
23899
23922
|
var asset = this.assets[key];
|
|
23900
23923
|
(_a = asset === null || asset === void 0 ? void 0 : asset.dispose) === null || _a === void 0 ? void 0 : _a.call(asset);
|
|
23901
23924
|
}
|
|
23902
23925
|
this.assets = {};
|
|
23926
|
+
this.timers = [];
|
|
23903
23927
|
};
|
|
23904
23928
|
/**
|
|
23905
23929
|
* 自定义文本缓存,随页面销毁而销毁
|
|
@@ -29853,6 +29877,10 @@ var Player = /** @class */ (function () {
|
|
|
29853
29877
|
return [4 /*yield*/, this.assetManager.loadScene(source, this.renderer, { env: this.env })];
|
|
29854
29878
|
case 1:
|
|
29855
29879
|
scene = _a.sent();
|
|
29880
|
+
// 加载期间 player 销毁
|
|
29881
|
+
if (this.disposed) {
|
|
29882
|
+
throw new Error('Disposed player can not used to create Composition');
|
|
29883
|
+
}
|
|
29856
29884
|
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);
|
|
29857
29885
|
if (this.ticker) {
|
|
29858
29886
|
if (composition.renderLevel === RenderLevel$1.B) {
|
|
@@ -30211,6 +30239,10 @@ var Player = /** @class */ (function () {
|
|
|
30211
30239
|
this.resize = throwErrorFunc;
|
|
30212
30240
|
this.loadScene = throwErrorPromiseFunc;
|
|
30213
30241
|
this.play = throwErrorPromiseFunc;
|
|
30242
|
+
this.gotoAndPlay = throwErrorPromiseFunc;
|
|
30243
|
+
this.gotoAndStop = throwErrorPromiseFunc;
|
|
30244
|
+
this.playSequence = throwErrorFunc;
|
|
30245
|
+
this.destroyCurrentCompositions = throwErrorFunc;
|
|
30214
30246
|
this.resume = throwErrorPromiseFunc;
|
|
30215
30247
|
this.disposed = true;
|
|
30216
30248
|
};
|
|
@@ -30256,7 +30288,7 @@ var Player = /** @class */ (function () {
|
|
|
30256
30288
|
}());
|
|
30257
30289
|
function isSceneWithOptions(scene) {
|
|
30258
30290
|
// TODO: 判断不太优雅,后期试情况优化
|
|
30259
|
-
return isObject(scene) && 'scene' in scene;
|
|
30291
|
+
return isObject(scene) && 'scene' in scene && 'options' in scene;
|
|
30260
30292
|
}
|
|
30261
30293
|
/**
|
|
30262
30294
|
* 禁止/允许创建新的播放器,已创建的不受影响
|
|
@@ -30386,7 +30418,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
30386
30418
|
Engine.create = function (gl) {
|
|
30387
30419
|
return new GLEngine(gl);
|
|
30388
30420
|
};
|
|
30389
|
-
var version = "1.2.
|
|
30421
|
+
var version = "1.2.2";
|
|
30390
30422
|
logger.info('player version: ' + version);
|
|
30391
30423
|
|
|
30392
30424
|
exports.AbstractPlugin = AbstractPlugin;
|