From 9c6a49a3c7175ab545b48e146d6a9b5a3b0e1523 Mon Sep 17 00:00:00 2001 From: wangyaqi Date: Thu, 4 Jun 2020 18:39:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20margin:=20-1rpx;=20=E8=A2=AB=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E8=AE=A1=E7=AE=97=E6=88=901px=E7=9A=84bug=20askId:=20?= =?UTF-8?q?98270?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/runtime/upx2px.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/core/runtime/upx2px.js b/src/core/runtime/upx2px.js index 72c7a1f52..17e13d24f 100644 --- a/src/core/runtime/upx2px.js +++ b/src/core/runtime/upx2px.js @@ -25,17 +25,17 @@ export function upx2px (number, newDeviceWidth) { if (number === 0) { return 0 } - let result = (number / BASE_DEVICE_WIDTH) * (newDeviceWidth || deviceWidth) - if (result < 0) { - result = -result - } - result = Math.floor(result + EPS) - if (result === 0) { - if (deviceDPR === 1 || !isIOS) { - return 1 - } else { - return 0.5 - } - } + let result = (number / BASE_DEVICE_WIDTH) * (newDeviceWidth || deviceWidth) + if (result < 0) { + result = -result + } + result = Math.floor(result + EPS) + if (result === 0) { + if (deviceDPR === 1 || !isIOS) { + result = 1 + } else { + result = 0.5 + } + } return number < 0 ? -result : result -} +} -- GitLab