@galacean/engine-core 1.3.3 → 1.3.5
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 +14 -12
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +14 -12
- package/dist/module.js +14 -12
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
package/dist/main.js
CHANGED
|
@@ -11169,9 +11169,12 @@ var /**
|
|
|
11169
11169
|
// Safari gets data confusion through getImageData when the canvas width is not an integer.
|
|
11170
11170
|
// The measure text width of some special invisible characters may be 0, so make sure the width is at least 1.
|
|
11171
11171
|
// @todo: Text layout may vary from standard and not support emoji.
|
|
11172
|
-
var
|
|
11172
|
+
var _context_measureText = context.measureText(measureString), actualBoundingBoxLeft = _context_measureText.actualBoundingBoxLeft, actualBoundingBoxRight = _context_measureText.actualBoundingBoxRight, actualWidth = _context_measureText.width;
|
|
11173
11173
|
// In some case (ex: " "), actualBoundingBoxRight and actualBoundingBoxLeft will be 0, so use width.
|
|
11174
|
-
|
|
11174
|
+
// TODO: With testing, actualBoundingBoxLeft + actualBoundingBoxRight is the actual rendering width
|
|
11175
|
+
// but the space rules between characters are unclear. Using actualBoundingBoxRight + Math.abs(actualBoundingBoxLeft) is the closest to the native effect.
|
|
11176
|
+
var width = Math.max(1, Math.round(Math.max(actualBoundingBoxRight + Math.abs(actualBoundingBoxLeft), actualWidth)));
|
|
11177
|
+
// Make sure enough width.
|
|
11175
11178
|
var baseline = Math.ceil(context.measureText(TextUtils._measureBaseline).width);
|
|
11176
11179
|
var height = baseline * TextUtils._heightMultiplier;
|
|
11177
11180
|
baseline = TextUtils._baselineMultiplier * baseline | 0;
|
|
@@ -11185,7 +11188,11 @@ var /**
|
|
|
11185
11188
|
context.clearRect(0, 0, width, height);
|
|
11186
11189
|
context.textBaseline = "middle";
|
|
11187
11190
|
context.fillStyle = "#fff";
|
|
11188
|
-
|
|
11191
|
+
if (actualBoundingBoxLeft > 0) {
|
|
11192
|
+
context.fillText(measureString, actualBoundingBoxLeft, baseline);
|
|
11193
|
+
} else {
|
|
11194
|
+
context.fillText(measureString, 0, baseline);
|
|
11195
|
+
}
|
|
11189
11196
|
var colorData = context.getImageData(0, 0, width, height).data;
|
|
11190
11197
|
var len = colorData.length;
|
|
11191
11198
|
var top = -1;
|
|
@@ -11229,9 +11236,9 @@ var /**
|
|
|
11229
11236
|
y: 0,
|
|
11230
11237
|
w: width,
|
|
11231
11238
|
h: size,
|
|
11232
|
-
offsetX: 0,
|
|
11239
|
+
offsetX: actualBoundingBoxLeft > 0 ? actualBoundingBoxLeft : 0,
|
|
11233
11240
|
offsetY: (ascent - descent) * 0.5,
|
|
11234
|
-
xAdvance:
|
|
11241
|
+
xAdvance: Math.round(actualWidth),
|
|
11235
11242
|
uvs: [
|
|
11236
11243
|
new engineMath.Vector2(),
|
|
11237
11244
|
new engineMath.Vector2(),
|
|
@@ -11800,7 +11807,7 @@ var /**
|
|
|
11800
11807
|
j === firstRow && (minX = Math.min(minX, left));
|
|
11801
11808
|
maxX = Math.max(maxX, right);
|
|
11802
11809
|
}
|
|
11803
|
-
startX += charInfo.xAdvance;
|
|
11810
|
+
startX += charInfo.xAdvance + charInfo.offsetX;
|
|
11804
11811
|
}
|
|
11805
11812
|
}
|
|
11806
11813
|
startY -= lineHeight;
|
|
@@ -12630,8 +12637,6 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
12630
12637
|
_this = ReferResource1.call(this, engine) || this;
|
|
12631
12638
|
/** @internal */ _this._renderStates = [] // todo: later will as a part of shaderData when shader effect frame is OK, that is more powerful and flexible.
|
|
12632
12639
|
;
|
|
12633
|
-
/** @internal */ _this._priority = 0 // todo: temporary resolution of submesh rendering order issue.
|
|
12634
|
-
;
|
|
12635
12640
|
_this._shaderData = new ShaderData(ShaderDataGroup.Material);
|
|
12636
12641
|
_this.shader = shader;
|
|
12637
12642
|
return _this;
|
|
@@ -18881,7 +18886,7 @@ var ObjectPool = /*#__PURE__*/ function() {
|
|
|
18881
18886
|
* @internal
|
|
18882
18887
|
*/ var PrimitiveChunkManager = /*#__PURE__*/ function() {
|
|
18883
18888
|
function PrimitiveChunkManager(engine, maxVertexCount) {
|
|
18884
|
-
if (maxVertexCount === void 0) maxVertexCount =
|
|
18889
|
+
if (maxVertexCount === void 0) maxVertexCount = 4096;
|
|
18885
18890
|
this.engine = engine;
|
|
18886
18891
|
this.maxVertexCount = maxVertexCount;
|
|
18887
18892
|
this.primitiveChunks = new Array();
|
|
@@ -18922,9 +18927,6 @@ var ObjectPool = /*#__PURE__*/ function() {
|
|
|
18922
18927
|
};
|
|
18923
18928
|
return PrimitiveChunkManager;
|
|
18924
18929
|
}();
|
|
18925
|
-
(function() {
|
|
18926
|
-
/** The maximum number of vertex. */ PrimitiveChunkManager.MAX_VERTEX_COUNT = 4096;
|
|
18927
|
-
})();
|
|
18928
18930
|
|
|
18929
18931
|
/**
|
|
18930
18932
|
* @internal
|