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

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
@@ -18541,7 +18541,7 @@ var /**
18541
18541
  /**
18542
18542
  * @internal
18543
18543
  */ _proto._render = function _render(context) {
18544
- if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0) {
18544
+ if (this._isTextNoVisible()) {
18545
18545
  return;
18546
18546
  }
18547
18547
  if (this._isContainDirtyFlag(0x10)) {
@@ -18633,8 +18633,8 @@ var /**
18633
18633
  }
18634
18634
  };
18635
18635
  _proto._updateLocalData = function _updateLocalData() {
18636
- var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
18637
18636
  var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
18637
+ var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
18638
18638
  var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
18639
18639
  var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
18640
18640
  var charRenderDataPool = TextRenderer._charRenderDataPool;
@@ -18743,6 +18743,9 @@ var /**
18743
18743
  Renderer1.prototype._onTransformChanged.call(this, bit);
18744
18744
  this._setDirtyFlagTrue(0x4 | 0x8);
18745
18745
  };
18746
+ _proto._isTextNoVisible = function _isTextNoVisible() {
18747
+ return this._text === "" || this._fontSize === 0 || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0;
18748
+ };
18746
18749
  _create_class(TextRenderer, [
18747
18750
  {
18748
18751
  key: "color",
@@ -18945,6 +18948,16 @@ var /**
18945
18948
  get: /**
18946
18949
  * The bounding volume of the TextRenderer.
18947
18950
  */ function get() {
18951
+ if (this._isTextNoVisible()) {
18952
+ if (this._isContainDirtyFlag(0x8)) {
18953
+ var localBounds = this._localBounds;
18954
+ localBounds.min.set(0, 0, 0);
18955
+ localBounds.max.set(0, 0, 0);
18956
+ this._updateBounds(this._bounds);
18957
+ this._setDirtyFlagFalse(0x8);
18958
+ }
18959
+ return this._bounds;
18960
+ }
18948
18961
  this._isContainDirtyFlag(0x1) && this._resetSubFont();
18949
18962
  this._isContainDirtyFlag(0x2) && this._updateLocalData();
18950
18963
  this._isContainDirtyFlag(0x4) && this._updatePosition();
@@ -21946,12 +21959,38 @@ var passNum = 0;
21946
21959
  /**
21947
21960
  * @internal
21948
21961
  */ 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;
21962
+ var dataA = a.data;
21963
+ var dataB = b.data;
21964
+ var componentA = dataA.component;
21965
+ var componentB = dataB.component;
21966
+ var priorityOrder = componentA.priority - componentB.priority;
21967
+ if (priorityOrder !== 0) {
21968
+ return priorityOrder;
21969
+ }
21970
+ // make suer from the same renderer.
21971
+ if (componentA.instanceId === componentB.instanceId) {
21972
+ return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
21973
+ } else {
21974
+ return componentA._distanceForSort - componentB._distanceForSort;
21975
+ }
21950
21976
  };
21951
21977
  /**
21952
21978
  * @internal
21953
21979
  */ 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;
21980
+ var dataA = a.data;
21981
+ var dataB = b.data;
21982
+ var componentA = dataA.component;
21983
+ var componentB = dataB.component;
21984
+ var priorityOrder = componentA.priority - componentB.priority;
21985
+ if (priorityOrder !== 0) {
21986
+ return priorityOrder;
21987
+ }
21988
+ // make suer from the same renderer.
21989
+ if (componentA.instanceId === componentB.instanceId) {
21990
+ return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
21991
+ } else {
21992
+ return componentB._distanceForSort - componentA._distanceForSort;
21993
+ }
21955
21994
  };
21956
21995
  return RenderQueue;
21957
21996
  }();