@galacean/effects-plugin-rich-text 2.8.7 → 2.8.8
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/alipay.js +1 -1
- package/dist/alipay.js.map +1 -1
- package/dist/alipay.mjs +1 -1
- package/dist/alipay.mjs.map +1 -1
- package/dist/douyin.js +1 -1
- package/dist/douyin.js.map +1 -1
- package/dist/douyin.mjs +1 -1
- package/dist/douyin.mjs.map +1 -1
- package/dist/index.js +9 -13
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +9 -13
- package/dist/index.mjs.map +1 -1
- package/dist/rich-text-component.d.ts +0 -1
- package/dist/rich-text-layout.d.ts +1 -0
- package/dist/strategies/rich-text-interfaces.d.ts +1 -1
- package/dist/strategies/wrap/rich-wrap-disabled.d.ts +1 -1
- package/dist/strategies/wrap/rich-wrap-enabled.d.ts +1 -1
- package/dist/weapp.js +1 -1
- package/dist/weapp.js.map +1 -1
- package/dist/weapp.mjs +1 -1
- package/dist/weapp.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects player rich text plugin
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 云垣
|
|
6
|
-
* Version: v2.8.
|
|
6
|
+
* Version: v2.8.8
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as EFFECTS from '@galacean/effects';
|
|
@@ -509,6 +509,7 @@ var RichTextLayout = /*#__PURE__*/ function() {
|
|
|
509
509
|
/**
|
|
510
510
|
* 设置文本框尺寸
|
|
511
511
|
* - 不包含 fontScale 缩放
|
|
512
|
+
* @deprecated use maxTextWidth / maxTextHeight instead
|
|
512
513
|
*/ _proto.setSize = function setSize(width, height) {
|
|
513
514
|
this.width = width;
|
|
514
515
|
this.height = height;
|
|
@@ -595,11 +596,12 @@ var RichTextLayout = /*#__PURE__*/ function() {
|
|
|
595
596
|
*/ var RichWrapDisabledStrategy = /*#__PURE__*/ function() {
|
|
596
597
|
function RichWrapDisabledStrategy() {}
|
|
597
598
|
var _proto = RichWrapDisabledStrategy.prototype;
|
|
598
|
-
_proto.computeLines = function computeLines(processedOptions, context, style, layout, singleLineHeight, fontScale, letterSpace
|
|
599
|
+
_proto.computeLines = function computeLines(processedOptions, context, style, layout, singleLineHeight, fontScale, letterSpace) {
|
|
599
600
|
var _this = this;
|
|
600
601
|
var lines = [];
|
|
601
602
|
var baselines = [];
|
|
602
603
|
var gapPx = (layout.lineHeight || 0) * fontScale;
|
|
604
|
+
var scaleFactor = 1 / 10; // 1/10px, 后面 context.font 设置的字号为10px
|
|
603
605
|
var currentLine = this.createNewLine();
|
|
604
606
|
var maxLineWidth = 0;
|
|
605
607
|
var totalHeight = 0;
|
|
@@ -712,11 +714,12 @@ var RichTextLayout = /*#__PURE__*/ function() {
|
|
|
712
714
|
*/ var RichWrapEnabledStrategy = /*#__PURE__*/ function() {
|
|
713
715
|
function RichWrapEnabledStrategy() {}
|
|
714
716
|
var _proto = RichWrapEnabledStrategy.prototype;
|
|
715
|
-
_proto.computeLines = function computeLines(processedOptions, context, style, layout, singleLineHeight, fontScale, letterSpace
|
|
717
|
+
_proto.computeLines = function computeLines(processedOptions, context, style, layout, singleLineHeight, fontScale, letterSpace) {
|
|
716
718
|
var _this = this;
|
|
717
719
|
var lines = [];
|
|
718
720
|
var baselines = [];
|
|
719
721
|
var gapPx = (layout.lineHeight || 0) * fontScale;
|
|
722
|
+
var scaleFactor = 1 / 10; // 1/10px, 后面 context.font 设置的字号为10px
|
|
720
723
|
var currentLine = this.createNewLine();
|
|
721
724
|
var maxLineWidth = 0;
|
|
722
725
|
var totalHeight = 0;
|
|
@@ -1206,7 +1209,7 @@ var RichTextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
1206
1209
|
this.textLayout.textVerticalAlign = spec.TextVerticalAlign.middle;
|
|
1207
1210
|
}
|
|
1208
1211
|
this.updateStrategies();
|
|
1209
|
-
this.
|
|
1212
|
+
this.updateTexture();
|
|
1210
1213
|
// 设置默认颜色(math.Color)
|
|
1211
1214
|
this.material.setColor("_Color", new math.Color(1, 1, 1, 1));
|
|
1212
1215
|
};
|
|
@@ -1266,13 +1269,6 @@ var RichTextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
1266
1269
|
this.updateStrategies();
|
|
1267
1270
|
this.isDirty = true;
|
|
1268
1271
|
};
|
|
1269
|
-
_proto.renderText = function renderText(options) {
|
|
1270
|
-
var size = options.size;
|
|
1271
|
-
if (size) {
|
|
1272
|
-
this.canvasSize = new math.Vector2(size[0], size[1]);
|
|
1273
|
-
}
|
|
1274
|
-
this.updateTexture();
|
|
1275
|
-
};
|
|
1276
1272
|
/**
|
|
1277
1273
|
* 更新文本
|
|
1278
1274
|
* @returns
|
|
@@ -1432,7 +1428,7 @@ var RichTextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
1432
1428
|
return;
|
|
1433
1429
|
}
|
|
1434
1430
|
// 步骤1: 换行策略计算行信息
|
|
1435
|
-
var wrapResult = this.richWrapStrategy.computeLines(this.processedTextOptions, context, this.textStyle, layout, this.singleLineHeight, this.textStyle.fontScale, letterSpace
|
|
1431
|
+
var wrapResult = this.richWrapStrategy.computeLines(this.processedTextOptions, context, this.textStyle, layout, this.singleLineHeight, this.textStyle.fontScale, letterSpace);
|
|
1436
1432
|
if (wrapResult.lines.length === 0 || wrapResult.maxLineWidth === 0 || wrapResult.totalHeight === 0) {
|
|
1437
1433
|
this.isDirty = false;
|
|
1438
1434
|
return;
|
|
@@ -1724,7 +1720,7 @@ applyMixins(RichTextComponent, [
|
|
|
1724
1720
|
|
|
1725
1721
|
/**
|
|
1726
1722
|
* 插件版本号
|
|
1727
|
-
*/ var version = "2.8.
|
|
1723
|
+
*/ var version = "2.8.8";
|
|
1728
1724
|
registerPlugin("rich-text", RichTextLoader);
|
|
1729
1725
|
logger.info("Plugin rich text version: " + version + ".");
|
|
1730
1726
|
if (version !== EFFECTS.version) {
|