@galacean/effects-core 1.6.0 → 1.6.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 +15 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -7
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/text/text-layout.d.ts +9 -1
- package/package.json +1 -1
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.6.
|
|
6
|
+
* Version: v1.6.1
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -20284,13 +20284,21 @@ var TextLayout = /** @class */ (function () {
|
|
|
20284
20284
|
this.textAlign = textAlign;
|
|
20285
20285
|
this.lineHeight = lineHeight;
|
|
20286
20286
|
}
|
|
20287
|
-
|
|
20287
|
+
/**
|
|
20288
|
+
* 获取初始的行高偏移值
|
|
20289
|
+
* @param style - 字体基础数据
|
|
20290
|
+
* @param lineCount - 渲染行数
|
|
20291
|
+
* @param lineHeight - 渲染时的字体行高
|
|
20292
|
+
* @param fontSize - 渲染时的字体大小
|
|
20293
|
+
* @returns - 行高偏移值
|
|
20294
|
+
*/
|
|
20295
|
+
TextLayout.prototype.getOffsetY = function (style, lineCount, lineHeight, fontSize) {
|
|
20288
20296
|
var offsetResult = 0;
|
|
20289
|
-
var
|
|
20290
|
-
// 计算基础偏移量
|
|
20291
|
-
var baseOffset = (fontSize + outlineWidth) * fontScale;
|
|
20297
|
+
var outlineWidth = style.outlineWidth, fontScale = style.fontScale;
|
|
20292
20298
|
// /3 计算Y轴偏移量,以匹配编辑器行为
|
|
20293
20299
|
var offsetY = (lineHeight - fontSize) / 3;
|
|
20300
|
+
// 计算基础偏移量
|
|
20301
|
+
var baseOffset = fontSize + outlineWidth * fontScale;
|
|
20294
20302
|
var commonCalculation = lineHeight * (lineCount - 1);
|
|
20295
20303
|
switch (this.textBaseline) {
|
|
20296
20304
|
case TextBaseline$1.top:
|
|
@@ -20577,7 +20585,7 @@ var TextItem = /** @class */ (function (_super) {
|
|
|
20577
20585
|
var fontScale = style.fontScale;
|
|
20578
20586
|
var width = (layout.width + style.fontOffset) * fontScale;
|
|
20579
20587
|
var height = layout.height * fontScale;
|
|
20580
|
-
style.fontSize * fontScale;
|
|
20588
|
+
var fontSize = style.fontSize * fontScale;
|
|
20581
20589
|
var lineHeight = layout.lineHeight * fontScale;
|
|
20582
20590
|
this.char = (this.text || '').split('');
|
|
20583
20591
|
this.canvas.width = width;
|
|
@@ -20598,7 +20606,7 @@ var TextItem = /** @class */ (function (_super) {
|
|
|
20598
20606
|
context.fillStyle = "rgba(".concat(style.textColor[0], ", ").concat(style.textColor[1], ", ").concat(style.textColor[2], ", ").concat(style.textColor[3], ")");
|
|
20599
20607
|
var charsInfo = [];
|
|
20600
20608
|
var x = 0;
|
|
20601
|
-
var y = layout.getOffsetY(style, this.lineCount, lineHeight);
|
|
20609
|
+
var y = layout.getOffsetY(style, this.lineCount, lineHeight, fontSize);
|
|
20602
20610
|
var charsArray = [];
|
|
20603
20611
|
var charOffsetX = [];
|
|
20604
20612
|
for (var i = 0; i < this.char.length; i++) {
|