Fix the column calculation error #871
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
以下是来自官方的示例代码,当设置gridGap大于24时,拖动后宽度计算会出现异常,本次PR做了如下修复:
The following is the sample code from the official source. When the gridGap is set to be greater than 24, an exception occurs in the width calculation after dragging. This PR has made the following fixes:
// const v = Math.round(n / size);
const v = Math.round(n / (size + gridGap));
<Resizable style={style} grid={[100, 50]} gridGap={[3, 3]} defaultSize={{ width: 100, height: 50 }} maxWidth={306} maxHeight={156} enable={{ top: false, topRight: false, right: true, bottomRight: true, bottom: true, bottomLeft: false, left: false, topLeft: false, }} onResize={a => { console.log(a); }} > 001 </Resizable>