@galacean/effects-threejs 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 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.1
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
- TextLayout.prototype.getOffsetY = function (style, lineCount, lineHeight) {
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 fontSize = style.fontSize, outlineWidth = style.outlineWidth, fontScale = style.fontScale;
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:
@@ -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++) {
@@ -27510,7 +27518,7 @@ Geometry.create = function (engine, options) {
27510
27518
  Mesh.create = function (engine, props) {
27511
27519
  return new ThreeMesh(engine, props);
27512
27520
  };
27513
- var version = "1.6.0";
27521
+ var version = "1.6.1";
27514
27522
  logger.info('THREEJS plugin version: ' + version);
27515
27523
 
27516
27524
  exports.AbstractPlugin = AbstractPlugin;