hsu-utils 0.0.28 → 0.0.29
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/hsu-utils.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
2
|
*
|
3
|
-
* hsu-utils v0.0.
|
3
|
+
* hsu-utils v0.0.28
|
4
4
|
*
|
5
5
|
* some front-end utils
|
6
6
|
*
|
@@ -131,7 +131,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
131
131
|
/***/ ((__unused_webpack_module, exports) => {
|
132
132
|
|
133
133
|
"use strict";
|
134
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nfunction get_string_size(str, font, letterSpacing) {\n if (font === void 0) { font = {}; }\n if (letterSpacing === void 0) { letterSpacing = 0; }\n var _a = font.style, style = _a === void 0 ? 'normal' : _a, _b = font.variant, variant = _b === void 0 ? 'normal' : _b, _c = font.weight, weight = _c === void 0 ? 'normal' : _c, _d = font.size, size = _d === void 0 ? 12 : _d, _e = font.family, fontFamily = _e === void 0 ? '微软雅黑' : _e;\n var canvas = document.createElement('canvas');\n var ctx = canvas.getContext('2d');\n ctx.font = \"\".concat(style, \" \").concat(variant, \" \").concat(weight, \" \").concat(size, \"px \").concat(fontFamily);\n var metrics = ctx.measureText(str);\n var width = +(+metrics.width.toFixed(2) + 0.01).toFixed(2);\n var height = +(+metrics.actualBoundingBoxAscent.toFixed(2) + +metrics.actualBoundingBoxDescent.toFixed(2)).toFixed(2);\n var _letterSpacing = (str.length > 0 ? str.length - 1 : 0) * letterSpacing;\n width += _letterSpacing;\n return { width: width, height: height };\n}\nexports[\"default\"] = get_string_size;\n\n\n//# sourceURL=webpack://hsu-utils/./tools/GetStrSize/index.ts?");
|
134
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nfunction get_string_size(str, font, letterSpacing) {\n if (font === void 0) { font = {}; }\n if (letterSpacing === void 0) { letterSpacing = 0; }\n var _a = font.style, style = _a === void 0 ? 'normal' : _a, _b = font.variant, variant = _b === void 0 ? 'normal' : _b, _c = font.weight, weight = _c === void 0 ? 'normal' : _c, _d = font.size, size = _d === void 0 ? 12 : _d, _e = font.family, fontFamily = _e === void 0 ? '微软雅黑' : _e;\n var canvas = document.createElement('canvas');\n var ctx = canvas.getContext('2d');\n ctx.font = \"\".concat(style, \" \").concat(variant, \" \").concat(weight, \" \").concat(size, \"px \").concat(fontFamily);\n var metrics = ctx.measureText(str);\n var width = +(+metrics.width.toFixed(2) + 0.01).toFixed(2);\n var height = +(+metrics.actualBoundingBoxAscent.toFixed(2) + +metrics.actualBoundingBoxDescent.toFixed(2)).toFixed(2);\n var _letterSpacing = (str.length > 0 ? str.length - 1 : 0) * letterSpacing;\n width += _letterSpacing;\n return { width: +width.toFixed(2), height: +height.toFixed(2) };\n}\nexports[\"default\"] = get_string_size;\n\n\n//# sourceURL=webpack://hsu-utils/./tools/GetStrSize/index.ts?");
|
135
135
|
|
136
136
|
/***/ }),
|
137
137
|
|