export function convertPx(initialUnits){ if (!initialUnits) { return 0; } let searchFlag = initialUnits.search('rpx'); if (searchFlag >= 0) { return parseInt(initialUnits) / 2; } else { searchFlag = initialUnits.search('px'); if (searchFlag >= 0) { return parseInt(initialUnits); } else { return 0; } } } export function getVerticalBoderWidth(style){ let bottomWidth = 0; if (style.borderBottomWidth && (style.borderBottomWidth.search("px") >= 0)) { bottomWidth = convertPx(style.borderBottomWidth); } else { if (style.borderBottom && (style.borderBottom.search("px") >= 0)) { let borderBottom = style.borderBottom.substr(0, style.borderBottom.search("px")+2); bottomWidth = convertPx(borderBottom); } else { if (style.borderWidth && (style.borderWidth.search("px") >= 0)) { bottomWidth = convertPx(style.borderWidth); } else { if (style.border && (style.border.search("px") >= 0)) { let border = style.border.substr(0, style.border.search("px")+2); bottomWidth = convertPx(border); } } } } let topWidth = 0; if (style.borderTopWidth && (style.borderTopWidth.search("px") >= 0)) { topWidth = convertPx(style.borderTopWidth); } else { if (style.borderTop && (style.borderTop.search("px") >= 0)) { let borderTop = style.borderTop.substr(0, style.borderTop.search("px")+2); topWidth = convertPx(borderTop); } else { if (style.borderWidth && (style.borderWidth.search("px") >= 0)) { topWidth = convertPx(style.borderWidth); } else { if (style.border && (style.border.search("px") >= 0)) { let border = style.border.substr(0, style.border.search("px")+2); topWidth = convertPx(border); } } } } return bottomWidth + topWidth; }