Browse Source

KERNEL-14215 fix:index.html配置的BI.pixUnit和BI.pixRatio失效-bug48

es6
Vivy.Pan 2 years ago
parent
commit
92d96f9b7b
  1. 12
      src/core/constant/var.js

12
src/core/constant/var.js

@ -142,10 +142,10 @@ export function pixFormat(pix, border) {
if (!isNumber(pix)) {
return pix;
}
if (pixUnit === "px") {
return (pix / pixRatio - (border || 0)) + pixUnit;
if (BI.pixUnit === "px") {
return (pix / BI.pixRatio - (border || 0)) + BI.pixUnit;
}
const length = pix / pixRatio + pixUnit;
const length = pix / BI.pixRatio + BI.pixUnit;
if (border > 0) {
return `calc(${length} - ${`${border}px`})`;
}
@ -157,11 +157,11 @@ export function toPix(pix, border) {
if (!isNumber(pix)) {
return pix;
}
if (pixUnit === "px") {
return pix - (border || 0) * pixRatio;
if (BI.pixUnit === "px") {
return pix - (border || 0) * BI.pixRatio;
}
if (border > 0) {
return `calc(${pix / pixRatio + pixUnit} - ${`${border}px`})`;
return `calc(${pix / BI.pixRatio + BI.pixUnit} - ${`${border}px`})`;
}
return pix;

Loading…
Cancel
Save