@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/main.js +188 -160
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +188 -160
- package/dist/module.js +188 -160
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/asset/request.d.ts +7 -3
- package/types/base/EventDispatcher.d.ts +1 -1
- package/types/SafeLoopArray.d.ts +0 -37
- package/types/enums/ActiveChangeFlag.d.ts +0 -6
- package/types/physics/PhysicsScene.d.ts +0 -75
- package/types/utils/SafeLoopArray.d.ts +0 -41
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
1729
|
-
var
|
|
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 <
|
|
1741
|
-
var line =
|
|
1752
|
+
for(var i = 0; i < textCount; ++i){
|
|
1753
|
+
var line = subTexts[i];
|
|
1742
1754
|
var curWidth = 0;
|
|
1743
|
-
var maxAscent =
|
|
1744
|
-
var maxDescent =
|
|
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
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
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
|
|
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.
|
|
@@ -13735,6 +13750,15 @@ var VertexChangedFlags;
|
|
|
13735
13750
|
};
|
|
13736
13751
|
/**
|
|
13737
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
|
|
13738
13762
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
13739
13763
|
Renderer.prototype._cloneTo.call(this, target);
|
|
13740
13764
|
target.mesh = this._mesh;
|
|
@@ -13756,49 +13780,45 @@ var VertexChangedFlags;
|
|
|
13756
13780
|
* @internal
|
|
13757
13781
|
*/ _proto._render = function _render(context) {
|
|
13758
13782
|
var mesh = this._mesh;
|
|
13759
|
-
if (
|
|
13760
|
-
|
|
13761
|
-
|
|
13762
|
-
|
|
13763
|
-
|
|
13764
|
-
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
13768
|
-
|
|
13769
|
-
|
|
13770
|
-
|
|
13771
|
-
|
|
13772
|
-
|
|
13773
|
-
|
|
13774
|
-
|
|
13775
|
-
|
|
13776
|
-
|
|
13777
|
-
|
|
13778
|
-
|
|
13779
|
-
|
|
13780
|
-
|
|
13781
|
-
|
|
13782
|
-
|
|
13783
|
-
|
|
13784
|
-
break;
|
|
13785
|
-
}
|
|
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;
|
|
13786
13808
|
}
|
|
13787
|
-
this._dirtyUpdateFlag &= ~0x2;
|
|
13788
13809
|
}
|
|
13789
|
-
|
|
13790
|
-
|
|
13791
|
-
|
|
13792
|
-
|
|
13793
|
-
|
|
13794
|
-
|
|
13795
|
-
|
|
13796
|
-
|
|
13797
|
-
|
|
13798
|
-
|
|
13799
|
-
|
|
13800
|
-
|
|
13801
|
-
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);
|
|
13802
13822
|
}
|
|
13803
13823
|
};
|
|
13804
13824
|
_proto._setMesh = function _setMesh(mesh) {
|
|
@@ -19557,18 +19577,10 @@ var defaultInterval = 500;
|
|
|
19557
19577
|
var _config_type;
|
|
19558
19578
|
config.type = (_config_type = config.type) != null ? _config_type : getMimeTypeFromUrl(url);
|
|
19559
19579
|
var realRequest = config.type === "image" ? requestImage : requestRes;
|
|
19560
|
-
var lastError;
|
|
19561
19580
|
var executor = new MultiExecutor(function() {
|
|
19562
|
-
return realRequest(url, config).onProgress(setProgress)
|
|
19563
|
-
resolve(res);
|
|
19564
|
-
executor.stop();
|
|
19565
|
-
}).catch(function(err) {
|
|
19566
|
-
return lastError = err;
|
|
19567
|
-
});
|
|
19581
|
+
return realRequest(url, config).onProgress(setProgress);
|
|
19568
19582
|
}, retryCount, retryInterval);
|
|
19569
|
-
executor.start(
|
|
19570
|
-
reject(lastError);
|
|
19571
|
-
});
|
|
19583
|
+
executor.start().onError(reject).onComplete(resolve);
|
|
19572
19584
|
});
|
|
19573
19585
|
}
|
|
19574
19586
|
function requestImage(url, config) {
|
|
@@ -19655,23 +19667,33 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
19655
19667
|
this.exec = this.exec.bind(this);
|
|
19656
19668
|
}
|
|
19657
19669
|
var _proto = MultiExecutor.prototype;
|
|
19658
|
-
_proto.start = function start(
|
|
19659
|
-
this.done = done;
|
|
19670
|
+
_proto.start = function start() {
|
|
19660
19671
|
this.exec();
|
|
19672
|
+
return this;
|
|
19661
19673
|
};
|
|
19662
|
-
_proto.
|
|
19663
|
-
|
|
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);
|
|
19664
19684
|
};
|
|
19665
19685
|
_proto.exec = function exec() {
|
|
19666
19686
|
var _this = this;
|
|
19667
19687
|
if (this._currentCount >= this.totalCount) {
|
|
19668
|
-
this.
|
|
19688
|
+
this._onError && this._onError(this._error);
|
|
19669
19689
|
return;
|
|
19670
19690
|
}
|
|
19671
19691
|
this._currentCount++;
|
|
19672
|
-
this.execFunc(this._currentCount).then(function() {
|
|
19673
|
-
|
|
19674
|
-
|
|
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);
|
|
19675
19697
|
});
|
|
19676
19698
|
};
|
|
19677
19699
|
return MultiExecutor;
|
|
@@ -22304,92 +22326,97 @@ var /**
|
|
|
22304
22326
|
}
|
|
22305
22327
|
};
|
|
22306
22328
|
_proto._updateLocalData = function _updateLocalData() {
|
|
22307
|
-
var _this = this, color = _this.color,
|
|
22329
|
+
var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
|
|
22308
22330
|
var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
|
|
22309
|
-
var _pixelsPerUnit = Engine._pixelsPerUnit;
|
|
22310
|
-
var pixelsPerUnitReciprocal = 1.0 / _pixelsPerUnit;
|
|
22311
|
-
var charFont = this._subFont;
|
|
22312
|
-
var rendererWidth = this.width * _pixelsPerUnit;
|
|
22313
|
-
var halfRendererWidth = rendererWidth * 0.5;
|
|
22314
|
-
var rendererHeight = this.height * _pixelsPerUnit;
|
|
22315
22331
|
var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
|
|
22316
22332
|
var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
|
|
22317
22333
|
var charRenderDataPool = TextRenderer._charRenderDataPool;
|
|
22318
|
-
var halfLineHeight = lineHeight * 0.5;
|
|
22319
22334
|
var linesLen = lines.length;
|
|
22320
|
-
var startY = 0;
|
|
22321
|
-
var topDiff = lineHeight * 0.5 - lineMaxSizes[0].ascent;
|
|
22322
|
-
var bottomDiff = lineHeight * 0.5 - lineMaxSizes[linesLen - 1].descent - 1;
|
|
22323
|
-
switch(verticalAlignment){
|
|
22324
|
-
case exports.TextVerticalAlignment.Top:
|
|
22325
|
-
startY = rendererHeight * 0.5 - halfLineHeight + topDiff;
|
|
22326
|
-
break;
|
|
22327
|
-
case exports.TextVerticalAlignment.Center:
|
|
22328
|
-
startY = height * 0.5 - halfLineHeight - (bottomDiff - topDiff) * 0.5;
|
|
22329
|
-
break;
|
|
22330
|
-
case exports.TextVerticalAlignment.Bottom:
|
|
22331
|
-
startY = height - rendererHeight * 0.5 - halfLineHeight - bottomDiff;
|
|
22332
|
-
break;
|
|
22333
|
-
}
|
|
22334
22335
|
var renderDataCount = 0;
|
|
22335
|
-
|
|
22336
|
-
|
|
22337
|
-
|
|
22338
|
-
|
|
22339
|
-
|
|
22340
|
-
|
|
22341
|
-
var
|
|
22342
|
-
|
|
22343
|
-
|
|
22344
|
-
|
|
22345
|
-
|
|
22346
|
-
|
|
22347
|
-
|
|
22348
|
-
|
|
22349
|
-
|
|
22350
|
-
|
|
22351
|
-
|
|
22352
|
-
|
|
22353
|
-
|
|
22354
|
-
|
|
22355
|
-
|
|
22356
|
-
|
|
22357
|
-
|
|
22358
|
-
|
|
22359
|
-
|
|
22360
|
-
|
|
22361
|
-
|
|
22362
|
-
|
|
22363
|
-
|
|
22364
|
-
|
|
22365
|
-
|
|
22366
|
-
|
|
22367
|
-
|
|
22368
|
-
|
|
22369
|
-
|
|
22370
|
-
|
|
22371
|
-
|
|
22372
|
-
|
|
22373
|
-
|
|
22374
|
-
|
|
22375
|
-
|
|
22376
|
-
|
|
22377
|
-
|
|
22378
|
-
|
|
22379
|
-
|
|
22380
|
-
|
|
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;
|
|
22381
22406
|
}
|
|
22382
|
-
startX += charInfo.xAdvance;
|
|
22383
22407
|
}
|
|
22408
|
+
startY -= lineHeight;
|
|
22384
22409
|
}
|
|
22385
|
-
|
|
22386
|
-
|
|
22387
|
-
|
|
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 {
|
|
22388
22418
|
min.set(0, 0, 0);
|
|
22389
22419
|
max.set(0, 0, 0);
|
|
22390
|
-
} else {
|
|
22391
|
-
min.set(minX, minY, 0);
|
|
22392
|
-
max.set(maxX, maxY, 0);
|
|
22393
22420
|
}
|
|
22394
22421
|
// Revert excess render data to pool.
|
|
22395
22422
|
var lastRenderDataCount = charRenderDatas.length;
|
|
@@ -24405,7 +24432,8 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24405
24432
|
};
|
|
24406
24433
|
_proto._saveAnimatorEventHandlers = function _saveAnimatorEventHandlers(state, animatorStateData) {
|
|
24407
24434
|
var eventHandlerPool = this._animationEventHandlerPool;
|
|
24408
|
-
var scripts =
|
|
24435
|
+
var scripts = [];
|
|
24436
|
+
this._entity.getComponents(Script, scripts);
|
|
24409
24437
|
var scriptCount = scripts.length;
|
|
24410
24438
|
var eventHandlers = animatorStateData.eventHandlers;
|
|
24411
24439
|
var events = state.clip.events;
|
|
@@ -24418,7 +24446,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24418
24446
|
eventHandler.event = event;
|
|
24419
24447
|
handlers.length = 0;
|
|
24420
24448
|
for(var j = scriptCount - 1; j >= 0; j--){
|
|
24421
|
-
var handler = scripts
|
|
24449
|
+
var handler = scripts[j][funcName];
|
|
24422
24450
|
handler && handlers.push(handler);
|
|
24423
24451
|
}
|
|
24424
24452
|
eventHandlers.push(eventHandler);
|