@galacean/engine-core 1.5.0-alpha.2 → 1.5.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/main.js
CHANGED
|
@@ -36554,6 +36554,7 @@ __decorate([
|
|
|
36554
36554
|
Polyfill.registerPolyfill = function registerPolyfill() {
|
|
36555
36555
|
Polyfill._registerMatchAll();
|
|
36556
36556
|
Polyfill._registerAudioContext();
|
|
36557
|
+
Polyfill._registerTextMetrics();
|
|
36557
36558
|
};
|
|
36558
36559
|
Polyfill._registerMatchAll = function _registerMatchAll() {
|
|
36559
36560
|
if (!String.prototype.matchAll) {
|
|
@@ -36631,6 +36632,25 @@ __decorate([
|
|
|
36631
36632
|
};
|
|
36632
36633
|
}
|
|
36633
36634
|
};
|
|
36635
|
+
Polyfill._registerTextMetrics = function _registerTextMetrics() {
|
|
36636
|
+
// 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.
|
|
36637
|
+
// Some devices do not support actualBoundingBoxLeft and actualBoundingBoxRight in TextMetrics.
|
|
36638
|
+
// Examples: Google Pixel 2 XL (Android 11), Honor 6X (Android 8).
|
|
36639
|
+
if (!("actualBoundingBoxLeft" in TextMetrics.prototype)) {
|
|
36640
|
+
Object.defineProperties(TextMetrics.prototype, {
|
|
36641
|
+
actualBoundingBoxLeft: {
|
|
36642
|
+
get: function get() {
|
|
36643
|
+
return 0;
|
|
36644
|
+
}
|
|
36645
|
+
},
|
|
36646
|
+
actualBoundingBoxRight: {
|
|
36647
|
+
get: function get() {
|
|
36648
|
+
return this.width;
|
|
36649
|
+
}
|
|
36650
|
+
}
|
|
36651
|
+
});
|
|
36652
|
+
}
|
|
36653
|
+
};
|
|
36634
36654
|
return Polyfill;
|
|
36635
36655
|
}();
|
|
36636
36656
|
|