@galacean/effects-core 1.2.1 → 1.2.3
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 -3
- package/dist/composition.d.ts +2 -2
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -3
- package/dist/index.mjs.map +1 -1
- package/dist/render/render-pass.d.ts +1 -1
- package/dist/scene.d.ts +2 -2
- package/package.json +1 -1
package/dist/asset-manager.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { JSONValue } from './downloader';
|
|
1
|
+
import * as spec from '@galacean/effects-specification';
|
|
3
2
|
import { Downloader } from './downloader';
|
|
4
3
|
import type { Disposable } from './utils';
|
|
5
4
|
import type { Scene } from './scene';
|
|
@@ -73,6 +72,10 @@ export interface SceneLoadOptions {
|
|
|
73
72
|
*/
|
|
74
73
|
speed?: number;
|
|
75
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* 被接受用于加载的数据类型
|
|
77
|
+
*/
|
|
78
|
+
export type SceneType = string | Scene | Record<string, unknown>;
|
|
76
79
|
/**
|
|
77
80
|
* 资源管理器
|
|
78
81
|
* 用于加载和动效中所有的资源文件,包括图片、插件、图层粒子数据等
|
|
@@ -109,6 +112,10 @@ export declare class AssetManager implements Disposable {
|
|
|
109
112
|
*/
|
|
110
113
|
constructor(options?: SceneLoadOptions, downloader?: Downloader);
|
|
111
114
|
updateOptions(options?: SceneLoadOptions): void;
|
|
115
|
+
/**
|
|
116
|
+
* 根据用户传入的参数修改场景数据
|
|
117
|
+
*/
|
|
118
|
+
private updateSceneData;
|
|
112
119
|
/**
|
|
113
120
|
* 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
|
|
114
121
|
* @param url - json 的 URL 链接或者 json 对象
|
|
@@ -116,7 +123,7 @@ export declare class AssetManager implements Disposable {
|
|
|
116
123
|
* @param options - 扩展参数
|
|
117
124
|
* @returns
|
|
118
125
|
*/
|
|
119
|
-
loadScene(url:
|
|
126
|
+
loadScene(url: SceneType, renderer?: Renderer, options?: {
|
|
120
127
|
env: string;
|
|
121
128
|
}): Promise<Scene>;
|
|
122
129
|
private precompile;
|
package/dist/composition.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as spec from '@galacean/effects-specification';
|
|
2
2
|
import type { Ray } from '@galacean/effects-math/es/core/index';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SceneType } from './asset-manager';
|
|
4
4
|
import type { Scene } from './scene';
|
|
5
5
|
import type { Disposable, LostHandler } from './utils';
|
|
6
6
|
import { Transform } from './transform';
|
|
@@ -138,7 +138,7 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
138
138
|
/**
|
|
139
139
|
* 合成对应的 url 或者 JSON
|
|
140
140
|
*/
|
|
141
|
-
readonly url:
|
|
141
|
+
readonly url: SceneType;
|
|
142
142
|
/**
|
|
143
143
|
* 合成对象
|
|
144
144
|
*/
|
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.2.
|
|
6
|
+
* Version: v1.2.3
|
|
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
|
/**
|
|
@@ -23469,6 +23470,26 @@ var AssetManager = /** @class */ (function () {
|
|
|
23469
23470
|
var _a = options.timeout, timeout = _a === void 0 ? 10 : _a;
|
|
23470
23471
|
this.timeout = timeout;
|
|
23471
23472
|
};
|
|
23473
|
+
/**
|
|
23474
|
+
* 根据用户传入的参数修改场景数据
|
|
23475
|
+
*/
|
|
23476
|
+
AssetManager.prototype.updateSceneData = function (compositions) {
|
|
23477
|
+
var variables = this.options.variables;
|
|
23478
|
+
if (!variables || Object.keys(variables).length <= 0) {
|
|
23479
|
+
return compositions;
|
|
23480
|
+
}
|
|
23481
|
+
compositions.forEach(function (composition) {
|
|
23482
|
+
composition.items.forEach(function (item) {
|
|
23483
|
+
if (item.type === ItemType$1.text) {
|
|
23484
|
+
var textVariable = variables[item.name];
|
|
23485
|
+
if (textVariable) {
|
|
23486
|
+
item.content.options.text = textVariable;
|
|
23487
|
+
}
|
|
23488
|
+
}
|
|
23489
|
+
});
|
|
23490
|
+
});
|
|
23491
|
+
return compositions;
|
|
23492
|
+
};
|
|
23472
23493
|
/**
|
|
23473
23494
|
* 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
|
|
23474
23495
|
* @param url - json 的 URL 链接或者 json 对象
|
|
@@ -23560,6 +23581,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23560
23581
|
for (i = 0; i < scene.images.length; i++) {
|
|
23561
23582
|
scene.textureOptions[i].image = scene.images[i];
|
|
23562
23583
|
}
|
|
23584
|
+
scene.jsonScene.compositions = this.updateSceneData(scene.jsonScene.compositions);
|
|
23563
23585
|
_e.label = 5;
|
|
23564
23586
|
case 5: return [3 /*break*/, 12];
|
|
23565
23587
|
case 6: return [4 /*yield*/, hookTimeInfo('processJSON', function () { return _this.processJSON(rawJSON); })];
|
|
@@ -23579,6 +23601,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23579
23601
|
return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(loadedImages_1, loadedBins_1, jsonScene_1); })];
|
|
23580
23602
|
case 10:
|
|
23581
23603
|
loadedTextures = _e.sent();
|
|
23604
|
+
jsonScene_1.compositions = this.updateSceneData(jsonScene_1.compositions);
|
|
23582
23605
|
scene = {
|
|
23583
23606
|
url: url,
|
|
23584
23607
|
renderLevel: this.options.renderLevel,
|