@galacean/engine-core 1.1.0-beta.34 → 1.1.0-beta.36

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/main.js CHANGED
@@ -1947,13 +1947,15 @@ var Logger = {
1947
1947
  ];
1948
1948
  })();
1949
1949
  (function() {
1950
- /** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
1950
+ // _heightMultiplier used to measure the height of text, but in miniprogram performance is different from h5.
1951
+ // so can set _heightMultiplier to adapt miniprogram, the larger the value, the worse the performance.
1952
+ /** @internal */ TextUtils._heightMultiplier = 2;
1951
1953
  })();
1952
1954
  (function() {
1953
- TextUtils._measureBaseline = "M";
1955
+ /** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
1954
1956
  })();
1955
1957
  (function() {
1956
- TextUtils._heightMultiplier = 2;
1958
+ TextUtils._measureBaseline = "M";
1957
1959
  })();
1958
1960
  (function() {
1959
1961
  TextUtils._baselineMultiplier = 1.4;
@@ -2037,7 +2039,7 @@ var Logger = {
2037
2039
  var _this = this, engine = _this._engine;
2038
2040
  var fontAtlas = new FontAtlas(engine);
2039
2041
  var texture = new Texture2D(engine, 256, 256, exports.TextureFormat.R8G8B8A8, false);
2040
- texture.filterMode = exports.TextureFilterMode.Point;
2042
+ texture.filterMode = exports.TextureFilterMode.Bilinear;
2041
2043
  fontAtlas.texture = texture;
2042
2044
  fontAtlas.isGCIgnored = texture.isGCIgnored = true;
2043
2045
  this._fontAtlases.push(fontAtlas);
@@ -18541,7 +18543,7 @@ var /**
18541
18543
  /**
18542
18544
  * @internal
18543
18545
  */ _proto._render = function _render(context) {
18544
- if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0) {
18546
+ if (this._isTextNoVisible()) {
18545
18547
  return;
18546
18548
  }
18547
18549
  if (this._isContainDirtyFlag(0x10)) {
@@ -18633,8 +18635,8 @@ var /**
18633
18635
  }
18634
18636
  };
18635
18637
  _proto._updateLocalData = function _updateLocalData() {
18636
- var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
18637
18638
  var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
18639
+ var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
18638
18640
  var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
18639
18641
  var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
18640
18642
  var charRenderDataPool = TextRenderer._charRenderDataPool;
@@ -18702,7 +18704,7 @@ var /**
18702
18704
  var left = startX * pixelsPerUnitReciprocal;
18703
18705
  var right = (startX + w) * pixelsPerUnitReciprocal;
18704
18706
  var top = (startY + ascent) * pixelsPerUnitReciprocal;
18705
- var bottom = (startY - descent + 1) * pixelsPerUnitReciprocal;
18707
+ var bottom = (startY - descent) * pixelsPerUnitReciprocal;
18706
18708
  localPositions.set(left, top, right, bottom);
18707
18709
  i === firstLine && (maxY = Math.max(maxY, top));
18708
18710
  minY = Math.min(minY, bottom);
@@ -18743,6 +18745,9 @@ var /**
18743
18745
  Renderer1.prototype._onTransformChanged.call(this, bit);
18744
18746
  this._setDirtyFlagTrue(0x4 | 0x8);
18745
18747
  };
18748
+ _proto._isTextNoVisible = function _isTextNoVisible() {
18749
+ return this._text === "" || this._fontSize === 0 || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0;
18750
+ };
18746
18751
  _create_class(TextRenderer, [
18747
18752
  {
18748
18753
  key: "color",
@@ -18945,6 +18950,16 @@ var /**
18945
18950
  get: /**
18946
18951
  * The bounding volume of the TextRenderer.
18947
18952
  */ function get() {
18953
+ if (this._isTextNoVisible()) {
18954
+ if (this._isContainDirtyFlag(0x8)) {
18955
+ var localBounds = this._localBounds;
18956
+ localBounds.min.set(0, 0, 0);
18957
+ localBounds.max.set(0, 0, 0);
18958
+ this._updateBounds(this._bounds);
18959
+ this._setDirtyFlagFalse(0x8);
18960
+ }
18961
+ return this._bounds;
18962
+ }
18948
18963
  this._isContainDirtyFlag(0x1) && this._resetSubFont();
18949
18964
  this._isContainDirtyFlag(0x2) && this._updateLocalData();
18950
18965
  this._isContainDirtyFlag(0x4) && this._updatePosition();
@@ -21946,12 +21961,38 @@ var passNum = 0;
21946
21961
  /**
21947
21962
  * @internal
21948
21963
  */ RenderQueue._compareFromNearToFar = function _compareFromNearToFar(a, b) {
21949
- return a.data.component.priority - b.data.component.priority || a.data.material._priority - b.data.material._priority || a.data.component._distanceForSort - b.data.component._distanceForSort;
21964
+ var dataA = a.data;
21965
+ var dataB = b.data;
21966
+ var componentA = dataA.component;
21967
+ var componentB = dataB.component;
21968
+ var priorityOrder = componentA.priority - componentB.priority;
21969
+ if (priorityOrder !== 0) {
21970
+ return priorityOrder;
21971
+ }
21972
+ // make suer from the same renderer.
21973
+ if (componentA.instanceId === componentB.instanceId) {
21974
+ return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
21975
+ } else {
21976
+ return componentA._distanceForSort - componentB._distanceForSort;
21977
+ }
21950
21978
  };
21951
21979
  /**
21952
21980
  * @internal
21953
21981
  */ RenderQueue._compareFromFarToNear = function _compareFromFarToNear(a, b) {
21954
- return a.data.component.priority - b.data.component.priority || a.data.material._priority - b.data.material._priority || b.data.component._distanceForSort - a.data.component._distanceForSort;
21982
+ var dataA = a.data;
21983
+ var dataB = b.data;
21984
+ var componentA = dataA.component;
21985
+ var componentB = dataB.component;
21986
+ var priorityOrder = componentA.priority - componentB.priority;
21987
+ if (priorityOrder !== 0) {
21988
+ return priorityOrder;
21989
+ }
21990
+ // make suer from the same renderer.
21991
+ if (componentA.instanceId === componentB.instanceId) {
21992
+ return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
21993
+ } else {
21994
+ return componentB._distanceForSort - componentA._distanceForSort;
21995
+ }
21955
21996
  };
21956
21997
  return RenderQueue;
21957
21998
  }();