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