@galacean/engine-core 1.0.0-beta.16 → 1.0.0-beta.18

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
@@ -1598,6 +1598,11 @@ var Logger = {
1598
1598
  subFont.nativeFontString = fontString;
1599
1599
  for(var i = 0, n = subTexts.length; i < n; i++){
1600
1600
  var subText = subTexts[i];
1601
+ // If subText is empty, push an empty line directly
1602
+ if (subText.length === 0) {
1603
+ this._pushLine(lines, lineWidths, lineMaxSizes, "", 0, 0, 0);
1604
+ continue;
1605
+ }
1601
1606
  var word = "";
1602
1607
  var wordWidth = 0;
1603
1608
  var wordMaxAscent = 0;
@@ -1625,7 +1630,10 @@ var Logger = {
1625
1630
  // If it is a word before, need to handle the previous word and line
1626
1631
  if (word.length > 0) {
1627
1632
  if (lineWidth + wordWidth > wrapWidth) {
1628
- this._pushLine(lines, lineWidths, lineMaxSizes, line, lineWidth, lineMaxAscent, lineMaxDescent);
1633
+ // Push if before line is not empty
1634
+ if (lineWidth > 0) {
1635
+ this._pushLine(lines, lineWidths, lineMaxSizes, line, lineWidth, lineMaxAscent, lineMaxDescent);
1636
+ }
1629
1637
  textWidth = Math.max(textWidth, lineWidth);
1630
1638
  notFirstLine = true;
1631
1639
  line = word;
@@ -1670,7 +1678,10 @@ var Logger = {
1670
1678
  line = "";
1671
1679
  lineWidth = lineMaxAscent = lineMaxDescent = 0;
1672
1680
  }
1673
- this._pushLine(lines, lineWidths, lineMaxSizes, word, wordWidth, wordMaxAscent, wordMaxDescent);
1681
+ // Push if before word is not empty
1682
+ if (wordWidth > 0) {
1683
+ this._pushLine(lines, lineWidths, lineMaxSizes, word, wordWidth, wordMaxAscent, wordMaxDescent);
1684
+ }
1674
1685
  textWidth = Math.max(textWidth, wordWidth);
1675
1686
  notFirstLine = true;
1676
1687
  word = char;
@@ -1689,11 +1700,15 @@ var Logger = {
1689
1700
  // If the total width from line and word exceed wrap width
1690
1701
  if (lineWidth + wordWidth > wrapWidth) {
1691
1702
  // Push chars to a single line
1692
- this._pushLine(lines, lineWidths, lineMaxSizes, line, lineWidth, lineMaxAscent, lineMaxDescent);
1703
+ if (lineWidth > 0) {
1704
+ this._pushLine(lines, lineWidths, lineMaxSizes, line, lineWidth, lineMaxAscent, lineMaxDescent);
1705
+ }
1693
1706
  textWidth = Math.max(textWidth, lineWidth);
1694
1707
  lineWidth = 0;
1695
1708
  // Push word to a single line
1696
- this._pushLine(lines, lineWidths, lineMaxSizes, word, wordWidth, wordMaxAscent, wordMaxDescent);
1709
+ if (wordWidth > 0) {
1710
+ this._pushLine(lines, lineWidths, lineMaxSizes, word, wordWidth, wordMaxAscent, wordMaxDescent);
1711
+ }
1697
1712
  textWidth = Math.max(textWidth, wordWidth);
1698
1713
  } else {
1699
1714
  // Merge to chars
@@ -1725,23 +1740,20 @@ var Logger = {
1725
1740
  var subFont = renderer._subFont;
1726
1741
  var fontString = subFont.nativeFontString;
1727
1742
  var fontSizeInfo = TextUtils.measureFont(fontString);
1728
- var lines = renderer.text.split(/(?:\r\n|\r|\n)/);
1729
- var lineCount = lines.length;
1743
+ var subTexts = renderer.text.split(/(?:\r\n|\r|\n)/);
1744
+ var textCount = subTexts.length;
1745
+ var lines = new Array();
1730
1746
  var lineWidths = new Array();
1731
1747
  var lineMaxSizes = new Array();
1732
1748
  var _pixelsPerUnit = Engine._pixelsPerUnit;
1733
1749
  var lineHeight = fontSizeInfo.size + renderer.lineSpacing * _pixelsPerUnit;
1734
1750
  var width = 0;
1735
- var height = renderer.height * _pixelsPerUnit;
1736
- if (renderer.overflowMode === exports.OverflowMode.Overflow) {
1737
- height = lineHeight * lineCount;
1738
- }
1739
1751
  subFont.nativeFontString = fontString;
1740
- for(var i = 0; i < lineCount; ++i){
1741
- var line = lines[i];
1752
+ for(var i = 0; i < textCount; ++i){
1753
+ var line = subTexts[i];
1742
1754
  var curWidth = 0;
1743
- var maxAscent = -1;
1744
- var maxDescent = -1;
1755
+ var maxAscent = 0;
1756
+ var maxDescent = 0;
1745
1757
  for(var j = 0, m = line.length; j < m; ++j){
1746
1758
  var charInfo = TextUtils._getCharInfo(line[j], fontString, subFont);
1747
1759
  curWidth += charInfo.xAdvance;
@@ -1752,16 +1764,15 @@ var Logger = {
1752
1764
  maxAscent < ascent && (maxAscent = ascent);
1753
1765
  maxDescent < descent && (maxDescent = descent);
1754
1766
  }
1755
- lineWidths[i] = curWidth;
1756
- lineMaxSizes[i] = {
1757
- ascent: maxAscent,
1758
- descent: maxDescent,
1759
- size: maxAscent + maxDescent
1760
- };
1761
- if (curWidth > width) {
1762
- width = curWidth;
1767
+ if (curWidth > 0) {
1768
+ this._pushLine(lines, lineWidths, lineMaxSizes, line, curWidth, maxAscent, maxDescent);
1769
+ width = Math.max(width, curWidth);
1763
1770
  }
1764
1771
  }
1772
+ var height = renderer.height * _pixelsPerUnit;
1773
+ if (renderer.overflowMode === exports.OverflowMode.Overflow) {
1774
+ height = lineHeight * lines.length;
1775
+ }
1765
1776
  return {
1766
1777
  width: width,
1767
1778
  height: height,
@@ -2614,7 +2625,6 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
2614
2625
  function EventDispatcher() {
2615
2626
  this._events = Object.create(null);
2616
2627
  this._eventCount = 0;
2617
- this._dispatchingListeners = [];
2618
2628
  }
2619
2629
  var _proto = EventDispatcher.prototype;
2620
2630
  /**
@@ -2654,7 +2664,8 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
2654
2664
  if (Array.isArray(listeners)) {
2655
2665
  var count = listeners.length;
2656
2666
  // cloning list to avoid structure breaking
2657
- var dispatchingListeners = this._dispatchingListeners;
2667
+ var pool = EventDispatcher._dispatchingListenersPool;
2668
+ var dispatchingListeners = pool.length > 0 ? pool.pop() : [];
2658
2669
  dispatchingListeners.length = count;
2659
2670
  for(var i = 0; i < count; i++){
2660
2671
  dispatchingListeners[i] = listeners[i];
@@ -2668,6 +2679,7 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
2668
2679
  }
2669
2680
  // remove hooked function to avoid gc problem
2670
2681
  dispatchingListeners.length = 0;
2682
+ pool.push(dispatchingListeners);
2671
2683
  } else {
2672
2684
  if (listeners.once) this.off(event, listeners.fn);
2673
2685
  listeners.fn(data);
@@ -2768,6 +2780,9 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
2768
2780
  };
2769
2781
  return EventDispatcher;
2770
2782
  }();
2783
+ (function() {
2784
+ EventDispatcher._dispatchingListenersPool = [];
2785
+ })();
2771
2786
 
2772
2787
  /**
2773
2788
  * Shader property.
@@ -4767,6 +4782,7 @@ var ComponentCloner = /*#__PURE__*/ function() {
4767
4782
  cloneEntity._hookResource = hookResource;
4768
4783
  hookResource._addReferCount(1);
4769
4784
  }
4785
+ cloneEntity.layer = this.layer;
4770
4786
  cloneEntity._isActive = this._isActive;
4771
4787
  cloneEntity.transform.localMatrix = this.transform.localMatrix;
4772
4788
  var children = this._children;
@@ -13734,6 +13750,15 @@ var VertexChangedFlags;
13734
13750
  };
13735
13751
  /**
13736
13752
  * @internal
13753
+ */ _proto._prepareRender = function _prepareRender(context) {
13754
+ if (!this._mesh) {
13755
+ Logger.error("mesh is null.");
13756
+ return;
13757
+ }
13758
+ Renderer.prototype._prepareRender.call(this, context);
13759
+ };
13760
+ /**
13761
+ * @internal
13737
13762
  */ _proto._cloneTo = function _cloneTo(target) {
13738
13763
  Renderer.prototype._cloneTo.call(this, target);
13739
13764
  target.mesh = this._mesh;
@@ -13755,49 +13780,45 @@ var VertexChangedFlags;
13755
13780
  * @internal
13756
13781
  */ _proto._render = function _render(context) {
13757
13782
  var mesh = this._mesh;
13758
- if (mesh) {
13759
- if (this._dirtyUpdateFlag & 0x2) {
13760
- var shaderData = this.shaderData;
13761
- var vertexElements = mesh._vertexElements;
13762
- shaderData.disableMacro(MeshRenderer._uvMacro);
13763
- shaderData.disableMacro(MeshRenderer._uv1Macro);
13764
- shaderData.disableMacro(MeshRenderer._normalMacro);
13765
- shaderData.disableMacro(MeshRenderer._tangentMacro);
13766
- shaderData.disableMacro(MeshRenderer._enableVertexColorMacro);
13767
- for(var i = 0, n = vertexElements.length; i < n; i++){
13768
- switch(vertexElements[i].semantic){
13769
- case "TEXCOORD_0":
13770
- shaderData.enableMacro(MeshRenderer._uvMacro);
13771
- break;
13772
- case "TEXCOORD_1":
13773
- shaderData.enableMacro(MeshRenderer._uv1Macro);
13774
- break;
13775
- case "NORMAL":
13776
- shaderData.enableMacro(MeshRenderer._normalMacro);
13777
- break;
13778
- case "TANGENT":
13779
- shaderData.enableMacro(MeshRenderer._tangentMacro);
13780
- break;
13781
- case "COLOR_0":
13782
- this._enableVertexColor && shaderData.enableMacro(MeshRenderer._enableVertexColorMacro);
13783
- break;
13784
- }
13783
+ if (this._dirtyUpdateFlag & 0x2) {
13784
+ var shaderData = this.shaderData;
13785
+ var vertexElements = mesh._vertexElements;
13786
+ shaderData.disableMacro(MeshRenderer._uvMacro);
13787
+ shaderData.disableMacro(MeshRenderer._uv1Macro);
13788
+ shaderData.disableMacro(MeshRenderer._normalMacro);
13789
+ shaderData.disableMacro(MeshRenderer._tangentMacro);
13790
+ shaderData.disableMacro(MeshRenderer._enableVertexColorMacro);
13791
+ for(var i = 0, n = vertexElements.length; i < n; i++){
13792
+ switch(vertexElements[i].semantic){
13793
+ case "TEXCOORD_0":
13794
+ shaderData.enableMacro(MeshRenderer._uvMacro);
13795
+ break;
13796
+ case "TEXCOORD_1":
13797
+ shaderData.enableMacro(MeshRenderer._uv1Macro);
13798
+ break;
13799
+ case "NORMAL":
13800
+ shaderData.enableMacro(MeshRenderer._normalMacro);
13801
+ break;
13802
+ case "TANGENT":
13803
+ shaderData.enableMacro(MeshRenderer._tangentMacro);
13804
+ break;
13805
+ case "COLOR_0":
13806
+ this._enableVertexColor && shaderData.enableMacro(MeshRenderer._enableVertexColorMacro);
13807
+ break;
13785
13808
  }
13786
- this._dirtyUpdateFlag &= ~0x2;
13787
13809
  }
13788
- var materials = this._materials;
13789
- var subMeshes = mesh.subMeshes;
13790
- var renderPipeline = context.camera._renderPipeline;
13791
- var meshRenderDataPool = this._engine._meshRenderDataPool;
13792
- for(var i1 = 0, n1 = subMeshes.length; i1 < n1; i1++){
13793
- var material = materials[i1];
13794
- if (!material) continue;
13795
- var renderData = meshRenderDataPool.getFromPool();
13796
- renderData.set(this, material, mesh, subMeshes[i1]);
13797
- renderPipeline.pushRenderData(context, renderData);
13798
- }
13799
- } else {
13800
- Logger.error("mesh is null.");
13810
+ this._dirtyUpdateFlag &= ~0x2;
13811
+ }
13812
+ var materials = this._materials;
13813
+ var subMeshes = mesh.subMeshes;
13814
+ var renderPipeline = context.camera._renderPipeline;
13815
+ var meshRenderDataPool = this._engine._meshRenderDataPool;
13816
+ for(var i1 = 0, n1 = subMeshes.length; i1 < n1; i1++){
13817
+ var material = materials[i1];
13818
+ if (!material) continue;
13819
+ var renderData = meshRenderDataPool.getFromPool();
13820
+ renderData.set(this, material, mesh, subMeshes[i1]);
13821
+ renderPipeline.pushRenderData(context, renderData);
13801
13822
  }
13802
13823
  };
13803
13824
  _proto._setMesh = function _setMesh(mesh) {
@@ -19556,18 +19577,10 @@ var defaultInterval = 500;
19556
19577
  var _config_type;
19557
19578
  config.type = (_config_type = config.type) != null ? _config_type : getMimeTypeFromUrl(url);
19558
19579
  var realRequest = config.type === "image" ? requestImage : requestRes;
19559
- var lastError;
19560
19580
  var executor = new MultiExecutor(function() {
19561
- return realRequest(url, config).onProgress(setProgress).then(function(res) {
19562
- resolve(res);
19563
- executor.stop();
19564
- }).catch(function(err) {
19565
- return lastError = err;
19566
- });
19581
+ return realRequest(url, config).onProgress(setProgress);
19567
19582
  }, retryCount, retryInterval);
19568
- executor.start(function() {
19569
- reject(lastError);
19570
- });
19583
+ executor.start().onError(reject).onComplete(resolve);
19571
19584
  });
19572
19585
  }
19573
19586
  function requestImage(url, config) {
@@ -19654,23 +19667,33 @@ var MultiExecutor = /*#__PURE__*/ function() {
19654
19667
  this.exec = this.exec.bind(this);
19655
19668
  }
19656
19669
  var _proto = MultiExecutor.prototype;
19657
- _proto.start = function start(done) {
19658
- this.done = done;
19670
+ _proto.start = function start() {
19659
19671
  this.exec();
19672
+ return this;
19660
19673
  };
19661
- _proto.stop = function stop() {
19662
- clearTimeout(this._timeoutId);
19674
+ _proto.onComplete = function onComplete(func) {
19675
+ this._onComplete = func;
19676
+ return this;
19677
+ };
19678
+ _proto.onError = function onError(func) {
19679
+ this._onError = func;
19680
+ return this;
19681
+ };
19682
+ _proto.cancel = function cancel() {
19683
+ window.clearTimeout(this._timeoutId);
19663
19684
  };
19664
19685
  _proto.exec = function exec() {
19665
19686
  var _this = this;
19666
19687
  if (this._currentCount >= this.totalCount) {
19667
- this.done && this.done();
19688
+ this._onError && this._onError(this._error);
19668
19689
  return;
19669
19690
  }
19670
19691
  this._currentCount++;
19671
- this.execFunc(this._currentCount).then(function() {
19672
- //@ts-ignore
19673
- _this._timeoutId = setTimeout(_this.exec, _this.interval);
19692
+ this.execFunc(this._currentCount).then(function(result) {
19693
+ return _this._onComplete && _this._onComplete(result);
19694
+ }).catch(function(e) {
19695
+ _this._error = e;
19696
+ _this._timeoutId = window.setTimeout(_this.exec, _this.interval);
19674
19697
  });
19675
19698
  };
19676
19699
  return MultiExecutor;
@@ -22303,92 +22326,97 @@ var /**
22303
22326
  }
22304
22327
  };
22305
22328
  _proto._updateLocalData = function _updateLocalData() {
22306
- var _this = this, color = _this.color, horizontalAlignment = _this.horizontalAlignment, verticalAlignment = _this.verticalAlignment, charRenderDatas = _this._charRenderDatas;
22329
+ var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
22307
22330
  var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
22308
- var _pixelsPerUnit = Engine._pixelsPerUnit;
22309
- var pixelsPerUnitReciprocal = 1.0 / _pixelsPerUnit;
22310
- var charFont = this._subFont;
22311
- var rendererWidth = this.width * _pixelsPerUnit;
22312
- var halfRendererWidth = rendererWidth * 0.5;
22313
- var rendererHeight = this.height * _pixelsPerUnit;
22314
22331
  var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
22315
22332
  var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
22316
22333
  var charRenderDataPool = TextRenderer._charRenderDataPool;
22317
- var halfLineHeight = lineHeight * 0.5;
22318
22334
  var linesLen = lines.length;
22319
- var startY = 0;
22320
- var topDiff = lineHeight * 0.5 - lineMaxSizes[0].ascent;
22321
- var bottomDiff = lineHeight * 0.5 - lineMaxSizes[linesLen - 1].descent - 1;
22322
- switch(verticalAlignment){
22323
- case exports.TextVerticalAlignment.Top:
22324
- startY = rendererHeight * 0.5 - halfLineHeight + topDiff;
22325
- break;
22326
- case exports.TextVerticalAlignment.Center:
22327
- startY = height * 0.5 - halfLineHeight - (bottomDiff - topDiff) * 0.5;
22328
- break;
22329
- case exports.TextVerticalAlignment.Bottom:
22330
- startY = height - rendererHeight * 0.5 - halfLineHeight - bottomDiff;
22331
- break;
22332
- }
22333
22335
  var renderDataCount = 0;
22334
- var firstLine = -1;
22335
- var minX = Number.MAX_SAFE_INTEGER;
22336
- var minY = Number.MAX_SAFE_INTEGER;
22337
- var maxX = Number.MIN_SAFE_INTEGER;
22338
- var maxY = Number.MIN_SAFE_INTEGER;
22339
- for(var i = 0; i < linesLen; ++i){
22340
- var lineWidth = lineWidths[i];
22341
- if (lineWidth > 0) {
22342
- var line = lines[i];
22343
- var startX = 0;
22344
- var firstRow = -1;
22345
- if (firstLine < 0) {
22346
- firstLine = i;
22347
- }
22348
- switch(horizontalAlignment){
22349
- case exports.TextHorizontalAlignment.Left:
22350
- startX = -halfRendererWidth;
22351
- break;
22352
- case exports.TextHorizontalAlignment.Center:
22353
- startX = -lineWidth * 0.5;
22354
- break;
22355
- case exports.TextHorizontalAlignment.Right:
22356
- startX = halfRendererWidth - lineWidth;
22357
- break;
22358
- }
22359
- for(var j = 0, n = line.length; j < n; ++j){
22360
- var char = line[j];
22361
- var charInfo = charFont._getCharInfo(char);
22362
- if (charInfo.h > 0) {
22363
- var _charRenderDatas, _ref;
22364
- firstRow < 0 && (firstRow = j);
22365
- var charRenderData = (_charRenderDatas = charRenderDatas)[_ref = renderDataCount++] || (_charRenderDatas[_ref] = charRenderDataPool.get());
22366
- var renderData = charRenderData.renderData, localPositions = charRenderData.localPositions;
22367
- charRenderData.texture = charFont._getTextureByIndex(charInfo.index);
22368
- renderData.color = color;
22369
- renderData.uvs = charInfo.uvs;
22370
- var w = charInfo.w, ascent = charInfo.ascent, descent = charInfo.descent;
22371
- var left = startX * pixelsPerUnitReciprocal;
22372
- var right = (startX + w) * pixelsPerUnitReciprocal;
22373
- var top = (startY + ascent) * pixelsPerUnitReciprocal;
22374
- var bottom = (startY - descent + 1) * pixelsPerUnitReciprocal;
22375
- localPositions.set(left, top, right, bottom);
22376
- i === firstLine && (maxY = Math.max(maxY, top));
22377
- minY = Math.min(minY, bottom);
22378
- j === firstRow && (minX = Math.min(minX, left));
22379
- maxX = Math.max(maxX, right);
22336
+ if (linesLen > 0) {
22337
+ var _pixelsPerUnit = Engine._pixelsPerUnit;
22338
+ var horizontalAlignment = this.horizontalAlignment;
22339
+ var pixelsPerUnitReciprocal = 1.0 / _pixelsPerUnit;
22340
+ var rendererWidth = this.width * _pixelsPerUnit;
22341
+ var halfRendererWidth = rendererWidth * 0.5;
22342
+ var rendererHeight = this.height * _pixelsPerUnit;
22343
+ var halfLineHeight = lineHeight * 0.5;
22344
+ var startY = 0;
22345
+ var topDiff = lineHeight * 0.5 - lineMaxSizes[0].ascent;
22346
+ var bottomDiff = lineHeight * 0.5 - lineMaxSizes[linesLen - 1].descent - 1;
22347
+ switch(this.verticalAlignment){
22348
+ case exports.TextVerticalAlignment.Top:
22349
+ startY = rendererHeight * 0.5 - halfLineHeight + topDiff;
22350
+ break;
22351
+ case exports.TextVerticalAlignment.Center:
22352
+ startY = height * 0.5 - halfLineHeight - (bottomDiff - topDiff) * 0.5;
22353
+ break;
22354
+ case exports.TextVerticalAlignment.Bottom:
22355
+ startY = height - rendererHeight * 0.5 - halfLineHeight - bottomDiff;
22356
+ break;
22357
+ }
22358
+ var firstLine = -1;
22359
+ var minX = Number.MAX_SAFE_INTEGER;
22360
+ var minY = Number.MAX_SAFE_INTEGER;
22361
+ var maxX = Number.MIN_SAFE_INTEGER;
22362
+ var maxY = Number.MIN_SAFE_INTEGER;
22363
+ for(var i = 0; i < linesLen; ++i){
22364
+ var lineWidth = lineWidths[i];
22365
+ if (lineWidth > 0) {
22366
+ var line = lines[i];
22367
+ var startX = 0;
22368
+ var firstRow = -1;
22369
+ if (firstLine < 0) {
22370
+ firstLine = i;
22371
+ }
22372
+ switch(horizontalAlignment){
22373
+ case exports.TextHorizontalAlignment.Left:
22374
+ startX = -halfRendererWidth;
22375
+ break;
22376
+ case exports.TextHorizontalAlignment.Center:
22377
+ startX = -lineWidth * 0.5;
22378
+ break;
22379
+ case exports.TextHorizontalAlignment.Right:
22380
+ startX = halfRendererWidth - lineWidth;
22381
+ break;
22382
+ }
22383
+ for(var j = 0, n = line.length; j < n; ++j){
22384
+ var char = line[j];
22385
+ var charInfo = charFont._getCharInfo(char);
22386
+ if (charInfo.h > 0) {
22387
+ var _charRenderDatas, _ref;
22388
+ firstRow < 0 && (firstRow = j);
22389
+ var charRenderData = (_charRenderDatas = charRenderDatas)[_ref = renderDataCount++] || (_charRenderDatas[_ref] = charRenderDataPool.get());
22390
+ var renderData = charRenderData.renderData, localPositions = charRenderData.localPositions;
22391
+ charRenderData.texture = charFont._getTextureByIndex(charInfo.index);
22392
+ renderData.color = color;
22393
+ renderData.uvs = charInfo.uvs;
22394
+ var w = charInfo.w, ascent = charInfo.ascent, descent = charInfo.descent;
22395
+ var left = startX * pixelsPerUnitReciprocal;
22396
+ var right = (startX + w) * pixelsPerUnitReciprocal;
22397
+ var top = (startY + ascent) * pixelsPerUnitReciprocal;
22398
+ var bottom = (startY - descent + 1) * pixelsPerUnitReciprocal;
22399
+ localPositions.set(left, top, right, bottom);
22400
+ i === firstLine && (maxY = Math.max(maxY, top));
22401
+ minY = Math.min(minY, bottom);
22402
+ j === firstRow && (minX = Math.min(minX, left));
22403
+ maxX = Math.max(maxX, right);
22404
+ }
22405
+ startX += charInfo.xAdvance;
22380
22406
  }
22381
- startX += charInfo.xAdvance;
22382
22407
  }
22408
+ startY -= lineHeight;
22383
22409
  }
22384
- startY -= lineHeight;
22385
- }
22386
- if (firstLine < 0) {
22410
+ if (firstLine < 0) {
22411
+ min.set(0, 0, 0);
22412
+ max.set(0, 0, 0);
22413
+ } else {
22414
+ min.set(minX, minY, 0);
22415
+ max.set(maxX, maxY, 0);
22416
+ }
22417
+ } else {
22387
22418
  min.set(0, 0, 0);
22388
22419
  max.set(0, 0, 0);
22389
- } else {
22390
- min.set(minX, minY, 0);
22391
- max.set(maxX, maxY, 0);
22392
22420
  }
22393
22421
  // Revert excess render data to pool.
22394
22422
  var lastRenderDataCount = charRenderDatas.length;
@@ -24404,7 +24432,8 @@ exports.AnimatorLayerBlendingMode = void 0;
24404
24432
  };
24405
24433
  _proto._saveAnimatorEventHandlers = function _saveAnimatorEventHandlers(state, animatorStateData) {
24406
24434
  var eventHandlerPool = this._animationEventHandlerPool;
24407
- var scripts = this._entity._scripts;
24435
+ var scripts = [];
24436
+ this._entity.getComponents(Script, scripts);
24408
24437
  var scriptCount = scripts.length;
24409
24438
  var eventHandlers = animatorStateData.eventHandlers;
24410
24439
  var events = state.clip.events;
@@ -24417,7 +24446,7 @@ exports.AnimatorLayerBlendingMode = void 0;
24417
24446
  eventHandler.event = event;
24418
24447
  handlers.length = 0;
24419
24448
  for(var j = scriptCount - 1; j >= 0; j--){
24420
- var handler = scripts.get(j)[funcName];
24449
+ var handler = scripts[j][funcName];
24421
24450
  handler && handlers.push(handler);
24422
24451
  }
24423
24452
  eventHandlers.push(eventHandler);