@galacean/engine-core 1.0.0-beta.17 → 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/module.js CHANGED
@@ -1594,6 +1594,11 @@ var Logger = {
1594
1594
  subFont.nativeFontString = fontString;
1595
1595
  for(var i = 0, n = subTexts.length; i < n; i++){
1596
1596
  var subText = subTexts[i];
1597
+ // If subText is empty, push an empty line directly
1598
+ if (subText.length === 0) {
1599
+ this._pushLine(lines, lineWidths, lineMaxSizes, "", 0, 0, 0);
1600
+ continue;
1601
+ }
1597
1602
  var word = "";
1598
1603
  var wordWidth = 0;
1599
1604
  var wordMaxAscent = 0;
@@ -1621,7 +1626,10 @@ var Logger = {
1621
1626
  // If it is a word before, need to handle the previous word and line
1622
1627
  if (word.length > 0) {
1623
1628
  if (lineWidth + wordWidth > wrapWidth) {
1624
- this._pushLine(lines, lineWidths, lineMaxSizes, line, lineWidth, lineMaxAscent, lineMaxDescent);
1629
+ // Push if before line is not empty
1630
+ if (lineWidth > 0) {
1631
+ this._pushLine(lines, lineWidths, lineMaxSizes, line, lineWidth, lineMaxAscent, lineMaxDescent);
1632
+ }
1625
1633
  textWidth = Math.max(textWidth, lineWidth);
1626
1634
  notFirstLine = true;
1627
1635
  line = word;
@@ -1666,7 +1674,10 @@ var Logger = {
1666
1674
  line = "";
1667
1675
  lineWidth = lineMaxAscent = lineMaxDescent = 0;
1668
1676
  }
1669
- this._pushLine(lines, lineWidths, lineMaxSizes, word, wordWidth, wordMaxAscent, wordMaxDescent);
1677
+ // Push if before word is not empty
1678
+ if (wordWidth > 0) {
1679
+ this._pushLine(lines, lineWidths, lineMaxSizes, word, wordWidth, wordMaxAscent, wordMaxDescent);
1680
+ }
1670
1681
  textWidth = Math.max(textWidth, wordWidth);
1671
1682
  notFirstLine = true;
1672
1683
  word = char;
@@ -1685,11 +1696,15 @@ var Logger = {
1685
1696
  // If the total width from line and word exceed wrap width
1686
1697
  if (lineWidth + wordWidth > wrapWidth) {
1687
1698
  // Push chars to a single line
1688
- this._pushLine(lines, lineWidths, lineMaxSizes, line, lineWidth, lineMaxAscent, lineMaxDescent);
1699
+ if (lineWidth > 0) {
1700
+ this._pushLine(lines, lineWidths, lineMaxSizes, line, lineWidth, lineMaxAscent, lineMaxDescent);
1701
+ }
1689
1702
  textWidth = Math.max(textWidth, lineWidth);
1690
1703
  lineWidth = 0;
1691
1704
  // Push word to a single line
1692
- this._pushLine(lines, lineWidths, lineMaxSizes, word, wordWidth, wordMaxAscent, wordMaxDescent);
1705
+ if (wordWidth > 0) {
1706
+ this._pushLine(lines, lineWidths, lineMaxSizes, word, wordWidth, wordMaxAscent, wordMaxDescent);
1707
+ }
1693
1708
  textWidth = Math.max(textWidth, wordWidth);
1694
1709
  } else {
1695
1710
  // Merge to chars
@@ -1721,23 +1736,20 @@ var Logger = {
1721
1736
  var subFont = renderer._subFont;
1722
1737
  var fontString = subFont.nativeFontString;
1723
1738
  var fontSizeInfo = TextUtils.measureFont(fontString);
1724
- var lines = renderer.text.split(/(?:\r\n|\r|\n)/);
1725
- var lineCount = lines.length;
1739
+ var subTexts = renderer.text.split(/(?:\r\n|\r|\n)/);
1740
+ var textCount = subTexts.length;
1741
+ var lines = new Array();
1726
1742
  var lineWidths = new Array();
1727
1743
  var lineMaxSizes = new Array();
1728
1744
  var _pixelsPerUnit = Engine._pixelsPerUnit;
1729
1745
  var lineHeight = fontSizeInfo.size + renderer.lineSpacing * _pixelsPerUnit;
1730
1746
  var width = 0;
1731
- var height = renderer.height * _pixelsPerUnit;
1732
- if (renderer.overflowMode === OverflowMode.Overflow) {
1733
- height = lineHeight * lineCount;
1734
- }
1735
1747
  subFont.nativeFontString = fontString;
1736
- for(var i = 0; i < lineCount; ++i){
1737
- var line = lines[i];
1748
+ for(var i = 0; i < textCount; ++i){
1749
+ var line = subTexts[i];
1738
1750
  var curWidth = 0;
1739
- var maxAscent = -1;
1740
- var maxDescent = -1;
1751
+ var maxAscent = 0;
1752
+ var maxDescent = 0;
1741
1753
  for(var j = 0, m = line.length; j < m; ++j){
1742
1754
  var charInfo = TextUtils._getCharInfo(line[j], fontString, subFont);
1743
1755
  curWidth += charInfo.xAdvance;
@@ -1748,16 +1760,15 @@ var Logger = {
1748
1760
  maxAscent < ascent && (maxAscent = ascent);
1749
1761
  maxDescent < descent && (maxDescent = descent);
1750
1762
  }
1751
- lineWidths[i] = curWidth;
1752
- lineMaxSizes[i] = {
1753
- ascent: maxAscent,
1754
- descent: maxDescent,
1755
- size: maxAscent + maxDescent
1756
- };
1757
- if (curWidth > width) {
1758
- width = curWidth;
1763
+ if (curWidth > 0) {
1764
+ this._pushLine(lines, lineWidths, lineMaxSizes, line, curWidth, maxAscent, maxDescent);
1765
+ width = Math.max(width, curWidth);
1759
1766
  }
1760
1767
  }
1768
+ var height = renderer.height * _pixelsPerUnit;
1769
+ if (renderer.overflowMode === OverflowMode.Overflow) {
1770
+ height = lineHeight * lines.length;
1771
+ }
1761
1772
  return {
1762
1773
  width: width,
1763
1774
  height: height,
@@ -2610,7 +2621,6 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
2610
2621
  function EventDispatcher() {
2611
2622
  this._events = Object.create(null);
2612
2623
  this._eventCount = 0;
2613
- this._dispatchingListeners = [];
2614
2624
  }
2615
2625
  var _proto = EventDispatcher.prototype;
2616
2626
  /**
@@ -2650,7 +2660,8 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
2650
2660
  if (Array.isArray(listeners)) {
2651
2661
  var count = listeners.length;
2652
2662
  // cloning list to avoid structure breaking
2653
- var dispatchingListeners = this._dispatchingListeners;
2663
+ var pool = EventDispatcher._dispatchingListenersPool;
2664
+ var dispatchingListeners = pool.length > 0 ? pool.pop() : [];
2654
2665
  dispatchingListeners.length = count;
2655
2666
  for(var i = 0; i < count; i++){
2656
2667
  dispatchingListeners[i] = listeners[i];
@@ -2664,6 +2675,7 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
2664
2675
  }
2665
2676
  // remove hooked function to avoid gc problem
2666
2677
  dispatchingListeners.length = 0;
2678
+ pool.push(dispatchingListeners);
2667
2679
  } else {
2668
2680
  if (listeners.once) this.off(event, listeners.fn);
2669
2681
  listeners.fn(data);
@@ -2764,6 +2776,9 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
2764
2776
  };
2765
2777
  return EventDispatcher;
2766
2778
  }();
2779
+ (function() {
2780
+ EventDispatcher._dispatchingListenersPool = [];
2781
+ })();
2767
2782
 
2768
2783
  /**
2769
2784
  * Shader property.
@@ -13731,6 +13746,15 @@ var VertexChangedFlags;
13731
13746
  };
13732
13747
  /**
13733
13748
  * @internal
13749
+ */ _proto._prepareRender = function _prepareRender(context) {
13750
+ if (!this._mesh) {
13751
+ Logger.error("mesh is null.");
13752
+ return;
13753
+ }
13754
+ Renderer.prototype._prepareRender.call(this, context);
13755
+ };
13756
+ /**
13757
+ * @internal
13734
13758
  */ _proto._cloneTo = function _cloneTo(target) {
13735
13759
  Renderer.prototype._cloneTo.call(this, target);
13736
13760
  target.mesh = this._mesh;
@@ -13752,49 +13776,45 @@ var VertexChangedFlags;
13752
13776
  * @internal
13753
13777
  */ _proto._render = function _render(context) {
13754
13778
  var mesh = this._mesh;
13755
- if (mesh) {
13756
- if (this._dirtyUpdateFlag & 0x2) {
13757
- var shaderData = this.shaderData;
13758
- var vertexElements = mesh._vertexElements;
13759
- shaderData.disableMacro(MeshRenderer._uvMacro);
13760
- shaderData.disableMacro(MeshRenderer._uv1Macro);
13761
- shaderData.disableMacro(MeshRenderer._normalMacro);
13762
- shaderData.disableMacro(MeshRenderer._tangentMacro);
13763
- shaderData.disableMacro(MeshRenderer._enableVertexColorMacro);
13764
- for(var i = 0, n = vertexElements.length; i < n; i++){
13765
- switch(vertexElements[i].semantic){
13766
- case "TEXCOORD_0":
13767
- shaderData.enableMacro(MeshRenderer._uvMacro);
13768
- break;
13769
- case "TEXCOORD_1":
13770
- shaderData.enableMacro(MeshRenderer._uv1Macro);
13771
- break;
13772
- case "NORMAL":
13773
- shaderData.enableMacro(MeshRenderer._normalMacro);
13774
- break;
13775
- case "TANGENT":
13776
- shaderData.enableMacro(MeshRenderer._tangentMacro);
13777
- break;
13778
- case "COLOR_0":
13779
- this._enableVertexColor && shaderData.enableMacro(MeshRenderer._enableVertexColorMacro);
13780
- break;
13781
- }
13779
+ if (this._dirtyUpdateFlag & 0x2) {
13780
+ var shaderData = this.shaderData;
13781
+ var vertexElements = mesh._vertexElements;
13782
+ shaderData.disableMacro(MeshRenderer._uvMacro);
13783
+ shaderData.disableMacro(MeshRenderer._uv1Macro);
13784
+ shaderData.disableMacro(MeshRenderer._normalMacro);
13785
+ shaderData.disableMacro(MeshRenderer._tangentMacro);
13786
+ shaderData.disableMacro(MeshRenderer._enableVertexColorMacro);
13787
+ for(var i = 0, n = vertexElements.length; i < n; i++){
13788
+ switch(vertexElements[i].semantic){
13789
+ case "TEXCOORD_0":
13790
+ shaderData.enableMacro(MeshRenderer._uvMacro);
13791
+ break;
13792
+ case "TEXCOORD_1":
13793
+ shaderData.enableMacro(MeshRenderer._uv1Macro);
13794
+ break;
13795
+ case "NORMAL":
13796
+ shaderData.enableMacro(MeshRenderer._normalMacro);
13797
+ break;
13798
+ case "TANGENT":
13799
+ shaderData.enableMacro(MeshRenderer._tangentMacro);
13800
+ break;
13801
+ case "COLOR_0":
13802
+ this._enableVertexColor && shaderData.enableMacro(MeshRenderer._enableVertexColorMacro);
13803
+ break;
13782
13804
  }
13783
- this._dirtyUpdateFlag &= ~0x2;
13784
13805
  }
13785
- var materials = this._materials;
13786
- var subMeshes = mesh.subMeshes;
13787
- var renderPipeline = context.camera._renderPipeline;
13788
- var meshRenderDataPool = this._engine._meshRenderDataPool;
13789
- for(var i1 = 0, n1 = subMeshes.length; i1 < n1; i1++){
13790
- var material = materials[i1];
13791
- if (!material) continue;
13792
- var renderData = meshRenderDataPool.getFromPool();
13793
- renderData.set(this, material, mesh, subMeshes[i1]);
13794
- renderPipeline.pushRenderData(context, renderData);
13795
- }
13796
- } else {
13797
- Logger.error("mesh is null.");
13806
+ this._dirtyUpdateFlag &= ~0x2;
13807
+ }
13808
+ var materials = this._materials;
13809
+ var subMeshes = mesh.subMeshes;
13810
+ var renderPipeline = context.camera._renderPipeline;
13811
+ var meshRenderDataPool = this._engine._meshRenderDataPool;
13812
+ for(var i1 = 0, n1 = subMeshes.length; i1 < n1; i1++){
13813
+ var material = materials[i1];
13814
+ if (!material) continue;
13815
+ var renderData = meshRenderDataPool.getFromPool();
13816
+ renderData.set(this, material, mesh, subMeshes[i1]);
13817
+ renderPipeline.pushRenderData(context, renderData);
13798
13818
  }
13799
13819
  };
13800
13820
  _proto._setMesh = function _setMesh(mesh) {
@@ -19553,18 +19573,10 @@ var defaultInterval = 500;
19553
19573
  var _config_type;
19554
19574
  config.type = (_config_type = config.type) != null ? _config_type : getMimeTypeFromUrl(url);
19555
19575
  var realRequest = config.type === "image" ? requestImage : requestRes;
19556
- var lastError;
19557
19576
  var executor = new MultiExecutor(function() {
19558
- return realRequest(url, config).onProgress(setProgress).then(function(res) {
19559
- resolve(res);
19560
- executor.stop();
19561
- }).catch(function(err) {
19562
- return lastError = err;
19563
- });
19577
+ return realRequest(url, config).onProgress(setProgress);
19564
19578
  }, retryCount, retryInterval);
19565
- executor.start(function() {
19566
- reject(lastError);
19567
- });
19579
+ executor.start().onError(reject).onComplete(resolve);
19568
19580
  });
19569
19581
  }
19570
19582
  function requestImage(url, config) {
@@ -19651,23 +19663,33 @@ var MultiExecutor = /*#__PURE__*/ function() {
19651
19663
  this.exec = this.exec.bind(this);
19652
19664
  }
19653
19665
  var _proto = MultiExecutor.prototype;
19654
- _proto.start = function start(done) {
19655
- this.done = done;
19666
+ _proto.start = function start() {
19656
19667
  this.exec();
19668
+ return this;
19657
19669
  };
19658
- _proto.stop = function stop() {
19659
- clearTimeout(this._timeoutId);
19670
+ _proto.onComplete = function onComplete(func) {
19671
+ this._onComplete = func;
19672
+ return this;
19673
+ };
19674
+ _proto.onError = function onError(func) {
19675
+ this._onError = func;
19676
+ return this;
19677
+ };
19678
+ _proto.cancel = function cancel() {
19679
+ window.clearTimeout(this._timeoutId);
19660
19680
  };
19661
19681
  _proto.exec = function exec() {
19662
19682
  var _this = this;
19663
19683
  if (this._currentCount >= this.totalCount) {
19664
- this.done && this.done();
19684
+ this._onError && this._onError(this._error);
19665
19685
  return;
19666
19686
  }
19667
19687
  this._currentCount++;
19668
- this.execFunc(this._currentCount).then(function() {
19669
- //@ts-ignore
19670
- _this._timeoutId = setTimeout(_this.exec, _this.interval);
19688
+ this.execFunc(this._currentCount).then(function(result) {
19689
+ return _this._onComplete && _this._onComplete(result);
19690
+ }).catch(function(e) {
19691
+ _this._error = e;
19692
+ _this._timeoutId = window.setTimeout(_this.exec, _this.interval);
19671
19693
  });
19672
19694
  };
19673
19695
  return MultiExecutor;
@@ -22300,92 +22322,97 @@ var /**
22300
22322
  }
22301
22323
  };
22302
22324
  _proto._updateLocalData = function _updateLocalData() {
22303
- var _this = this, color = _this.color, horizontalAlignment = _this.horizontalAlignment, verticalAlignment = _this.verticalAlignment, charRenderDatas = _this._charRenderDatas;
22325
+ var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
22304
22326
  var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
22305
- var _pixelsPerUnit = Engine._pixelsPerUnit;
22306
- var pixelsPerUnitReciprocal = 1.0 / _pixelsPerUnit;
22307
- var charFont = this._subFont;
22308
- var rendererWidth = this.width * _pixelsPerUnit;
22309
- var halfRendererWidth = rendererWidth * 0.5;
22310
- var rendererHeight = this.height * _pixelsPerUnit;
22311
22327
  var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
22312
22328
  var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
22313
22329
  var charRenderDataPool = TextRenderer._charRenderDataPool;
22314
- var halfLineHeight = lineHeight * 0.5;
22315
22330
  var linesLen = lines.length;
22316
- var startY = 0;
22317
- var topDiff = lineHeight * 0.5 - lineMaxSizes[0].ascent;
22318
- var bottomDiff = lineHeight * 0.5 - lineMaxSizes[linesLen - 1].descent - 1;
22319
- switch(verticalAlignment){
22320
- case TextVerticalAlignment.Top:
22321
- startY = rendererHeight * 0.5 - halfLineHeight + topDiff;
22322
- break;
22323
- case TextVerticalAlignment.Center:
22324
- startY = height * 0.5 - halfLineHeight - (bottomDiff - topDiff) * 0.5;
22325
- break;
22326
- case TextVerticalAlignment.Bottom:
22327
- startY = height - rendererHeight * 0.5 - halfLineHeight - bottomDiff;
22328
- break;
22329
- }
22330
22331
  var renderDataCount = 0;
22331
- var firstLine = -1;
22332
- var minX = Number.MAX_SAFE_INTEGER;
22333
- var minY = Number.MAX_SAFE_INTEGER;
22334
- var maxX = Number.MIN_SAFE_INTEGER;
22335
- var maxY = Number.MIN_SAFE_INTEGER;
22336
- for(var i = 0; i < linesLen; ++i){
22337
- var lineWidth = lineWidths[i];
22338
- if (lineWidth > 0) {
22339
- var line = lines[i];
22340
- var startX = 0;
22341
- var firstRow = -1;
22342
- if (firstLine < 0) {
22343
- firstLine = i;
22344
- }
22345
- switch(horizontalAlignment){
22346
- case TextHorizontalAlignment.Left:
22347
- startX = -halfRendererWidth;
22348
- break;
22349
- case TextHorizontalAlignment.Center:
22350
- startX = -lineWidth * 0.5;
22351
- break;
22352
- case TextHorizontalAlignment.Right:
22353
- startX = halfRendererWidth - lineWidth;
22354
- break;
22355
- }
22356
- for(var j = 0, n = line.length; j < n; ++j){
22357
- var char = line[j];
22358
- var charInfo = charFont._getCharInfo(char);
22359
- if (charInfo.h > 0) {
22360
- var _charRenderDatas, _ref;
22361
- firstRow < 0 && (firstRow = j);
22362
- var charRenderData = (_charRenderDatas = charRenderDatas)[_ref = renderDataCount++] || (_charRenderDatas[_ref] = charRenderDataPool.get());
22363
- var renderData = charRenderData.renderData, localPositions = charRenderData.localPositions;
22364
- charRenderData.texture = charFont._getTextureByIndex(charInfo.index);
22365
- renderData.color = color;
22366
- renderData.uvs = charInfo.uvs;
22367
- var w = charInfo.w, ascent = charInfo.ascent, descent = charInfo.descent;
22368
- var left = startX * pixelsPerUnitReciprocal;
22369
- var right = (startX + w) * pixelsPerUnitReciprocal;
22370
- var top = (startY + ascent) * pixelsPerUnitReciprocal;
22371
- var bottom = (startY - descent + 1) * pixelsPerUnitReciprocal;
22372
- localPositions.set(left, top, right, bottom);
22373
- i === firstLine && (maxY = Math.max(maxY, top));
22374
- minY = Math.min(minY, bottom);
22375
- j === firstRow && (minX = Math.min(minX, left));
22376
- maxX = Math.max(maxX, right);
22332
+ if (linesLen > 0) {
22333
+ var _pixelsPerUnit = Engine._pixelsPerUnit;
22334
+ var horizontalAlignment = this.horizontalAlignment;
22335
+ var pixelsPerUnitReciprocal = 1.0 / _pixelsPerUnit;
22336
+ var rendererWidth = this.width * _pixelsPerUnit;
22337
+ var halfRendererWidth = rendererWidth * 0.5;
22338
+ var rendererHeight = this.height * _pixelsPerUnit;
22339
+ var halfLineHeight = lineHeight * 0.5;
22340
+ var startY = 0;
22341
+ var topDiff = lineHeight * 0.5 - lineMaxSizes[0].ascent;
22342
+ var bottomDiff = lineHeight * 0.5 - lineMaxSizes[linesLen - 1].descent - 1;
22343
+ switch(this.verticalAlignment){
22344
+ case TextVerticalAlignment.Top:
22345
+ startY = rendererHeight * 0.5 - halfLineHeight + topDiff;
22346
+ break;
22347
+ case TextVerticalAlignment.Center:
22348
+ startY = height * 0.5 - halfLineHeight - (bottomDiff - topDiff) * 0.5;
22349
+ break;
22350
+ case TextVerticalAlignment.Bottom:
22351
+ startY = height - rendererHeight * 0.5 - halfLineHeight - bottomDiff;
22352
+ break;
22353
+ }
22354
+ var firstLine = -1;
22355
+ var minX = Number.MAX_SAFE_INTEGER;
22356
+ var minY = Number.MAX_SAFE_INTEGER;
22357
+ var maxX = Number.MIN_SAFE_INTEGER;
22358
+ var maxY = Number.MIN_SAFE_INTEGER;
22359
+ for(var i = 0; i < linesLen; ++i){
22360
+ var lineWidth = lineWidths[i];
22361
+ if (lineWidth > 0) {
22362
+ var line = lines[i];
22363
+ var startX = 0;
22364
+ var firstRow = -1;
22365
+ if (firstLine < 0) {
22366
+ firstLine = i;
22367
+ }
22368
+ switch(horizontalAlignment){
22369
+ case TextHorizontalAlignment.Left:
22370
+ startX = -halfRendererWidth;
22371
+ break;
22372
+ case TextHorizontalAlignment.Center:
22373
+ startX = -lineWidth * 0.5;
22374
+ break;
22375
+ case TextHorizontalAlignment.Right:
22376
+ startX = halfRendererWidth - lineWidth;
22377
+ break;
22378
+ }
22379
+ for(var j = 0, n = line.length; j < n; ++j){
22380
+ var char = line[j];
22381
+ var charInfo = charFont._getCharInfo(char);
22382
+ if (charInfo.h > 0) {
22383
+ var _charRenderDatas, _ref;
22384
+ firstRow < 0 && (firstRow = j);
22385
+ var charRenderData = (_charRenderDatas = charRenderDatas)[_ref = renderDataCount++] || (_charRenderDatas[_ref] = charRenderDataPool.get());
22386
+ var renderData = charRenderData.renderData, localPositions = charRenderData.localPositions;
22387
+ charRenderData.texture = charFont._getTextureByIndex(charInfo.index);
22388
+ renderData.color = color;
22389
+ renderData.uvs = charInfo.uvs;
22390
+ var w = charInfo.w, ascent = charInfo.ascent, descent = charInfo.descent;
22391
+ var left = startX * pixelsPerUnitReciprocal;
22392
+ var right = (startX + w) * pixelsPerUnitReciprocal;
22393
+ var top = (startY + ascent) * pixelsPerUnitReciprocal;
22394
+ var bottom = (startY - descent + 1) * pixelsPerUnitReciprocal;
22395
+ localPositions.set(left, top, right, bottom);
22396
+ i === firstLine && (maxY = Math.max(maxY, top));
22397
+ minY = Math.min(minY, bottom);
22398
+ j === firstRow && (minX = Math.min(minX, left));
22399
+ maxX = Math.max(maxX, right);
22400
+ }
22401
+ startX += charInfo.xAdvance;
22377
22402
  }
22378
- startX += charInfo.xAdvance;
22379
22403
  }
22404
+ startY -= lineHeight;
22380
22405
  }
22381
- startY -= lineHeight;
22382
- }
22383
- if (firstLine < 0) {
22406
+ if (firstLine < 0) {
22407
+ min.set(0, 0, 0);
22408
+ max.set(0, 0, 0);
22409
+ } else {
22410
+ min.set(minX, minY, 0);
22411
+ max.set(maxX, maxY, 0);
22412
+ }
22413
+ } else {
22384
22414
  min.set(0, 0, 0);
22385
22415
  max.set(0, 0, 0);
22386
- } else {
22387
- min.set(minX, minY, 0);
22388
- max.set(maxX, maxY, 0);
22389
22416
  }
22390
22417
  // Revert excess render data to pool.
22391
22418
  var lastRenderDataCount = charRenderDatas.length;
@@ -24401,7 +24428,8 @@ var AnimatorLayerBlendingMode;
24401
24428
  };
24402
24429
  _proto._saveAnimatorEventHandlers = function _saveAnimatorEventHandlers(state, animatorStateData) {
24403
24430
  var eventHandlerPool = this._animationEventHandlerPool;
24404
- var scripts = this._entity._scripts;
24431
+ var scripts = [];
24432
+ this._entity.getComponents(Script, scripts);
24405
24433
  var scriptCount = scripts.length;
24406
24434
  var eventHandlers = animatorStateData.eventHandlers;
24407
24435
  var events = state.clip.events;
@@ -24414,7 +24442,7 @@ var AnimatorLayerBlendingMode;
24414
24442
  eventHandler.event = event;
24415
24443
  handlers.length = 0;
24416
24444
  for(var j = scriptCount - 1; j >= 0; j--){
24417
- var handler = scripts.get(j)[funcName];
24445
+ var handler = scripts[j][funcName];
24418
24446
  handler && handlers.push(handler);
24419
24447
  }
24420
24448
  eventHandlers.push(eventHandler);