@galacean/engine 1.3.3 → 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/browser.js CHANGED
@@ -15967,9 +15967,12 @@
15967
15967
  // Safari gets data confusion through getImageData when the canvas width is not an integer.
15968
15968
  // The measure text width of some special invisible characters may be 0, so make sure the width is at least 1.
15969
15969
  // @todo: Text layout may vary from standard and not support emoji.
15970
- var textMetrics = context.measureText(measureString);
15970
+ var _context_measureText = context.measureText(measureString), actualBoundingBoxLeft = _context_measureText.actualBoundingBoxLeft, actualBoundingBoxRight = _context_measureText.actualBoundingBoxRight, actualWidth = _context_measureText.width;
15971
15971
  // In some case (ex: " "), actualBoundingBoxRight and actualBoundingBoxLeft will be 0, so use width.
15972
- var width = Math.max(1, Math.round(textMetrics.actualBoundingBoxRight - textMetrics.actualBoundingBoxLeft || textMetrics.width));
15972
+ // TODO: With testing, actualBoundingBoxLeft + actualBoundingBoxRight is the actual rendering width
15973
+ // but the space rules between characters are unclear. Using actualBoundingBoxRight + Math.abs(actualBoundingBoxLeft) is the closest to the native effect.
15974
+ var width = Math.max(1, Math.round(Math.max(actualBoundingBoxRight + Math.abs(actualBoundingBoxLeft), actualWidth)));
15975
+ // Make sure enough width.
15973
15976
  var baseline = Math.ceil(context.measureText(TextUtils._measureBaseline).width);
15974
15977
  var height = baseline * TextUtils._heightMultiplier;
15975
15978
  baseline = TextUtils._baselineMultiplier * baseline | 0;
@@ -15983,7 +15986,11 @@
15983
15986
  context.clearRect(0, 0, width, height);
15984
15987
  context.textBaseline = "middle";
15985
15988
  context.fillStyle = "#fff";
15986
- context.fillText(measureString, 0, baseline);
15989
+ if (actualBoundingBoxLeft > 0) {
15990
+ context.fillText(measureString, actualBoundingBoxLeft, baseline);
15991
+ } else {
15992
+ context.fillText(measureString, 0, baseline);
15993
+ }
15987
15994
  var colorData = context.getImageData(0, 0, width, height).data;
15988
15995
  var len = colorData.length;
15989
15996
  var top = -1;
@@ -16027,9 +16034,9 @@
16027
16034
  y: 0,
16028
16035
  w: width,
16029
16036
  h: size,
16030
- offsetX: 0,
16037
+ offsetX: actualBoundingBoxLeft > 0 ? actualBoundingBoxLeft : 0,
16031
16038
  offsetY: (ascent - descent) * 0.5,
16032
- xAdvance: width,
16039
+ xAdvance: Math.round(actualWidth),
16033
16040
  uvs: [
16034
16041
  new Vector2(),
16035
16042
  new Vector2(),
@@ -16594,7 +16601,7 @@
16594
16601
  j === firstRow && (minX = Math.min(minX, left));
16595
16602
  maxX = Math.max(maxX, right);
16596
16603
  }
16597
- startX += charInfo.xAdvance;
16604
+ startX += charInfo.xAdvance + charInfo.offsetX;
16598
16605
  }
16599
16606
  }
16600
16607
  startY -= lineHeight;
@@ -17411,8 +17418,6 @@
17411
17418
  _this = ReferResource1.call(this, engine) || this;
17412
17419
  /** @internal */ _this._renderStates = [] // todo: later will as a part of shaderData when shader effect frame is OK, that is more powerful and flexible.
17413
17420
  ;
17414
- /** @internal */ _this._priority = 0 // todo: temporary resolution of submesh rendering order issue.
17415
- ;
17416
17421
  _this._shaderData = new ShaderData(ShaderDataGroup.Material);
17417
17422
  _this.shader = shader;
17418
17423
  return _this;
@@ -23619,12 +23624,12 @@
23619
23624
  /**
23620
23625
  * @internal
23621
23626
  */ var PrimitiveChunkManager = /*#__PURE__*/ function() {
23622
- function PrimitiveChunkManager(engine, maxVertexCount) {
23623
- if (maxVertexCount === void 0) maxVertexCount = PrimitiveChunkManager.MAX_VERTEX_COUNT;
23627
+ var PrimitiveChunkManager = function PrimitiveChunkManager(engine, maxVertexCount) {
23628
+ if (maxVertexCount === void 0) maxVertexCount = 4096;
23624
23629
  this.engine = engine;
23625
23630
  this.maxVertexCount = maxVertexCount;
23626
23631
  this.primitiveChunks = new Array();
23627
- }
23632
+ };
23628
23633
  var _proto = PrimitiveChunkManager.prototype;
23629
23634
  _proto.allocateSubChunk = function allocateSubChunk(vertexCount) {
23630
23635
  var _primitiveChunks, _length;
@@ -23661,9 +23666,6 @@
23661
23666
  };
23662
23667
  return PrimitiveChunkManager;
23663
23668
  }();
23664
- (function() {
23665
- /** The maximum number of vertex. */ PrimitiveChunkManager.MAX_VERTEX_COUNT = 4096;
23666
- })();
23667
23669
  /**
23668
23670
  * @internal
23669
23671
  */ var BatcherManager = /*#__PURE__*/ function() {
@@ -48070,7 +48072,7 @@
48070
48072
  ], EXT_texture_webp);
48071
48073
 
48072
48074
  //@ts-ignore
48073
- var version = "1.3.3";
48075
+ var version = "1.3.5";
48074
48076
  console.log("Galacean engine version: " + version);
48075
48077
  for(var key in CoreObjects){
48076
48078
  Loader.registerClass(key, CoreObjects[key]);