@galacean/effects 1.2.3 → 1.2.5
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 +34 -26
- 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 +34 -26
- package/dist/index.mjs.map +1 -1
- package/dist/player.d.ts +1 -1
- package/dist/weapp.js +33 -25
- package/dist/weapp.js.map +1 -1
- package/dist/weapp.mjs +33 -25
- 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.5
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -9247,10 +9247,10 @@ var VFXItem = /** @class */ (function () {
|
|
|
9247
9247
|
};
|
|
9248
9248
|
VFXItem.prototype.translateByPixel = function (x, y) {
|
|
9249
9249
|
if (this.composition) {
|
|
9250
|
+
// @ts-expect-error
|
|
9251
|
+
var _a = this.composition.renderer.canvas.getBoundingClientRect(), width = _a.width, height = _a.height;
|
|
9250
9252
|
var z = this.transform.getWorldPosition().z;
|
|
9251
|
-
var
|
|
9252
|
-
var width = this.composition.renderer.getWidth() / 2;
|
|
9253
|
-
var height = this.composition.renderer.getHeight() / 2;
|
|
9253
|
+
var _b = this.composition.camera.getInverseVPRatio(z), rx = _b.x, ry = _b.y;
|
|
9254
9254
|
this.transform.translate(2 * x * rx / width, -2 * y * ry / height, 0);
|
|
9255
9255
|
}
|
|
9256
9256
|
};
|
|
@@ -13146,9 +13146,13 @@ var InteractVFXItem = /** @class */ (function (_super) {
|
|
|
13146
13146
|
this.handleDragMove(this.dragEvent, this.bouncingArg);
|
|
13147
13147
|
}
|
|
13148
13148
|
};
|
|
13149
|
-
InteractVFXItem.prototype.
|
|
13149
|
+
InteractVFXItem.prototype.onEnd = function () {
|
|
13150
|
+
if (this.composition) {
|
|
13151
|
+
this.composition.removeInteractiveItem(this, this.ui.options.type);
|
|
13152
|
+
}
|
|
13153
|
+
};
|
|
13154
|
+
InteractVFXItem.prototype.onItemRemoved = function () {
|
|
13150
13155
|
var _a;
|
|
13151
|
-
composition.removeInteractiveItem(this, this.ui.options.type);
|
|
13152
13156
|
this.clickable = false;
|
|
13153
13157
|
(_a = this.previewContent) === null || _a === void 0 ? void 0 : _a.mesh.dispose();
|
|
13154
13158
|
this.endDragTarget();
|
|
@@ -21356,8 +21360,9 @@ var Camera = /** @class */ (function () {
|
|
|
21356
21360
|
Camera.prototype.getInverseVPRatio = function (z) {
|
|
21357
21361
|
var pos = new Vector3(0, 0, z);
|
|
21358
21362
|
var mat = this.getViewProjectionMatrix();
|
|
21359
|
-
var
|
|
21360
|
-
|
|
21363
|
+
var inverseVP = this.getInverseViewProjectionMatrix();
|
|
21364
|
+
var nz = mat.projectPoint(pos).z;
|
|
21365
|
+
return inverseVP.projectPoint(new Vector3(1, 1, nz));
|
|
21361
21366
|
};
|
|
21362
21367
|
/**
|
|
21363
21368
|
* 设置相机的旋转四元数
|
|
@@ -21369,7 +21374,6 @@ var Camera = /** @class */ (function () {
|
|
|
21369
21374
|
this.dirty = true;
|
|
21370
21375
|
}
|
|
21371
21376
|
else {
|
|
21372
|
-
this.options.quat;
|
|
21373
21377
|
if (!this.options.quat.equals(value)) {
|
|
21374
21378
|
this.options.quat.copyFrom(value);
|
|
21375
21379
|
this.dirty = true;
|
|
@@ -23701,16 +23705,17 @@ var AssetManager = /** @class */ (function () {
|
|
|
23701
23705
|
};
|
|
23702
23706
|
AssetManager.prototype.processBins = function (bins) {
|
|
23703
23707
|
return __awaiter(this, void 0, void 0, function () {
|
|
23704
|
-
var renderLevel, jobs;
|
|
23708
|
+
var renderLevel, baseUrl, jobs;
|
|
23705
23709
|
var _this = this;
|
|
23706
23710
|
return __generator(this, function (_a) {
|
|
23707
23711
|
renderLevel = this.options.renderLevel;
|
|
23712
|
+
baseUrl = this.baseUrl;
|
|
23708
23713
|
jobs = bins.map(function (bin) {
|
|
23709
23714
|
if (bin instanceof ArrayBuffer) {
|
|
23710
23715
|
return bin;
|
|
23711
23716
|
}
|
|
23712
23717
|
if (passRenderLevel(bin.renderLevel, renderLevel)) {
|
|
23713
|
-
return _this.loadBins(bin.url);
|
|
23718
|
+
return _this.loadBins(new URL(bin.url, baseUrl).href);
|
|
23714
23719
|
}
|
|
23715
23720
|
throw new Error("Invalid bins source: ".concat(JSON.stringify(bins)));
|
|
23716
23721
|
});
|
|
@@ -23728,13 +23733,14 @@ var AssetManager = /** @class */ (function () {
|
|
|
23728
23733
|
return [2 /*return*/];
|
|
23729
23734
|
}
|
|
23730
23735
|
jobs = fonts.map(function (font) { return __awaiter(_this, void 0, void 0, function () {
|
|
23731
|
-
var fontFace;
|
|
23736
|
+
var url, fontFace;
|
|
23732
23737
|
var _a;
|
|
23733
23738
|
return __generator(this, function (_b) {
|
|
23734
23739
|
switch (_b.label) {
|
|
23735
23740
|
case 0:
|
|
23736
23741
|
if (!(font.fontURL && !AssetManager.fonts.has(font.fontFamily))) return [3 /*break*/, 4];
|
|
23737
|
-
|
|
23742
|
+
url = new URL(font.fontURL, this.baseUrl).href;
|
|
23743
|
+
fontFace = new FontFace((_a = font.fontFamily) !== null && _a !== void 0 ? _a : '', 'url(' + url + ')');
|
|
23738
23744
|
_b.label = 1;
|
|
23739
23745
|
case 1:
|
|
23740
23746
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -23747,7 +23753,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23747
23753
|
return [3 /*break*/, 4];
|
|
23748
23754
|
case 3:
|
|
23749
23755
|
_b.sent();
|
|
23750
|
-
logger.warn("Invalid fonts source: ".concat(JSON.stringify(
|
|
23756
|
+
logger.warn("Invalid fonts source: ".concat(JSON.stringify(url)));
|
|
23751
23757
|
return [3 /*break*/, 4];
|
|
23752
23758
|
case 4: return [2 /*return*/];
|
|
23753
23759
|
}
|
|
@@ -23979,7 +23985,7 @@ function createTextureOptionsBySource(image, sourceFrom) {
|
|
|
23979
23985
|
return image.source;
|
|
23980
23986
|
}
|
|
23981
23987
|
else if (image instanceof HTMLImageElement ||
|
|
23982
|
-
image
|
|
23988
|
+
isCanvas(image)) {
|
|
23983
23989
|
return {
|
|
23984
23990
|
image: image,
|
|
23985
23991
|
sourceType: exports.TextureSourceType.image,
|
|
@@ -24016,6 +24022,11 @@ function createTextureOptionsBySource(image, sourceFrom) {
|
|
|
24016
24022
|
}
|
|
24017
24023
|
throw new Error('Invalid texture options');
|
|
24018
24024
|
}
|
|
24025
|
+
function isCanvas(cavnas) {
|
|
24026
|
+
var _a;
|
|
24027
|
+
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
24028
|
+
return typeof cavnas === 'object' && cavnas !== null && ((_a = cavnas.tagName) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'CANVAS';
|
|
24029
|
+
}
|
|
24019
24030
|
|
|
24020
24031
|
var CompVFXItem = /** @class */ (function (_super) {
|
|
24021
24032
|
__extends(CompVFXItem, _super);
|
|
@@ -29599,6 +29610,7 @@ var Player = /** @class */ (function () {
|
|
|
29599
29610
|
this.displayScale = 1;
|
|
29600
29611
|
this.resumePending = false;
|
|
29601
29612
|
this.disposed = false;
|
|
29613
|
+
this.assetManagers = [];
|
|
29602
29614
|
this.speed = 1;
|
|
29603
29615
|
this.baseCompositionIndex = 0;
|
|
29604
29616
|
/**
|
|
@@ -29881,7 +29893,7 @@ var Player = /** @class */ (function () {
|
|
|
29881
29893
|
Player.prototype.createComposition = function (url, options) {
|
|
29882
29894
|
if (options === void 0) { options = {}; }
|
|
29883
29895
|
return __awaiter(this, void 0, void 0, function () {
|
|
29884
|
-
var renderer, last, opts, source, scene, composition, firstFrameTime;
|
|
29896
|
+
var renderer, last, opts, source, assetManager, scene, composition, firstFrameTime;
|
|
29885
29897
|
var _this = this;
|
|
29886
29898
|
return __generator(this, function (_a) {
|
|
29887
29899
|
switch (_a.label) {
|
|
@@ -29896,13 +29908,9 @@ var Player = /** @class */ (function () {
|
|
|
29896
29908
|
else {
|
|
29897
29909
|
source = url;
|
|
29898
29910
|
}
|
|
29899
|
-
|
|
29900
|
-
|
|
29901
|
-
}
|
|
29902
|
-
else {
|
|
29903
|
-
this.assetManager = new AssetManager(opts);
|
|
29904
|
-
}
|
|
29905
|
-
return [4 /*yield*/, this.assetManager.loadScene(source, this.renderer, { env: this.env })];
|
|
29911
|
+
assetManager = new AssetManager(opts);
|
|
29912
|
+
this.assetManagers.push(assetManager);
|
|
29913
|
+
return [4 /*yield*/, assetManager.loadScene(source, this.renderer, { env: this.env })];
|
|
29906
29914
|
case 1:
|
|
29907
29915
|
scene = _a.sent();
|
|
29908
29916
|
// 加载期间 player 销毁
|
|
@@ -30232,7 +30240,7 @@ var Player = /** @class */ (function () {
|
|
|
30232
30240
|
* @param keepCanvas - 是否保留 canvas 画面,默认不保留,canvas 不能再被使用
|
|
30233
30241
|
*/
|
|
30234
30242
|
Player.prototype.dispose = function (keepCanvas) {
|
|
30235
|
-
var _a
|
|
30243
|
+
var _a;
|
|
30236
30244
|
logger.info("call player destroy: ".concat(this.name));
|
|
30237
30245
|
if (this.disposed) {
|
|
30238
30246
|
return;
|
|
@@ -30240,7 +30248,7 @@ var Player = /** @class */ (function () {
|
|
|
30240
30248
|
playerMap.delete(this.canvas);
|
|
30241
30249
|
this.pause();
|
|
30242
30250
|
(_a = this.ticker) === null || _a === void 0 ? void 0 : _a.stop();
|
|
30243
|
-
(
|
|
30251
|
+
this.assetManagers.forEach(function (assetManager) { return assetManager.dispose(); });
|
|
30244
30252
|
this.compositions.forEach(function (comp) { return comp.dispose(); });
|
|
30245
30253
|
this.compositions.length = 0;
|
|
30246
30254
|
this.renderer.context.removeLostHandler({ lost: this.lost });
|
|
@@ -30446,7 +30454,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
30446
30454
|
Engine.create = function (gl) {
|
|
30447
30455
|
return new GLEngine(gl);
|
|
30448
30456
|
};
|
|
30449
|
-
var version = "1.2.
|
|
30457
|
+
var version = "1.2.5";
|
|
30450
30458
|
logger.info('player version: ' + version);
|
|
30451
30459
|
|
|
30452
30460
|
exports.AbstractPlugin = AbstractPlugin;
|