@galacean/engine 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/browser.js CHANGED
@@ -23247,7 +23247,7 @@
23247
23247
  /**
23248
23248
  * @internal
23249
23249
  */ _proto._render = function _render(context) {
23250
- if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0) {
23250
+ if (this._isTextNoVisible()) {
23251
23251
  return;
23252
23252
  }
23253
23253
  if (this._isContainDirtyFlag(0x10)) {
@@ -23339,8 +23339,8 @@
23339
23339
  }
23340
23340
  };
23341
23341
  _proto._updateLocalData = function _updateLocalData() {
23342
- var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
23343
23342
  var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
23343
+ var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
23344
23344
  var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
23345
23345
  var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
23346
23346
  var charRenderDataPool = TextRenderer._charRenderDataPool;
@@ -23449,6 +23449,9 @@
23449
23449
  Renderer1.prototype._onTransformChanged.call(this, bit);
23450
23450
  this._setDirtyFlagTrue(0x4 | 0x8);
23451
23451
  };
23452
+ _proto._isTextNoVisible = function _isTextNoVisible() {
23453
+ return this._text === "" || this._fontSize === 0 || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0;
23454
+ };
23452
23455
  _create_class$3(TextRenderer, [
23453
23456
  {
23454
23457
  key: "color",
@@ -23651,6 +23654,16 @@
23651
23654
  get: /**
23652
23655
  * The bounding volume of the TextRenderer.
23653
23656
  */ function get() {
23657
+ if (this._isTextNoVisible()) {
23658
+ if (this._isContainDirtyFlag(0x8)) {
23659
+ var localBounds = this._localBounds;
23660
+ localBounds.min.set(0, 0, 0);
23661
+ localBounds.max.set(0, 0, 0);
23662
+ this._updateBounds(this._bounds);
23663
+ this._setDirtyFlagFalse(0x8);
23664
+ }
23665
+ return this._bounds;
23666
+ }
23654
23667
  this._isContainDirtyFlag(0x1) && this._resetSubFont();
23655
23668
  this._isContainDirtyFlag(0x2) && this._updateLocalData();
23656
23669
  this._isContainDirtyFlag(0x4) && this._updatePosition();
@@ -26629,12 +26642,38 @@
26629
26642
  /**
26630
26643
  * @internal
26631
26644
  */ RenderQueue._compareFromNearToFar = function _compareFromNearToFar(a, b) {
26632
- 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;
26645
+ var dataA = a.data;
26646
+ var dataB = b.data;
26647
+ var componentA = dataA.component;
26648
+ var componentB = dataB.component;
26649
+ var priorityOrder = componentA.priority - componentB.priority;
26650
+ if (priorityOrder !== 0) {
26651
+ return priorityOrder;
26652
+ }
26653
+ // make suer from the same renderer.
26654
+ if (componentA.instanceId === componentB.instanceId) {
26655
+ return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
26656
+ } else {
26657
+ return componentA._distanceForSort - componentB._distanceForSort;
26658
+ }
26633
26659
  };
26634
26660
  /**
26635
26661
  * @internal
26636
26662
  */ RenderQueue._compareFromFarToNear = function _compareFromFarToNear(a, b) {
26637
- 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;
26663
+ var dataA = a.data;
26664
+ var dataB = b.data;
26665
+ var componentA = dataA.component;
26666
+ var componentB = dataB.component;
26667
+ var priorityOrder = componentA.priority - componentB.priority;
26668
+ if (priorityOrder !== 0) {
26669
+ return priorityOrder;
26670
+ }
26671
+ // make suer from the same renderer.
26672
+ if (componentA.instanceId === componentB.instanceId) {
26673
+ return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
26674
+ } else {
26675
+ return componentB._distanceForSort - componentA._distanceForSort;
26676
+ }
26638
26677
  };
26639
26678
  return RenderQueue;
26640
26679
  }();
@@ -43148,7 +43187,7 @@
43148
43187
  };
43149
43188
  _proto._makeSprite = function _makeSprite(engine, config, texture) {
43150
43189
  // Generate a SpriteAtlas object.
43151
- var region = config.region, atlasRegionOffset = config.atlasRegionOffset, atlasRegion = config.atlasRegion, pivot = config.pivot, border = config.border;
43190
+ var region = config.region, atlasRegionOffset = config.atlasRegionOffset, atlasRegion = config.atlasRegion, pivot = config.pivot, border = config.border, width = config.width, height = config.height;
43152
43191
  var sprite = new Sprite(engine, texture, region ? this._tempRect.set(region.x, region.y, region.w, region.h) : undefined, pivot ? this._tempVec2.set(pivot.x, pivot.y) : undefined, border ? this._tempVec4.set(border.x, border.y, border.z, border.w) : undefined, config.name);
43153
43192
  if (texture) {
43154
43193
  var invW = 1 / texture.width;
@@ -43160,6 +43199,8 @@
43160
43199
  }
43161
43200
  config.atlasRotated && (sprite.atlasRotated = true);
43162
43201
  }
43202
+ isNaN(width) || (sprite.width = width);
43203
+ isNaN(height) || (sprite.height = height);
43163
43204
  return sprite;
43164
43205
  };
43165
43206
  return SpriteAtlasLoader;
@@ -43194,11 +43235,19 @@
43194
43235
  if (data.texture) {
43195
43236
  return resourceManager // @ts-ignore
43196
43237
  .getResourceByRef(data.texture).then(function(texture) {
43197
- return new Sprite(resourceManager.engine, texture, data.region, data.pivot, data.border);
43238
+ var sprite = new Sprite(resourceManager.engine, texture, data.region, data.pivot, data.border);
43239
+ var width = data.width, height = data.height;
43240
+ isNaN(width) || (sprite.width = width);
43241
+ isNaN(height) || (sprite.height = height);
43242
+ return sprite;
43198
43243
  });
43199
43244
  } else {
43200
43245
  return new AssetPromise(function(resolve) {
43201
- resolve(new Sprite(resourceManager.engine, null, data.region, data.pivot, data.border));
43246
+ var sprite = new Sprite(resourceManager.engine, null, data.region, data.pivot, data.border);
43247
+ var width = data.width, height = data.height;
43248
+ isNaN(width) || (sprite.width = width);
43249
+ isNaN(height) || (sprite.height = height);
43250
+ resolve(sprite);
43202
43251
  });
43203
43252
  }
43204
43253
  };
@@ -43977,7 +44026,7 @@
43977
44026
  ], GALACEAN_animation_event);
43978
44027
 
43979
44028
  //@ts-ignore
43980
- var version = "1.1.0-beta.34";
44029
+ var version = "1.1.0-beta.35";
43981
44030
  console.log("Galacean engine version: " + version);
43982
44031
  for(var key in CoreObjects){
43983
44032
  Loader.registerClass(key, CoreObjects[key]);