@galacean/effects-core 1.3.0-alpha.0 → 1.3.0-alpha.1
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 +31 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -19
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/interact/interact-vfx-item.d.ts +2 -1
- package/dist/semantic-map.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.js
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.3.0-alpha.
|
|
6
|
+
* Version: v1.3.0-alpha.1
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -686,7 +686,7 @@ function asserts(condition, msg) {
|
|
|
686
686
|
* Name: @galacean/effects-specification
|
|
687
687
|
* Description: Galacean Effects JSON Specification
|
|
688
688
|
* Author: Ant Group CO., Ltd.
|
|
689
|
-
* Version: v1.1.0-alpha.
|
|
689
|
+
* Version: v1.1.0-alpha.1
|
|
690
690
|
*/
|
|
691
691
|
|
|
692
692
|
/*********************************************/
|
|
@@ -9258,10 +9258,10 @@ var VFXItem = /** @class */ (function () {
|
|
|
9258
9258
|
};
|
|
9259
9259
|
VFXItem.prototype.translateByPixel = function (x, y) {
|
|
9260
9260
|
if (this.composition) {
|
|
9261
|
+
// @ts-expect-error
|
|
9262
|
+
var _a = this.composition.renderer.canvas.getBoundingClientRect(), width = _a.width, height = _a.height;
|
|
9261
9263
|
var z = this.transform.getWorldPosition().z;
|
|
9262
|
-
var
|
|
9263
|
-
var width = this.composition.renderer.getWidth() / 2;
|
|
9264
|
-
var height = this.composition.renderer.getHeight() / 2;
|
|
9264
|
+
var _b = this.composition.camera.getInverseVPRatio(z), rx = _b.x, ry = _b.y;
|
|
9265
9265
|
this.transform.translate(2 * x * rx / width, -2 * y * ry / height, 0);
|
|
9266
9266
|
}
|
|
9267
9267
|
};
|
|
@@ -13152,9 +13152,13 @@ var InteractVFXItem = /** @class */ (function (_super) {
|
|
|
13152
13152
|
this.handleDragMove(this.dragEvent, this.bouncingArg);
|
|
13153
13153
|
}
|
|
13154
13154
|
};
|
|
13155
|
-
InteractVFXItem.prototype.
|
|
13155
|
+
InteractVFXItem.prototype.onEnd = function () {
|
|
13156
|
+
if (this.composition) {
|
|
13157
|
+
this.composition.removeInteractiveItem(this, this.ui.options.type);
|
|
13158
|
+
}
|
|
13159
|
+
};
|
|
13160
|
+
InteractVFXItem.prototype.onItemRemoved = function () {
|
|
13156
13161
|
var _a;
|
|
13157
|
-
composition.removeInteractiveItem(this, this.ui.options.type);
|
|
13158
13162
|
this.clickable = false;
|
|
13159
13163
|
(_a = this.previewContent) === null || _a === void 0 ? void 0 : _a.mesh.dispose();
|
|
13160
13164
|
this.endDragTarget();
|
|
@@ -14946,7 +14950,6 @@ var SpriteItem = /** @class */ (function (_super) {
|
|
|
14946
14950
|
ret.texOffset = [0, 0, 1, 1];
|
|
14947
14951
|
}
|
|
14948
14952
|
ret.visible = this.vfxItem.contentVisible;
|
|
14949
|
-
// 图层元素作为父节点时,除了k的大小变换,自身的尺寸也需要传递给子元素,子元素可以通过startSize读取
|
|
14950
14953
|
ret.startSize = this.startSize;
|
|
14951
14954
|
return ret;
|
|
14952
14955
|
};
|
|
@@ -15044,7 +15047,9 @@ var SpriteVFXItem = /** @class */ (function (_super) {
|
|
|
15044
15047
|
};
|
|
15045
15048
|
SpriteVFXItem.prototype.doCreateContent = function (composition) {
|
|
15046
15049
|
var emptyTexture = composition.getRendererOptions().emptyTexture;
|
|
15047
|
-
|
|
15050
|
+
var content = new SpriteItem(this.sprite, { emptyTexture: emptyTexture }, this);
|
|
15051
|
+
content.getRenderData(0, true);
|
|
15052
|
+
return content;
|
|
15048
15053
|
};
|
|
15049
15054
|
SpriteVFXItem.prototype.createWireframeMesh = function (item, color) {
|
|
15050
15055
|
var spMesh = new SpriteMesh(this.composition.getEngine(), __assign$1({ wireframe: true }, item.renderInfo), this.composition);
|
|
@@ -21382,8 +21387,9 @@ var Camera = /** @class */ (function () {
|
|
|
21382
21387
|
Camera.prototype.getInverseVPRatio = function (z) {
|
|
21383
21388
|
var pos = new Vector3(0, 0, z);
|
|
21384
21389
|
var mat = this.getViewProjectionMatrix();
|
|
21385
|
-
var
|
|
21386
|
-
|
|
21390
|
+
var inverseVP = this.getInverseViewProjectionMatrix();
|
|
21391
|
+
var nz = mat.projectPoint(pos).z;
|
|
21392
|
+
return inverseVP.projectPoint(new Vector3(1, 1, nz));
|
|
21387
21393
|
};
|
|
21388
21394
|
/**
|
|
21389
21395
|
* 设置相机的旋转四元数
|
|
@@ -21395,7 +21401,6 @@ var Camera = /** @class */ (function () {
|
|
|
21395
21401
|
this.dirty = true;
|
|
21396
21402
|
}
|
|
21397
21403
|
else {
|
|
21398
|
-
this.options.quat;
|
|
21399
21404
|
if (!this.options.quat.equals(value)) {
|
|
21400
21405
|
this.options.quat.copyFrom(value);
|
|
21401
21406
|
this.dirty = true;
|
|
@@ -21572,7 +21577,7 @@ var filters = {
|
|
|
21572
21577
|
* Name: @galacean/effects-specification
|
|
21573
21578
|
* Description: Galacean Effects JSON Specification
|
|
21574
21579
|
* Author: Ant Group CO., Ltd.
|
|
21575
|
-
* Version: v1.1.0-alpha.
|
|
21580
|
+
* Version: v1.1.0-alpha.1
|
|
21576
21581
|
*/
|
|
21577
21582
|
|
|
21578
21583
|
/*********************************************/
|
|
@@ -23735,16 +23740,17 @@ var AssetManager = /** @class */ (function () {
|
|
|
23735
23740
|
};
|
|
23736
23741
|
AssetManager.prototype.processBins = function (bins) {
|
|
23737
23742
|
return __awaiter(this, void 0, void 0, function () {
|
|
23738
|
-
var renderLevel, jobs;
|
|
23743
|
+
var renderLevel, baseUrl, jobs;
|
|
23739
23744
|
var _this = this;
|
|
23740
23745
|
return __generator(this, function (_a) {
|
|
23741
23746
|
renderLevel = this.options.renderLevel;
|
|
23747
|
+
baseUrl = this.baseUrl;
|
|
23742
23748
|
jobs = bins.map(function (bin) {
|
|
23743
23749
|
if (bin instanceof ArrayBuffer) {
|
|
23744
23750
|
return bin;
|
|
23745
23751
|
}
|
|
23746
23752
|
if (passRenderLevel(bin.renderLevel, renderLevel)) {
|
|
23747
|
-
return _this.loadBins(bin.url);
|
|
23753
|
+
return _this.loadBins(new URL(bin.url, baseUrl).href);
|
|
23748
23754
|
}
|
|
23749
23755
|
throw new Error("Invalid bins source: ".concat(JSON.stringify(bins)));
|
|
23750
23756
|
});
|
|
@@ -23762,13 +23768,14 @@ var AssetManager = /** @class */ (function () {
|
|
|
23762
23768
|
return [2 /*return*/];
|
|
23763
23769
|
}
|
|
23764
23770
|
jobs = fonts.map(function (font) { return __awaiter(_this, void 0, void 0, function () {
|
|
23765
|
-
var fontFace;
|
|
23771
|
+
var url, fontFace;
|
|
23766
23772
|
var _a;
|
|
23767
23773
|
return __generator(this, function (_b) {
|
|
23768
23774
|
switch (_b.label) {
|
|
23769
23775
|
case 0:
|
|
23770
23776
|
if (!(font.fontURL && !AssetManager.fonts.has(font.fontFamily))) return [3 /*break*/, 4];
|
|
23771
|
-
|
|
23777
|
+
url = new URL(font.fontURL, this.baseUrl).href;
|
|
23778
|
+
fontFace = new FontFace((_a = font.fontFamily) !== null && _a !== void 0 ? _a : '', 'url(' + url + ')');
|
|
23772
23779
|
_b.label = 1;
|
|
23773
23780
|
case 1:
|
|
23774
23781
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -23781,7 +23788,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23781
23788
|
return [3 /*break*/, 4];
|
|
23782
23789
|
case 3:
|
|
23783
23790
|
_b.sent();
|
|
23784
|
-
logger.warn("Invalid fonts source: ".concat(JSON.stringify(
|
|
23791
|
+
logger.warn("Invalid fonts source: ".concat(JSON.stringify(url)));
|
|
23785
23792
|
return [3 /*break*/, 4];
|
|
23786
23793
|
case 4: return [2 /*return*/];
|
|
23787
23794
|
}
|
|
@@ -23994,7 +24001,7 @@ function createTextureOptionsBySource(image, sourceFrom) {
|
|
|
23994
24001
|
return image.source;
|
|
23995
24002
|
}
|
|
23996
24003
|
else if (image instanceof HTMLImageElement ||
|
|
23997
|
-
image
|
|
24004
|
+
isCanvas(image)) {
|
|
23998
24005
|
return {
|
|
23999
24006
|
image: image,
|
|
24000
24007
|
sourceType: exports.TextureSourceType.image,
|
|
@@ -24031,6 +24038,11 @@ function createTextureOptionsBySource(image, sourceFrom) {
|
|
|
24031
24038
|
}
|
|
24032
24039
|
throw new Error('Invalid texture options');
|
|
24033
24040
|
}
|
|
24041
|
+
function isCanvas(canvas) {
|
|
24042
|
+
var _a;
|
|
24043
|
+
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
24044
|
+
return typeof canvas === 'object' && canvas !== null && ((_a = canvas.tagName) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'CANVAS';
|
|
24045
|
+
}
|
|
24034
24046
|
|
|
24035
24047
|
var CompVFXItem = /** @class */ (function (_super) {
|
|
24036
24048
|
__extends(CompVFXItem, _super);
|