@galacean/engine-core 1.5.0-alpha.2 → 1.5.0-beta.0
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 +20 -0
- package/dist/main.js.map +1 -1
- package/dist/module.js +20 -0
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
package/dist/module.js
CHANGED
|
@@ -36550,6 +36550,7 @@ __decorate([
|
|
|
36550
36550
|
Polyfill.registerPolyfill = function registerPolyfill() {
|
|
36551
36551
|
Polyfill._registerMatchAll();
|
|
36552
36552
|
Polyfill._registerAudioContext();
|
|
36553
|
+
Polyfill._registerTextMetrics();
|
|
36553
36554
|
};
|
|
36554
36555
|
Polyfill._registerMatchAll = function _registerMatchAll() {
|
|
36555
36556
|
if (!String.prototype.matchAll) {
|
|
@@ -36627,6 +36628,25 @@ __decorate([
|
|
|
36627
36628
|
};
|
|
36628
36629
|
}
|
|
36629
36630
|
};
|
|
36631
|
+
Polyfill._registerTextMetrics = function _registerTextMetrics() {
|
|
36632
|
+
// Based on the specific version of the engine implementation, when actualBoundingBoxLeft is not supported, width is used to represent the rendering width, and `textAlign` uses the default value `start` and direction is left to right.
|
|
36633
|
+
// Some devices do not support actualBoundingBoxLeft and actualBoundingBoxRight in TextMetrics.
|
|
36634
|
+
// Examples: Google Pixel 2 XL (Android 11), Honor 6X (Android 8).
|
|
36635
|
+
if (!("actualBoundingBoxLeft" in TextMetrics.prototype)) {
|
|
36636
|
+
Object.defineProperties(TextMetrics.prototype, {
|
|
36637
|
+
actualBoundingBoxLeft: {
|
|
36638
|
+
get: function get() {
|
|
36639
|
+
return 0;
|
|
36640
|
+
}
|
|
36641
|
+
},
|
|
36642
|
+
actualBoundingBoxRight: {
|
|
36643
|
+
get: function get() {
|
|
36644
|
+
return this.width;
|
|
36645
|
+
}
|
|
36646
|
+
}
|
|
36647
|
+
});
|
|
36648
|
+
}
|
|
36649
|
+
};
|
|
36630
36650
|
return Polyfill;
|
|
36631
36651
|
}();
|
|
36632
36652
|
|