One pixel gap bug because Math.round when margin is zero · Issue #2141 · react-grid-layout/react-grid-layout · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thank you for creating this library.
While using it, I noticed that when the margin is set to 0, there is sometimes a 1-pixel gap between elements. I checked the code, and this is caused by using Math.round when calculating element sizes.
I think there are two possible solutions to fix this:
Adjust the final width/height when calculating element sizes based on the positions of adjacent elements. This requires first collecting information about which elements are adjacent to each other.
Move the logic for calculating element sizes and dimensions to the parent ReactGridLayout, as the size and position of each element are already determined when setting the layout on the state.
Changes in position and size during element dragging or resizing do not need to be considered; even if there is a 1-pixel gap, it is acceptable.
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
First of all, thank you for creating this library.
While using it, I noticed that when the margin is set to 0, there is sometimes a 1-pixel gap between elements. I checked the code, and this is caused by using Math.round when calculating element sizes.
I think there are two possible solutions to fix this:
Changes in position and size during element dragging or resizing do not need to be considered; even if there is a 1-pixel gap, it is acceptable.
Your Example Website or App
https://codesandbox.io/p/devbox/musing-fog-4xry6x?workspaceId=ws_UnDYrbNUVgpoqyCqFDXr7S
Steps to Reproduce the Bug or Issue
[0, 0]
Expected behavior
Expected when the margin is set to 0, there should be no 1 pixel spacing between elements.
react-grid-layout library version
1.5.1
Operating System Version
macOS
Browser
Chrome
Additional context
No response
Screenshots or Videos
The text was updated successfully, but these errors were encountered: