@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 +189 -160
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +189 -160
- package/dist/module.js +189 -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/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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
1725
|
-
var
|
|
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 <
|
|
1737
|
-
var line =
|
|
1748
|
+
for(var i = 0; i < textCount; ++i){
|
|
1749
|
+
var line = subTexts[i];
|
|
1738
1750
|
var curWidth = 0;
|
|
1739
|
-
var maxAscent =
|
|
1740
|
-
var maxDescent =
|
|
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
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
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
|
|
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.
|
|
@@ -4763,6 +4778,7 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
4763
4778
|
cloneEntity._hookResource = hookResource;
|
|
4764
4779
|
hookResource._addReferCount(1);
|
|
4765
4780
|
}
|
|
4781
|
+
cloneEntity.layer = this.layer;
|
|
4766
4782
|
cloneEntity._isActive = this._isActive;
|
|
4767
4783
|
cloneEntity.transform.localMatrix = this.transform.localMatrix;
|
|
4768
4784
|
var children = this._children;
|
|
@@ -13730,6 +13746,15 @@ var VertexChangedFlags;
|
|
|
13730
13746
|
};
|
|
13731
13747
|
/**
|
|
13732
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
|
|
13733
13758
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
13734
13759
|
Renderer.prototype._cloneTo.call(this, target);
|
|
13735
13760
|
target.mesh = this._mesh;
|
|
@@ -13751,49 +13776,45 @@ var VertexChangedFlags;
|
|
|
13751
13776
|
* @internal
|
|
13752
13777
|
*/ _proto._render = function _render(context) {
|
|
13753
13778
|
var mesh = this._mesh;
|
|
13754
|
-
if (
|
|
13755
|
-
|
|
13756
|
-
|
|
13757
|
-
|
|
13758
|
-
|
|
13759
|
-
|
|
13760
|
-
|
|
13761
|
-
|
|
13762
|
-
|
|
13763
|
-
|
|
13764
|
-
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
13768
|
-
|
|
13769
|
-
|
|
13770
|
-
|
|
13771
|
-
|
|
13772
|
-
|
|
13773
|
-
|
|
13774
|
-
|
|
13775
|
-
|
|
13776
|
-
|
|
13777
|
-
|
|
13778
|
-
|
|
13779
|
-
break;
|
|
13780
|
-
}
|
|
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;
|
|
13781
13804
|
}
|
|
13782
|
-
this._dirtyUpdateFlag &= ~0x2;
|
|
13783
13805
|
}
|
|
13784
|
-
|
|
13785
|
-
|
|
13786
|
-
|
|
13787
|
-
|
|
13788
|
-
|
|
13789
|
-
|
|
13790
|
-
|
|
13791
|
-
|
|
13792
|
-
|
|
13793
|
-
|
|
13794
|
-
|
|
13795
|
-
|
|
13796
|
-
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);
|
|
13797
13818
|
}
|
|
13798
13819
|
};
|
|
13799
13820
|
_proto._setMesh = function _setMesh(mesh) {
|
|
@@ -19552,18 +19573,10 @@ var defaultInterval = 500;
|
|
|
19552
19573
|
var _config_type;
|
|
19553
19574
|
config.type = (_config_type = config.type) != null ? _config_type : getMimeTypeFromUrl(url);
|
|
19554
19575
|
var realRequest = config.type === "image" ? requestImage : requestRes;
|
|
19555
|
-
var lastError;
|
|
19556
19576
|
var executor = new MultiExecutor(function() {
|
|
19557
|
-
return realRequest(url, config).onProgress(setProgress)
|
|
19558
|
-
resolve(res);
|
|
19559
|
-
executor.stop();
|
|
19560
|
-
}).catch(function(err) {
|
|
19561
|
-
return lastError = err;
|
|
19562
|
-
});
|
|
19577
|
+
return realRequest(url, config).onProgress(setProgress);
|
|
19563
19578
|
}, retryCount, retryInterval);
|
|
19564
|
-
executor.start(
|
|
19565
|
-
reject(lastError);
|
|
19566
|
-
});
|
|
19579
|
+
executor.start().onError(reject).onComplete(resolve);
|
|
19567
19580
|
});
|
|
19568
19581
|
}
|
|
19569
19582
|
function requestImage(url, config) {
|
|
@@ -19650,23 +19663,33 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
19650
19663
|
this.exec = this.exec.bind(this);
|
|
19651
19664
|
}
|
|
19652
19665
|
var _proto = MultiExecutor.prototype;
|
|
19653
|
-
_proto.start = function start(
|
|
19654
|
-
this.done = done;
|
|
19666
|
+
_proto.start = function start() {
|
|
19655
19667
|
this.exec();
|
|
19668
|
+
return this;
|
|
19656
19669
|
};
|
|
19657
|
-
_proto.
|
|
19658
|
-
|
|
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);
|
|
19659
19680
|
};
|
|
19660
19681
|
_proto.exec = function exec() {
|
|
19661
19682
|
var _this = this;
|
|
19662
19683
|
if (this._currentCount >= this.totalCount) {
|
|
19663
|
-
this.
|
|
19684
|
+
this._onError && this._onError(this._error);
|
|
19664
19685
|
return;
|
|
19665
19686
|
}
|
|
19666
19687
|
this._currentCount++;
|
|
19667
|
-
this.execFunc(this._currentCount).then(function() {
|
|
19668
|
-
|
|
19669
|
-
|
|
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);
|
|
19670
19693
|
});
|
|
19671
19694
|
};
|
|
19672
19695
|
return MultiExecutor;
|
|
@@ -22299,92 +22322,97 @@ var /**
|
|
|
22299
22322
|
}
|
|
22300
22323
|
};
|
|
22301
22324
|
_proto._updateLocalData = function _updateLocalData() {
|
|
22302
|
-
var _this = this, color = _this.color,
|
|
22325
|
+
var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
|
|
22303
22326
|
var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
|
|
22304
|
-
var _pixelsPerUnit = Engine._pixelsPerUnit;
|
|
22305
|
-
var pixelsPerUnitReciprocal = 1.0 / _pixelsPerUnit;
|
|
22306
|
-
var charFont = this._subFont;
|
|
22307
|
-
var rendererWidth = this.width * _pixelsPerUnit;
|
|
22308
|
-
var halfRendererWidth = rendererWidth * 0.5;
|
|
22309
|
-
var rendererHeight = this.height * _pixelsPerUnit;
|
|
22310
22327
|
var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
|
|
22311
22328
|
var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
|
|
22312
22329
|
var charRenderDataPool = TextRenderer._charRenderDataPool;
|
|
22313
|
-
var halfLineHeight = lineHeight * 0.5;
|
|
22314
22330
|
var linesLen = lines.length;
|
|
22315
|
-
var startY = 0;
|
|
22316
|
-
var topDiff = lineHeight * 0.5 - lineMaxSizes[0].ascent;
|
|
22317
|
-
var bottomDiff = lineHeight * 0.5 - lineMaxSizes[linesLen - 1].descent - 1;
|
|
22318
|
-
switch(verticalAlignment){
|
|
22319
|
-
case TextVerticalAlignment.Top:
|
|
22320
|
-
startY = rendererHeight * 0.5 - halfLineHeight + topDiff;
|
|
22321
|
-
break;
|
|
22322
|
-
case TextVerticalAlignment.Center:
|
|
22323
|
-
startY = height * 0.5 - halfLineHeight - (bottomDiff - topDiff) * 0.5;
|
|
22324
|
-
break;
|
|
22325
|
-
case TextVerticalAlignment.Bottom:
|
|
22326
|
-
startY = height - rendererHeight * 0.5 - halfLineHeight - bottomDiff;
|
|
22327
|
-
break;
|
|
22328
|
-
}
|
|
22329
22331
|
var renderDataCount = 0;
|
|
22330
|
-
|
|
22331
|
-
|
|
22332
|
-
|
|
22333
|
-
|
|
22334
|
-
|
|
22335
|
-
|
|
22336
|
-
var
|
|
22337
|
-
|
|
22338
|
-
|
|
22339
|
-
|
|
22340
|
-
|
|
22341
|
-
|
|
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
|
-
|
|
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;
|
|
22376
22402
|
}
|
|
22377
|
-
startX += charInfo.xAdvance;
|
|
22378
22403
|
}
|
|
22404
|
+
startY -= lineHeight;
|
|
22379
22405
|
}
|
|
22380
|
-
|
|
22381
|
-
|
|
22382
|
-
|
|
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 {
|
|
22383
22414
|
min.set(0, 0, 0);
|
|
22384
22415
|
max.set(0, 0, 0);
|
|
22385
|
-
} else {
|
|
22386
|
-
min.set(minX, minY, 0);
|
|
22387
|
-
max.set(maxX, maxY, 0);
|
|
22388
22416
|
}
|
|
22389
22417
|
// Revert excess render data to pool.
|
|
22390
22418
|
var lastRenderDataCount = charRenderDatas.length;
|
|
@@ -24400,7 +24428,8 @@ var AnimatorLayerBlendingMode;
|
|
|
24400
24428
|
};
|
|
24401
24429
|
_proto._saveAnimatorEventHandlers = function _saveAnimatorEventHandlers(state, animatorStateData) {
|
|
24402
24430
|
var eventHandlerPool = this._animationEventHandlerPool;
|
|
24403
|
-
var scripts =
|
|
24431
|
+
var scripts = [];
|
|
24432
|
+
this._entity.getComponents(Script, scripts);
|
|
24404
24433
|
var scriptCount = scripts.length;
|
|
24405
24434
|
var eventHandlers = animatorStateData.eventHandlers;
|
|
24406
24435
|
var events = state.clip.events;
|
|
@@ -24413,7 +24442,7 @@ var AnimatorLayerBlendingMode;
|
|
|
24413
24442
|
eventHandler.event = event;
|
|
24414
24443
|
handlers.length = 0;
|
|
24415
24444
|
for(var j = scriptCount - 1; j >= 0; j--){
|
|
24416
|
-
var handler = scripts
|
|
24445
|
+
var handler = scripts[j][funcName];
|
|
24417
24446
|
handler && handlers.push(handler);
|
|
24418
24447
|
}
|
|
24419
24448
|
eventHandlers.push(eventHandler);
|