From 25e8d6f88d95de12559014c9d479d6d1bcc4cfbf Mon Sep 17 00:00:00 2001 From: RobertPurcea Date: Fri, 21 Sep 2018 20:28:03 +0300 Subject: [PATCH 1/2] use 7 significant numbers when calculating grid sizes for better accuracy --- packages/material-ui/src/Grid/Grid.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/material-ui/src/Grid/Grid.js b/packages/material-ui/src/Grid/Grid.js index e3b05a2c5d3859..2851ee9fd2b3cd 100644 --- a/packages/material-ui/src/Grid/Grid.js +++ b/packages/material-ui/src/Grid/Grid.js @@ -44,8 +44,7 @@ function generateGrid(globalStyles, theme, breakpoint) { return; } - // Only keep 6 significant numbers. - const width = `${Math.round((size / 12) * 10e6) / 10e4}%`; + const width = `${Math.round((size / 12) * 10e7) / 10e4}%`; // Close to the bootstrap implementation: // https://github.com/twbs/bootstrap/blob/8fccaa2439e97ec72a4b7dc42ccc1f649790adb0/scss/mixins/_grid.scss#L41 From cf4f7562c32c4de33e540055b2a50f06a5a63e2e Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Fri, 21 Sep 2018 20:38:27 +0200 Subject: [PATCH 2/2] Add comment back --- packages/material-ui/src/Grid/Grid.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/material-ui/src/Grid/Grid.js b/packages/material-ui/src/Grid/Grid.js index 2851ee9fd2b3cd..2915529d2db903 100644 --- a/packages/material-ui/src/Grid/Grid.js +++ b/packages/material-ui/src/Grid/Grid.js @@ -44,7 +44,8 @@ function generateGrid(globalStyles, theme, breakpoint) { return; } - const width = `${Math.round((size / 12) * 10e7) / 10e4}%`; + // Keep 7 significant numbers. + const width = `${Math.round((size / 12) * 10e7) / 10e5}%`; // Close to the bootstrap implementation: // https://github.com/twbs/bootstrap/blob/8fccaa2439e97ec72a4b7dc42ccc1f649790adb0/scss/mixins/_grid.scss#L41