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