@galacean/effects-threejs 1.6.0 → 1.6.2-beta.0
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 +22 -12
- 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 +22 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v1.6.0
|
|
6
|
+
* Version: v1.6.2-beta.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -20306,13 +20306,21 @@ var TextLayout = /** @class */ (function () {
|
|
|
20306
20306
|
this.textAlign = textAlign;
|
|
20307
20307
|
this.lineHeight = lineHeight;
|
|
20308
20308
|
}
|
|
20309
|
-
|
|
20309
|
+
/**
|
|
20310
|
+
* 获取初始的行高偏移值
|
|
20311
|
+
* @param style - 字体基础数据
|
|
20312
|
+
* @param lineCount - 渲染行数
|
|
20313
|
+
* @param lineHeight - 渲染时的字体行高
|
|
20314
|
+
* @param fontSize - 渲染时的字体大小
|
|
20315
|
+
* @returns - 行高偏移值
|
|
20316
|
+
*/
|
|
20317
|
+
TextLayout.prototype.getOffsetY = function (style, lineCount, lineHeight, fontSize) {
|
|
20310
20318
|
var offsetResult = 0;
|
|
20311
|
-
var
|
|
20312
|
-
// 计算基础偏移量
|
|
20313
|
-
var baseOffset = (fontSize + outlineWidth) * fontScale;
|
|
20319
|
+
var outlineWidth = style.outlineWidth, fontScale = style.fontScale;
|
|
20314
20320
|
// /3 计算Y轴偏移量,以匹配编辑器行为
|
|
20315
20321
|
var offsetY = (lineHeight - fontSize) / 3;
|
|
20322
|
+
// 计算基础偏移量
|
|
20323
|
+
var baseOffset = fontSize + outlineWidth * fontScale;
|
|
20316
20324
|
var commonCalculation = lineHeight * (lineCount - 1);
|
|
20317
20325
|
switch (this.textBaseline) {
|
|
20318
20326
|
case TextBaseline$1.top:
|
|
@@ -20370,7 +20378,7 @@ var TextItem = /** @class */ (function (_super) {
|
|
|
20370
20378
|
_this.engine = vfxItem.composition.getEngine();
|
|
20371
20379
|
_this.textStyle = new TextStyle(options);
|
|
20372
20380
|
_this.textLayout = new TextLayout(options);
|
|
20373
|
-
_this.text = options.text;
|
|
20381
|
+
_this.text = options.text.toString();
|
|
20374
20382
|
_this.lineCount = _this.getLineCount(options.text, true);
|
|
20375
20383
|
// Text
|
|
20376
20384
|
_this.mesh = new TextMesh(_this.engine, _this.renderInfo, vfxItem.composition);
|
|
@@ -20447,7 +20455,7 @@ var TextItem = /** @class */ (function (_super) {
|
|
|
20447
20455
|
if (this.text === value) {
|
|
20448
20456
|
return;
|
|
20449
20457
|
}
|
|
20450
|
-
this.text = value;
|
|
20458
|
+
this.text = value.toString();
|
|
20451
20459
|
this.lineCount = this.getLineCount(value, false);
|
|
20452
20460
|
this.isDirty = true;
|
|
20453
20461
|
};
|
|
@@ -20599,7 +20607,7 @@ var TextItem = /** @class */ (function (_super) {
|
|
|
20599
20607
|
var fontScale = style.fontScale;
|
|
20600
20608
|
var width = (layout.width + style.fontOffset) * fontScale;
|
|
20601
20609
|
var height = layout.height * fontScale;
|
|
20602
|
-
style.fontSize * fontScale;
|
|
20610
|
+
var fontSize = style.fontSize * fontScale;
|
|
20603
20611
|
var lineHeight = layout.lineHeight * fontScale;
|
|
20604
20612
|
this.char = (this.text || '').split('');
|
|
20605
20613
|
this.canvas.width = width;
|
|
@@ -20620,7 +20628,7 @@ var TextItem = /** @class */ (function (_super) {
|
|
|
20620
20628
|
context.fillStyle = "rgba(".concat(style.textColor[0], ", ").concat(style.textColor[1], ", ").concat(style.textColor[2], ", ").concat(style.textColor[3], ")");
|
|
20621
20629
|
var charsInfo = [];
|
|
20622
20630
|
var x = 0;
|
|
20623
|
-
var y = layout.getOffsetY(style, this.lineCount, lineHeight);
|
|
20631
|
+
var y = layout.getOffsetY(style, this.lineCount, lineHeight, fontSize);
|
|
20624
20632
|
var charsArray = [];
|
|
20625
20633
|
var charOffsetX = [];
|
|
20626
20634
|
for (var i = 0; i < this.char.length; i++) {
|
|
@@ -21790,11 +21798,13 @@ var Camera = /** @class */ (function () {
|
|
|
21790
21798
|
* @param z - 当前的位置 z
|
|
21791
21799
|
*/
|
|
21792
21800
|
Camera.prototype.getInverseVPRatio = function (z) {
|
|
21793
|
-
var pos = new Vector3(
|
|
21801
|
+
var pos = new Vector3(this.position.x, this.position.y, z);
|
|
21794
21802
|
var mat = this.getViewProjectionMatrix();
|
|
21795
21803
|
var inverseVP = this.getInverseViewProjectionMatrix();
|
|
21796
21804
|
var nz = mat.projectPoint(pos).z;
|
|
21797
|
-
|
|
21805
|
+
var _a = inverseVP.projectPoint(new Vector3(1, 1, nz)), xMax = _a.x, yMax = _a.y;
|
|
21806
|
+
var _b = inverseVP.projectPoint(new Vector3(-1, -1, nz)), xMin = _b.x, yMin = _b.y;
|
|
21807
|
+
return new Vector3((xMax - xMin) / 2, (yMax - yMin) / 2, 0);
|
|
21798
21808
|
};
|
|
21799
21809
|
/**
|
|
21800
21810
|
* 设置相机的旋转四元数
|
|
@@ -27510,7 +27520,7 @@ Geometry.create = function (engine, options) {
|
|
|
27510
27520
|
Mesh.create = function (engine, props) {
|
|
27511
27521
|
return new ThreeMesh(engine, props);
|
|
27512
27522
|
};
|
|
27513
|
-
var version = "1.6.0";
|
|
27523
|
+
var version = "1.6.2-beta.0";
|
|
27514
27524
|
logger.info('THREEJS plugin version: ' + version);
|
|
27515
27525
|
|
|
27516
27526
|
exports.AbstractPlugin = AbstractPlugin;
|