@galacean/engine-core 1.1.0-beta.34 → 1.1.0-beta.36
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 +50 -9
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +50 -9
- package/dist/module.js +50 -9
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/2d/atlas/types.d.ts +2 -0
- package/types/2d/text/TextRenderer.d.ts +1 -0
package/dist/miniprogram.js
CHANGED
|
@@ -1948,13 +1948,15 @@ var Logger = {
|
|
|
1948
1948
|
];
|
|
1949
1949
|
})();
|
|
1950
1950
|
(function() {
|
|
1951
|
-
|
|
1951
|
+
// _heightMultiplier used to measure the height of text, but in miniprogram performance is different from h5.
|
|
1952
|
+
// so can set _heightMultiplier to adapt miniprogram, the larger the value, the worse the performance.
|
|
1953
|
+
/** @internal */ TextUtils._heightMultiplier = 2;
|
|
1952
1954
|
})();
|
|
1953
1955
|
(function() {
|
|
1954
|
-
TextUtils.
|
|
1956
|
+
/** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
|
|
1955
1957
|
})();
|
|
1956
1958
|
(function() {
|
|
1957
|
-
TextUtils.
|
|
1959
|
+
TextUtils._measureBaseline = "M";
|
|
1958
1960
|
})();
|
|
1959
1961
|
(function() {
|
|
1960
1962
|
TextUtils._baselineMultiplier = 1.4;
|
|
@@ -2038,7 +2040,7 @@ var Logger = {
|
|
|
2038
2040
|
var _this = this, engine = _this._engine;
|
|
2039
2041
|
var fontAtlas = new FontAtlas(engine);
|
|
2040
2042
|
var texture = new Texture2D(engine, 256, 256, exports.TextureFormat.R8G8B8A8, false);
|
|
2041
|
-
texture.filterMode = exports.TextureFilterMode.
|
|
2043
|
+
texture.filterMode = exports.TextureFilterMode.Bilinear;
|
|
2042
2044
|
fontAtlas.texture = texture;
|
|
2043
2045
|
fontAtlas.isGCIgnored = texture.isGCIgnored = true;
|
|
2044
2046
|
this._fontAtlases.push(fontAtlas);
|
|
@@ -18542,7 +18544,7 @@ var /**
|
|
|
18542
18544
|
/**
|
|
18543
18545
|
* @internal
|
|
18544
18546
|
*/ _proto._render = function _render(context) {
|
|
18545
|
-
if (this.
|
|
18547
|
+
if (this._isTextNoVisible()) {
|
|
18546
18548
|
return;
|
|
18547
18549
|
}
|
|
18548
18550
|
if (this._isContainDirtyFlag(0x10)) {
|
|
@@ -18634,8 +18636,8 @@ var /**
|
|
|
18634
18636
|
}
|
|
18635
18637
|
};
|
|
18636
18638
|
_proto._updateLocalData = function _updateLocalData() {
|
|
18637
|
-
var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
|
|
18638
18639
|
var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
|
|
18640
|
+
var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
|
|
18639
18641
|
var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
|
|
18640
18642
|
var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
|
|
18641
18643
|
var charRenderDataPool = TextRenderer._charRenderDataPool;
|
|
@@ -18703,7 +18705,7 @@ var /**
|
|
|
18703
18705
|
var left = startX * pixelsPerUnitReciprocal;
|
|
18704
18706
|
var right = (startX + w) * pixelsPerUnitReciprocal;
|
|
18705
18707
|
var top = (startY + ascent) * pixelsPerUnitReciprocal;
|
|
18706
|
-
var bottom = (startY - descent
|
|
18708
|
+
var bottom = (startY - descent) * pixelsPerUnitReciprocal;
|
|
18707
18709
|
localPositions.set(left, top, right, bottom);
|
|
18708
18710
|
i === firstLine && (maxY = Math.max(maxY, top));
|
|
18709
18711
|
minY = Math.min(minY, bottom);
|
|
@@ -18744,6 +18746,9 @@ var /**
|
|
|
18744
18746
|
Renderer1.prototype._onTransformChanged.call(this, bit);
|
|
18745
18747
|
this._setDirtyFlagTrue(0x4 | 0x8);
|
|
18746
18748
|
};
|
|
18749
|
+
_proto._isTextNoVisible = function _isTextNoVisible() {
|
|
18750
|
+
return this._text === "" || this._fontSize === 0 || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0;
|
|
18751
|
+
};
|
|
18747
18752
|
_create_class(TextRenderer, [
|
|
18748
18753
|
{
|
|
18749
18754
|
key: "color",
|
|
@@ -18946,6 +18951,16 @@ var /**
|
|
|
18946
18951
|
get: /**
|
|
18947
18952
|
* The bounding volume of the TextRenderer.
|
|
18948
18953
|
*/ function get() {
|
|
18954
|
+
if (this._isTextNoVisible()) {
|
|
18955
|
+
if (this._isContainDirtyFlag(0x8)) {
|
|
18956
|
+
var localBounds = this._localBounds;
|
|
18957
|
+
localBounds.min.set(0, 0, 0);
|
|
18958
|
+
localBounds.max.set(0, 0, 0);
|
|
18959
|
+
this._updateBounds(this._bounds);
|
|
18960
|
+
this._setDirtyFlagFalse(0x8);
|
|
18961
|
+
}
|
|
18962
|
+
return this._bounds;
|
|
18963
|
+
}
|
|
18949
18964
|
this._isContainDirtyFlag(0x1) && this._resetSubFont();
|
|
18950
18965
|
this._isContainDirtyFlag(0x2) && this._updateLocalData();
|
|
18951
18966
|
this._isContainDirtyFlag(0x4) && this._updatePosition();
|
|
@@ -21947,12 +21962,38 @@ var passNum = 0;
|
|
|
21947
21962
|
/**
|
|
21948
21963
|
* @internal
|
|
21949
21964
|
*/ RenderQueue._compareFromNearToFar = function _compareFromNearToFar(a, b) {
|
|
21950
|
-
|
|
21965
|
+
var dataA = a.data;
|
|
21966
|
+
var dataB = b.data;
|
|
21967
|
+
var componentA = dataA.component;
|
|
21968
|
+
var componentB = dataB.component;
|
|
21969
|
+
var priorityOrder = componentA.priority - componentB.priority;
|
|
21970
|
+
if (priorityOrder !== 0) {
|
|
21971
|
+
return priorityOrder;
|
|
21972
|
+
}
|
|
21973
|
+
// make suer from the same renderer.
|
|
21974
|
+
if (componentA.instanceId === componentB.instanceId) {
|
|
21975
|
+
return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
|
|
21976
|
+
} else {
|
|
21977
|
+
return componentA._distanceForSort - componentB._distanceForSort;
|
|
21978
|
+
}
|
|
21951
21979
|
};
|
|
21952
21980
|
/**
|
|
21953
21981
|
* @internal
|
|
21954
21982
|
*/ RenderQueue._compareFromFarToNear = function _compareFromFarToNear(a, b) {
|
|
21955
|
-
|
|
21983
|
+
var dataA = a.data;
|
|
21984
|
+
var dataB = b.data;
|
|
21985
|
+
var componentA = dataA.component;
|
|
21986
|
+
var componentB = dataB.component;
|
|
21987
|
+
var priorityOrder = componentA.priority - componentB.priority;
|
|
21988
|
+
if (priorityOrder !== 0) {
|
|
21989
|
+
return priorityOrder;
|
|
21990
|
+
}
|
|
21991
|
+
// make suer from the same renderer.
|
|
21992
|
+
if (componentA.instanceId === componentB.instanceId) {
|
|
21993
|
+
return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
|
|
21994
|
+
} else {
|
|
21995
|
+
return componentB._distanceForSort - componentA._distanceForSort;
|
|
21996
|
+
}
|
|
21956
21997
|
};
|
|
21957
21998
|
return RenderQueue;
|
|
21958
21999
|
}();
|
package/dist/module.js
CHANGED
|
@@ -1943,13 +1943,15 @@ var Logger = {
|
|
|
1943
1943
|
];
|
|
1944
1944
|
})();
|
|
1945
1945
|
(function() {
|
|
1946
|
-
|
|
1946
|
+
// _heightMultiplier used to measure the height of text, but in miniprogram performance is different from h5.
|
|
1947
|
+
// so can set _heightMultiplier to adapt miniprogram, the larger the value, the worse the performance.
|
|
1948
|
+
/** @internal */ TextUtils._heightMultiplier = 2;
|
|
1947
1949
|
})();
|
|
1948
1950
|
(function() {
|
|
1949
|
-
TextUtils.
|
|
1951
|
+
/** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
|
|
1950
1952
|
})();
|
|
1951
1953
|
(function() {
|
|
1952
|
-
TextUtils.
|
|
1954
|
+
TextUtils._measureBaseline = "M";
|
|
1953
1955
|
})();
|
|
1954
1956
|
(function() {
|
|
1955
1957
|
TextUtils._baselineMultiplier = 1.4;
|
|
@@ -2033,7 +2035,7 @@ var Logger = {
|
|
|
2033
2035
|
var _this = this, engine = _this._engine;
|
|
2034
2036
|
var fontAtlas = new FontAtlas(engine);
|
|
2035
2037
|
var texture = new Texture2D(engine, 256, 256, TextureFormat.R8G8B8A8, false);
|
|
2036
|
-
texture.filterMode = TextureFilterMode.
|
|
2038
|
+
texture.filterMode = TextureFilterMode.Bilinear;
|
|
2037
2039
|
fontAtlas.texture = texture;
|
|
2038
2040
|
fontAtlas.isGCIgnored = texture.isGCIgnored = true;
|
|
2039
2041
|
this._fontAtlases.push(fontAtlas);
|
|
@@ -18537,7 +18539,7 @@ var /**
|
|
|
18537
18539
|
/**
|
|
18538
18540
|
* @internal
|
|
18539
18541
|
*/ _proto._render = function _render(context) {
|
|
18540
|
-
if (this.
|
|
18542
|
+
if (this._isTextNoVisible()) {
|
|
18541
18543
|
return;
|
|
18542
18544
|
}
|
|
18543
18545
|
if (this._isContainDirtyFlag(0x10)) {
|
|
@@ -18629,8 +18631,8 @@ var /**
|
|
|
18629
18631
|
}
|
|
18630
18632
|
};
|
|
18631
18633
|
_proto._updateLocalData = function _updateLocalData() {
|
|
18632
|
-
var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
|
|
18633
18634
|
var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
|
|
18635
|
+
var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
|
|
18634
18636
|
var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
|
|
18635
18637
|
var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
|
|
18636
18638
|
var charRenderDataPool = TextRenderer._charRenderDataPool;
|
|
@@ -18698,7 +18700,7 @@ var /**
|
|
|
18698
18700
|
var left = startX * pixelsPerUnitReciprocal;
|
|
18699
18701
|
var right = (startX + w) * pixelsPerUnitReciprocal;
|
|
18700
18702
|
var top = (startY + ascent) * pixelsPerUnitReciprocal;
|
|
18701
|
-
var bottom = (startY - descent
|
|
18703
|
+
var bottom = (startY - descent) * pixelsPerUnitReciprocal;
|
|
18702
18704
|
localPositions.set(left, top, right, bottom);
|
|
18703
18705
|
i === firstLine && (maxY = Math.max(maxY, top));
|
|
18704
18706
|
minY = Math.min(minY, bottom);
|
|
@@ -18739,6 +18741,9 @@ var /**
|
|
|
18739
18741
|
Renderer1.prototype._onTransformChanged.call(this, bit);
|
|
18740
18742
|
this._setDirtyFlagTrue(0x4 | 0x8);
|
|
18741
18743
|
};
|
|
18744
|
+
_proto._isTextNoVisible = function _isTextNoVisible() {
|
|
18745
|
+
return this._text === "" || this._fontSize === 0 || this.enableWrapping && this.width <= 0 || this.overflowMode === OverflowMode.Truncate && this.height <= 0;
|
|
18746
|
+
};
|
|
18742
18747
|
_create_class(TextRenderer, [
|
|
18743
18748
|
{
|
|
18744
18749
|
key: "color",
|
|
@@ -18941,6 +18946,16 @@ var /**
|
|
|
18941
18946
|
get: /**
|
|
18942
18947
|
* The bounding volume of the TextRenderer.
|
|
18943
18948
|
*/ function get() {
|
|
18949
|
+
if (this._isTextNoVisible()) {
|
|
18950
|
+
if (this._isContainDirtyFlag(0x8)) {
|
|
18951
|
+
var localBounds = this._localBounds;
|
|
18952
|
+
localBounds.min.set(0, 0, 0);
|
|
18953
|
+
localBounds.max.set(0, 0, 0);
|
|
18954
|
+
this._updateBounds(this._bounds);
|
|
18955
|
+
this._setDirtyFlagFalse(0x8);
|
|
18956
|
+
}
|
|
18957
|
+
return this._bounds;
|
|
18958
|
+
}
|
|
18944
18959
|
this._isContainDirtyFlag(0x1) && this._resetSubFont();
|
|
18945
18960
|
this._isContainDirtyFlag(0x2) && this._updateLocalData();
|
|
18946
18961
|
this._isContainDirtyFlag(0x4) && this._updatePosition();
|
|
@@ -21942,12 +21957,38 @@ var passNum = 0;
|
|
|
21942
21957
|
/**
|
|
21943
21958
|
* @internal
|
|
21944
21959
|
*/ RenderQueue._compareFromNearToFar = function _compareFromNearToFar(a, b) {
|
|
21945
|
-
|
|
21960
|
+
var dataA = a.data;
|
|
21961
|
+
var dataB = b.data;
|
|
21962
|
+
var componentA = dataA.component;
|
|
21963
|
+
var componentB = dataB.component;
|
|
21964
|
+
var priorityOrder = componentA.priority - componentB.priority;
|
|
21965
|
+
if (priorityOrder !== 0) {
|
|
21966
|
+
return priorityOrder;
|
|
21967
|
+
}
|
|
21968
|
+
// make suer from the same renderer.
|
|
21969
|
+
if (componentA.instanceId === componentB.instanceId) {
|
|
21970
|
+
return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
|
|
21971
|
+
} else {
|
|
21972
|
+
return componentA._distanceForSort - componentB._distanceForSort;
|
|
21973
|
+
}
|
|
21946
21974
|
};
|
|
21947
21975
|
/**
|
|
21948
21976
|
* @internal
|
|
21949
21977
|
*/ RenderQueue._compareFromFarToNear = function _compareFromFarToNear(a, b) {
|
|
21950
|
-
|
|
21978
|
+
var dataA = a.data;
|
|
21979
|
+
var dataB = b.data;
|
|
21980
|
+
var componentA = dataA.component;
|
|
21981
|
+
var componentB = dataB.component;
|
|
21982
|
+
var priorityOrder = componentA.priority - componentB.priority;
|
|
21983
|
+
if (priorityOrder !== 0) {
|
|
21984
|
+
return priorityOrder;
|
|
21985
|
+
}
|
|
21986
|
+
// make suer from the same renderer.
|
|
21987
|
+
if (componentA.instanceId === componentB.instanceId) {
|
|
21988
|
+
return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
|
|
21989
|
+
} else {
|
|
21990
|
+
return componentB._distanceForSort - componentA._distanceForSort;
|
|
21991
|
+
}
|
|
21951
21992
|
};
|
|
21952
21993
|
return RenderQueue;
|
|
21953
21994
|
}();
|