Cleaned up an old Overlay helper function
Brian Vaughn committed
Apr 7, 2019 at 09:53 UTC
850dda0fb93cde4c9e86abfac6b4d3b1d9685545
1 file changed
+12
-12
src/backend/views/Overlay.js
+12
-12
@@ -218,18 +218,18 @@ function findTipPos(dims, win) {
218
export function getElementDimensions(domElement: Element) {
219
const calculatedStyle = window.getComputedStyle(domElement);
220
return {
221
- borderLeft: +calculatedStyle.borderLeftWidth.match(/[0-9]*/)[0],
222
- borderRight: +calculatedStyle.borderRightWidth.match(/[0-9]*/)[0],
223
- borderTop: +calculatedStyle.borderTopWidth.match(/[0-9]*/)[0],
224
- borderBottom: +calculatedStyle.borderBottomWidth.match(/[0-9]*/)[0],
225
- marginLeft: +calculatedStyle.marginLeft.match(/[0-9]*/)[0],
226
- marginRight: +calculatedStyle.marginRight.match(/[0-9]*/)[0],
227
- marginTop: +calculatedStyle.marginTop.match(/[0-9]*/)[0],
228
- marginBottom: +calculatedStyle.marginBottom.match(/[0-9]*/)[0],
229
- paddingLeft: +calculatedStyle.paddingLeft.match(/[0-9]*/)[0],
230
- paddingRight: +calculatedStyle.paddingRight.match(/[0-9]*/)[0],
231
- paddingTop: +calculatedStyle.paddingTop.match(/[0-9]*/)[0],
232
- paddingBottom: +calculatedStyle.paddingBottom.match(/[0-9]*/)[0],
221
+ borderLeft: parseInt(calculatedStyle.borderLeftWidth, 10),
222
+ borderRight: parseInt(calculatedStyle.borderRightWidth, 10),
223
+ borderTop: parseInt(calculatedStyle.borderTopWidth, 10),
224
+ borderBottom: parseInt(calculatedStyle.borderBottomWidth, 10),
225
+ marginLeft: parseInt(calculatedStyle.marginLeft, 10),
226
+ marginRight: parseInt(calculatedStyle.marginRight, 10),
227
+ marginTop: parseInt(calculatedStyle.marginTop, 10),
228
+ marginBottom: parseInt(calculatedStyle.marginBottom, 10),
229
+ paddingLeft: parseInt(calculatedStyle.paddingLeft, 10),
230
+ paddingRight: parseInt(calculatedStyle.paddingRight, 10),
231
+ paddingTop: parseInt(calculatedStyle.paddingTop, 10),
232
+ paddingBottom: parseInt(calculatedStyle.paddingBottom, 10),
233
};
234
}
235