gm-printer 10.13.8-alpha.4 → 10.13.8-alpha.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/package.json +1 -1
- package/src/util.js +5 -3
package/package.json
CHANGED
package/src/util.js
CHANGED
|
@@ -15,12 +15,14 @@ function getHeight(el) {
|
|
|
15
15
|
|
|
16
16
|
function getWidth(el) {
|
|
17
17
|
const styles = window.getComputedStyle(el)
|
|
18
|
-
|
|
18
|
+
// 取width保留小数点用 getBoundClientRect
|
|
19
|
+
const style = el.getBoundingClientRect()
|
|
20
|
+
const width = Math.round(style.width * 100) / 100 // 保留两位小数并四舍五入
|
|
19
21
|
const borderLeftWidth = parseFloat(styles.borderLeftWidth)
|
|
20
|
-
const borderRightWidth = parseFloat(styles.borderRightWidth)
|
|
22
|
+
// const borderRightWidth = parseFloat(styles.borderRightWidth)
|
|
21
23
|
const paddingLeft = parseFloat(styles.paddingLeft)
|
|
22
24
|
const paddingRight = parseFloat(styles.paddingRight)
|
|
23
|
-
return width - borderLeftWidth -
|
|
25
|
+
return width - borderLeftWidth - paddingLeft - paddingRight
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
function pxAdd(origin = '0px', add) {
|