@galacean/engine-core 1.3.2 → 1.3.5

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
@@ -11169,9 +11169,12 @@ var /**
11169
11169
  // Safari gets data confusion through getImageData when the canvas width is not an integer.
11170
11170
  // The measure text width of some special invisible characters may be 0, so make sure the width is at least 1.
11171
11171
  // @todo: Text layout may vary from standard and not support emoji.
11172
- var textMetrics = context.measureText(measureString);
11172
+ var _context_measureText = context.measureText(measureString), actualBoundingBoxLeft = _context_measureText.actualBoundingBoxLeft, actualBoundingBoxRight = _context_measureText.actualBoundingBoxRight, actualWidth = _context_measureText.width;
11173
11173
  // In some case (ex: " "), actualBoundingBoxRight and actualBoundingBoxLeft will be 0, so use width.
11174
- var width = Math.max(1, Math.round(textMetrics.actualBoundingBoxRight - textMetrics.actualBoundingBoxLeft || textMetrics.width));
11174
+ // TODO: With testing, actualBoundingBoxLeft + actualBoundingBoxRight is the actual rendering width
11175
+ // but the space rules between characters are unclear. Using actualBoundingBoxRight + Math.abs(actualBoundingBoxLeft) is the closest to the native effect.
11176
+ var width = Math.max(1, Math.round(Math.max(actualBoundingBoxRight + Math.abs(actualBoundingBoxLeft), actualWidth)));
11177
+ // Make sure enough width.
11175
11178
  var baseline = Math.ceil(context.measureText(TextUtils._measureBaseline).width);
11176
11179
  var height = baseline * TextUtils._heightMultiplier;
11177
11180
  baseline = TextUtils._baselineMultiplier * baseline | 0;
@@ -11185,7 +11188,11 @@ var /**
11185
11188
  context.clearRect(0, 0, width, height);
11186
11189
  context.textBaseline = "middle";
11187
11190
  context.fillStyle = "#fff";
11188
- context.fillText(measureString, 0, baseline);
11191
+ if (actualBoundingBoxLeft > 0) {
11192
+ context.fillText(measureString, actualBoundingBoxLeft, baseline);
11193
+ } else {
11194
+ context.fillText(measureString, 0, baseline);
11195
+ }
11189
11196
  var colorData = context.getImageData(0, 0, width, height).data;
11190
11197
  var len = colorData.length;
11191
11198
  var top = -1;
@@ -11229,9 +11236,9 @@ var /**
11229
11236
  y: 0,
11230
11237
  w: width,
11231
11238
  h: size,
11232
- offsetX: 0,
11239
+ offsetX: actualBoundingBoxLeft > 0 ? actualBoundingBoxLeft : 0,
11233
11240
  offsetY: (ascent - descent) * 0.5,
11234
- xAdvance: width,
11241
+ xAdvance: Math.round(actualWidth),
11235
11242
  uvs: [
11236
11243
  new engineMath.Vector2(),
11237
11244
  new engineMath.Vector2(),
@@ -11800,7 +11807,7 @@ var /**
11800
11807
  j === firstRow && (minX = Math.min(minX, left));
11801
11808
  maxX = Math.max(maxX, right);
11802
11809
  }
11803
- startX += charInfo.xAdvance;
11810
+ startX += charInfo.xAdvance + charInfo.offsetX;
11804
11811
  }
11805
11812
  }
11806
11813
  startY -= lineHeight;
@@ -12630,8 +12637,6 @@ var BufferUtil = /*#__PURE__*/ function() {
12630
12637
  _this = ReferResource1.call(this, engine) || this;
12631
12638
  /** @internal */ _this._renderStates = [] // todo: later will as a part of shaderData when shader effect frame is OK, that is more powerful and flexible.
12632
12639
  ;
12633
- /** @internal */ _this._priority = 0 // todo: temporary resolution of submesh rendering order issue.
12634
- ;
12635
12640
  _this._shaderData = new ShaderData(ShaderDataGroup.Material);
12636
12641
  _this.shader = shader;
12637
12642
  return _this;
@@ -17823,6 +17828,17 @@ var ComponentCloner = /*#__PURE__*/ function() {
17823
17828
  this._setInActiveInHierarchy(this._activeChangedComponents, activeChangeFlag);
17824
17829
  this._setActiveComponents(false, activeChangeFlag);
17825
17830
  };
17831
+ /**
17832
+ * @internal
17833
+ */ _proto._setTransformDirty = function _setTransformDirty() {
17834
+ if (this.transform) {
17835
+ this.transform._parentChange();
17836
+ } else {
17837
+ for(var i = 0, len = this._children.length; i < len; i++){
17838
+ this._children[i]._setTransformDirty();
17839
+ }
17840
+ }
17841
+ };
17826
17842
  _proto._addToChildrenList = function _addToChildrenList(index, child) {
17827
17843
  var children = this._children;
17828
17844
  var childCount = children.length;
@@ -17932,15 +17948,6 @@ var ComponentCloner = /*#__PURE__*/ function() {
17932
17948
  child.isActive && child._setInActiveInHierarchy(activeChangedComponents, activeChangeFlag);
17933
17949
  }
17934
17950
  };
17935
- _proto._setTransformDirty = function _setTransformDirty() {
17936
- if (this.transform) {
17937
- this.transform._parentChange();
17938
- } else {
17939
- for(var i = 0, len = this._children.length; i < len; i++){
17940
- this._children[i]._setTransformDirty();
17941
- }
17942
- }
17943
- };
17944
17951
  _proto._setSiblingIndex = function _setSiblingIndex(sibling, target) {
17945
17952
  target = Math.min(target, sibling.length - 1);
17946
17953
  if (target < 0) {
@@ -18879,7 +18886,7 @@ var ObjectPool = /*#__PURE__*/ function() {
18879
18886
  * @internal
18880
18887
  */ var PrimitiveChunkManager = /*#__PURE__*/ function() {
18881
18888
  function PrimitiveChunkManager(engine, maxVertexCount) {
18882
- if (maxVertexCount === void 0) maxVertexCount = PrimitiveChunkManager.MAX_VERTEX_COUNT;
18889
+ if (maxVertexCount === void 0) maxVertexCount = 4096;
18883
18890
  this.engine = engine;
18884
18891
  this.maxVertexCount = maxVertexCount;
18885
18892
  this.primitiveChunks = new Array();
@@ -18920,9 +18927,6 @@ var ObjectPool = /*#__PURE__*/ function() {
18920
18927
  };
18921
18928
  return PrimitiveChunkManager;
18922
18929
  }();
18923
- (function() {
18924
- /** The maximum number of vertex. */ PrimitiveChunkManager.MAX_VERTEX_COUNT = 4096;
18925
- })();
18926
18930
 
18927
18931
  /**
18928
18932
  * @internal
@@ -25666,6 +25670,7 @@ Shader.create(_PostProcessManager.UBER_SHADER_NAME, blitVs, UberPost);
25666
25670
  if (!isRoot) {
25667
25671
  entity._isRoot = true;
25668
25672
  entity._removeFromParent();
25673
+ entity._setTransformDirty();
25669
25674
  }
25670
25675
  // Add or remove from scene's rootEntities
25671
25676
  var oldScene = entity._scene;