From 691b6384ee5cab81ae50a0899e9592740320bb9c Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Mon, 27 Apr 2020 22:04:59 +0300 Subject: [PATCH] Use Math.ceil instead of round --- Picker.js | 4 ++-- main.js | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Picker.js b/Picker.js index 349e157..0958924 100644 --- a/Picker.js +++ b/Picker.js @@ -181,7 +181,7 @@ export default class Picker extends React.Component + (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop) - (document.documentElement.clientTop || document.body.clientTop || 0); const max_height = (direction == 'down' ? screen_height-top-(clientRect.height||0)-32 : top-32); - const height = Math.round(popup_size.height < max_height ? popup_size.height : max_height); + const height = Math.ceil(popup_size.height < max_height ? popup_size.height : max_height); top = direction == 'down' ? (top + (clientRect.height||0)) : (top - height); let left = (clientRect.left + (window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft) @@ -191,7 +191,7 @@ export default class Picker extends React.Component left = screen_width - popup_size.width; } let width = (clientRect.width||0) > popup_size.width ? clientRect.width : popup_size.width; - width = Math.round(props && props.minWidth && width < props.minWidth ? props.minWidth : width); + width = Math.ceil(props && props.minWidth && width < props.minWidth ? props.minWidth : width); return { top, left, width, height }; } } diff --git a/main.js b/main.js index 7e0e97b..e06f30a 100644 --- a/main.js +++ b/main.js @@ -87,7 +87,6 @@ class Test extends React.PureComponent />