提交 9c6a49a3 编写于 作者: 雪洛's avatar 雪洛

fix: margin: -1rpx; 被错误计算成1px的bug askId: 98270

上级 e9057307
...@@ -25,17 +25,17 @@ export function upx2px (number, newDeviceWidth) { ...@@ -25,17 +25,17 @@ export function upx2px (number, newDeviceWidth) {
if (number === 0) { if (number === 0) {
return 0 return 0
} }
let result = (number / BASE_DEVICE_WIDTH) * (newDeviceWidth || deviceWidth) let result = (number / BASE_DEVICE_WIDTH) * (newDeviceWidth || deviceWidth)
if (result < 0) { if (result < 0) {
result = -result result = -result
} }
result = Math.floor(result + EPS) result = Math.floor(result + EPS)
if (result === 0) { if (result === 0) {
if (deviceDPR === 1 || !isIOS) { if (deviceDPR === 1 || !isIOS) {
return 1 result = 1
} else { } else {
return 0.5 result = 0.5
} }
} }
return number < 0 ? -result : result return number < 0 ? -result : result
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册