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