@galacean/engine-core 1.1.0-beta.36 → 1.1.0-beta.39

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.
@@ -1838,6 +1838,9 @@ var Logger = {
1838
1838
  var baseline = Math.ceil(context.measureText(TextUtils._measureBaseline).width);
1839
1839
  var height = baseline * TextUtils._heightMultiplier;
1840
1840
  baseline = TextUtils._baselineMultiplier * baseline | 0;
1841
+ var _extendHeight = TextUtils._extendHeight;
1842
+ height += _extendHeight;
1843
+ baseline += _extendHeight * 0.5;
1841
1844
  canvas.width = width;
1842
1845
  canvas.height = height;
1843
1846
  context.font = fontString;
@@ -1872,6 +1875,7 @@ var Logger = {
1872
1875
  }
1873
1876
  if (top !== -1 && bottom !== -1) {
1874
1877
  ascent = baseline - top;
1878
+ // Baseline belong to descent
1875
1879
  descent = bottom - baseline + 1;
1876
1880
  size = ascent + descent;
1877
1881
  }
@@ -1948,9 +1952,8 @@ var Logger = {
1948
1952
  ];
1949
1953
  })();
1950
1954
  (function() {
1951
- // _heightMultiplier used to measure the height of text, but in miniprogram performance is different from h5.
1952
- // so can set _heightMultiplier to adapt miniprogram, the larger the value, the worse the performance.
1953
- /** @internal */ TextUtils._heightMultiplier = 2;
1955
+ // _extendHeight used to extend the height of canvas, because in miniprogram performance is different from h5.
1956
+ /** @internal */ TextUtils._extendHeight = 0;
1954
1957
  })();
1955
1958
  (function() {
1956
1959
  /** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
@@ -1958,6 +1961,9 @@ var Logger = {
1958
1961
  (function() {
1959
1962
  TextUtils._measureBaseline = "M";
1960
1963
  })();
1964
+ (function() {
1965
+ TextUtils._heightMultiplier = 2;
1966
+ })();
1961
1967
  (function() {
1962
1968
  TextUtils._baselineMultiplier = 1.4;
1963
1969
  })();
@@ -8315,7 +8321,7 @@ var BufferUtil = /*#__PURE__*/ function() {
8315
8321
  _this._byteLength = byteLength;
8316
8322
  _this._platformBuffer = engine._hardwareRenderer.createPlatformBuffer(type, byteLength, bufferUsage, data);
8317
8323
  if (readable) {
8318
- var buffer = (data.constructor === ArrayBuffer ? data : data.buffer).slice(0, byteLength);
8324
+ var buffer = data.constructor === ArrayBuffer ? data.slice(0) : data.buffer.slice(data.byteOffset, data.byteOffset + byteLength);
8319
8325
  _this._data = new Uint8Array(buffer);
8320
8326
  }
8321
8327
  }
@@ -16266,6 +16272,7 @@ __decorate([
16266
16272
  this._pointers.length = 0;
16267
16273
  this._downList.length = 0;
16268
16274
  this._upList.length = 0;
16275
+ this._nativeEvents.length = 0;
16269
16276
  }
16270
16277
  };
16271
16278
  /**
@@ -21974,7 +21981,12 @@ var passNum = 0;
21974
21981
  if (componentA.instanceId === componentB.instanceId) {
21975
21982
  return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
21976
21983
  } else {
21977
- return componentA._distanceForSort - componentB._distanceForSort;
21984
+ var distanceDiff = componentA._distanceForSort - componentB._distanceForSort;
21985
+ if (distanceDiff === 0) {
21986
+ return componentA.instanceId - componentB.instanceId;
21987
+ } else {
21988
+ return distanceDiff;
21989
+ }
21978
21990
  }
21979
21991
  };
21980
21992
  /**
@@ -21992,7 +22004,12 @@ var passNum = 0;
21992
22004
  if (componentA.instanceId === componentB.instanceId) {
21993
22005
  return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
21994
22006
  } else {
21995
- return componentB._distanceForSort - componentA._distanceForSort;
22007
+ var distanceDiff = componentB._distanceForSort - componentA._distanceForSort;
22008
+ if (distanceDiff === 0) {
22009
+ return componentA.instanceId - componentB.instanceId;
22010
+ } else {
22011
+ return distanceDiff;
22012
+ }
21996
22013
  }
21997
22014
  };
21998
22015
  return RenderQueue;
package/dist/module.js CHANGED
@@ -1833,6 +1833,9 @@ var Logger = {
1833
1833
  var baseline = Math.ceil(context.measureText(TextUtils._measureBaseline).width);
1834
1834
  var height = baseline * TextUtils._heightMultiplier;
1835
1835
  baseline = TextUtils._baselineMultiplier * baseline | 0;
1836
+ var _extendHeight = TextUtils._extendHeight;
1837
+ height += _extendHeight;
1838
+ baseline += _extendHeight * 0.5;
1836
1839
  canvas.width = width;
1837
1840
  canvas.height = height;
1838
1841
  context.font = fontString;
@@ -1867,6 +1870,7 @@ var Logger = {
1867
1870
  }
1868
1871
  if (top !== -1 && bottom !== -1) {
1869
1872
  ascent = baseline - top;
1873
+ // Baseline belong to descent
1870
1874
  descent = bottom - baseline + 1;
1871
1875
  size = ascent + descent;
1872
1876
  }
@@ -1943,9 +1947,8 @@ var Logger = {
1943
1947
  ];
1944
1948
  })();
1945
1949
  (function() {
1946
- // _heightMultiplier used to measure the height of text, but in miniprogram performance is different from h5.
1947
- // so can set _heightMultiplier to adapt miniprogram, the larger the value, the worse the performance.
1948
- /** @internal */ TextUtils._heightMultiplier = 2;
1950
+ // _extendHeight used to extend the height of canvas, because in miniprogram performance is different from h5.
1951
+ /** @internal */ TextUtils._extendHeight = 0;
1949
1952
  })();
1950
1953
  (function() {
1951
1954
  /** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
@@ -1953,6 +1956,9 @@ var Logger = {
1953
1956
  (function() {
1954
1957
  TextUtils._measureBaseline = "M";
1955
1958
  })();
1959
+ (function() {
1960
+ TextUtils._heightMultiplier = 2;
1961
+ })();
1956
1962
  (function() {
1957
1963
  TextUtils._baselineMultiplier = 1.4;
1958
1964
  })();
@@ -8310,7 +8316,7 @@ var BufferUtil = /*#__PURE__*/ function() {
8310
8316
  _this._byteLength = byteLength;
8311
8317
  _this._platformBuffer = engine._hardwareRenderer.createPlatformBuffer(type, byteLength, bufferUsage, data);
8312
8318
  if (readable) {
8313
- var buffer = (data.constructor === ArrayBuffer ? data : data.buffer).slice(0, byteLength);
8319
+ var buffer = data.constructor === ArrayBuffer ? data.slice(0) : data.buffer.slice(data.byteOffset, data.byteOffset + byteLength);
8314
8320
  _this._data = new Uint8Array(buffer);
8315
8321
  }
8316
8322
  }
@@ -16261,6 +16267,7 @@ __decorate([
16261
16267
  this._pointers.length = 0;
16262
16268
  this._downList.length = 0;
16263
16269
  this._upList.length = 0;
16270
+ this._nativeEvents.length = 0;
16264
16271
  }
16265
16272
  };
16266
16273
  /**
@@ -21969,7 +21976,12 @@ var passNum = 0;
21969
21976
  if (componentA.instanceId === componentB.instanceId) {
21970
21977
  return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
21971
21978
  } else {
21972
- return componentA._distanceForSort - componentB._distanceForSort;
21979
+ var distanceDiff = componentA._distanceForSort - componentB._distanceForSort;
21980
+ if (distanceDiff === 0) {
21981
+ return componentA.instanceId - componentB.instanceId;
21982
+ } else {
21983
+ return distanceDiff;
21984
+ }
21973
21985
  }
21974
21986
  };
21975
21987
  /**
@@ -21987,7 +21999,12 @@ var passNum = 0;
21987
21999
  if (componentA.instanceId === componentB.instanceId) {
21988
22000
  return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
21989
22001
  } else {
21990
- return componentB._distanceForSort - componentA._distanceForSort;
22002
+ var distanceDiff = componentB._distanceForSort - componentA._distanceForSort;
22003
+ if (distanceDiff === 0) {
22004
+ return componentA.instanceId - componentB.instanceId;
22005
+ } else {
22006
+ return distanceDiff;
22007
+ }
21991
22008
  }
21992
22009
  };
21993
22010
  return RenderQueue;