提交 7bab03d6 编写于 作者: Q qiang

fix(mp): upx2px ignore config

上级 d3b33bbe
......@@ -39,12 +39,14 @@ export const upx2px = defineSyncApi<API_TYPE_UPX2PX>(
if (number === 0) {
return 0
}
const config = __uniConfig.globalStyle || {}
// ignore rpxCalcIncludeWidth
const maxWidth = checkValue(config.rpxCalcMaxDeviceWidth, 960)
const baseWidth = checkValue(config.rpxCalcBaseDeviceWidth, 375)
let width = newDeviceWidth || deviceWidth
width = width <= maxWidth ? width : baseWidth
if (__PLATFORM__ === 'app' || __PLATFORM__ === 'h5') {
const config = __uniConfig.globalStyle || {}
// ignore rpxCalcIncludeWidth
const maxWidth = checkValue(config.rpxCalcMaxDeviceWidth, 960)
const baseWidth = checkValue(config.rpxCalcBaseDeviceWidth, 375)
width = width <= maxWidth ? width : baseWidth
}
let result = (number / BASE_DEVICE_WIDTH) * width
if (result < 0) {
result = -result
......
......@@ -9919,11 +9919,13 @@ const upx2px = /* @__PURE__ */ defineSyncApi(API_UPX2PX, (number, newDeviceWidth
if (number === 0) {
return 0;
}
const config = __uniConfig.globalStyle || {};
const maxWidth = checkValue(config.rpxCalcMaxDeviceWidth, 960);
const baseWidth = checkValue(config.rpxCalcBaseDeviceWidth, 375);
let width = newDeviceWidth || deviceWidth;
width = width <= maxWidth ? width : baseWidth;
{
const config = __uniConfig.globalStyle || {};
const maxWidth = checkValue(config.rpxCalcMaxDeviceWidth, 960);
const baseWidth = checkValue(config.rpxCalcBaseDeviceWidth, 375);
width = width <= maxWidth ? width : baseWidth;
}
let result = number / BASE_DEVICE_WIDTH * width;
if (result < 0) {
result = -result;
......
......@@ -232,7 +232,8 @@ const upx2px = defineSyncApi(API_UPX2PX, (number, newDeviceWidth) => {
if (number === 0) {
return 0;
}
let result = (number / BASE_DEVICE_WIDTH) * (newDeviceWidth || deviceWidth);
let width = newDeviceWidth || deviceWidth;
let result = (number / BASE_DEVICE_WIDTH) * width;
if (result < 0) {
result = -result;
}
......
......@@ -232,7 +232,8 @@ const upx2px = defineSyncApi(API_UPX2PX, (number, newDeviceWidth) => {
if (number === 0) {
return 0;
}
let result = (number / BASE_DEVICE_WIDTH) * (newDeviceWidth || deviceWidth);
let width = newDeviceWidth || deviceWidth;
let result = (number / BASE_DEVICE_WIDTH) * width;
if (result < 0) {
result = -result;
}
......
......@@ -232,7 +232,8 @@ const upx2px = defineSyncApi(API_UPX2PX, (number, newDeviceWidth) => {
if (number === 0) {
return 0;
}
let result = (number / BASE_DEVICE_WIDTH) * (newDeviceWidth || deviceWidth);
let width = newDeviceWidth || deviceWidth;
let result = (number / BASE_DEVICE_WIDTH) * width;
if (result < 0) {
result = -result;
}
......
......@@ -232,7 +232,8 @@ const upx2px = defineSyncApi(API_UPX2PX, (number, newDeviceWidth) => {
if (number === 0) {
return 0;
}
let result = (number / BASE_DEVICE_WIDTH) * (newDeviceWidth || deviceWidth);
let width = newDeviceWidth || deviceWidth;
let result = (number / BASE_DEVICE_WIDTH) * width;
if (result < 0) {
result = -result;
}
......
......@@ -232,7 +232,8 @@ const upx2px = defineSyncApi(API_UPX2PX, (number, newDeviceWidth) => {
if (number === 0) {
return 0;
}
let result = (number / BASE_DEVICE_WIDTH) * (newDeviceWidth || deviceWidth);
let width = newDeviceWidth || deviceWidth;
let result = (number / BASE_DEVICE_WIDTH) * width;
if (result < 0) {
result = -result;
}
......
......@@ -232,7 +232,8 @@ const upx2px = defineSyncApi(API_UPX2PX, (number, newDeviceWidth) => {
if (number === 0) {
return 0;
}
let result = (number / BASE_DEVICE_WIDTH) * (newDeviceWidth || deviceWidth);
let width = newDeviceWidth || deviceWidth;
let result = (number / BASE_DEVICE_WIDTH) * width;
if (result < 0) {
result = -result;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册