-
Notifications
You must be signed in to change notification settings - Fork 715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: New Component - Resizable #2458
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 7a0a757:
|
…vent unexpected rendering caused by context value updates
…into feat/resize_
|
||
// 判断是否超出限制 | ||
let lastFlag = judgeConstraint(lastNewSize, this._adapter.getItemMin(curHandler), this._adapter.getItemMax(curHandler), availableSize, lastOffset), | ||
nextFlag = judgeConstraint(nextNewSize, this._adapter.getItemMin(curHandler + 1), this._adapter.getItemMax(curHandler + 1), availableSize, nextOffset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看起来 resizeItem 中的 box-sizing 的设置是 border-box,那么此处还需要149,150行的 lastOffset 和 nextOffset 用于计算吗?同理 153,158行的计算
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是为了获取border和padding导致的对最大最小尺寸的误差,例如一个div border为1px,拖拽中计算会导致尺寸计算为0,设置width为0后border仍保留,因此实际width为2px;我引入这个offset就是计算了border和padding的在拖拽方向上的宽度,让宽度保证处于[min + offset, max]中消除最小时候的误差
cursor: 'nw-resize', | ||
}, | ||
} as const; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
上面的 css 放在 scss 文件中。 然后这个文件命名换成 types?
left: '0', | ||
bottom: '0', | ||
right: '0', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
其他没有改变的样式,直接放在 scss 中
semi-design Run #2870
Run Properties:
|
Project |
semi-design
|
Run status |
Passed #2870
|
Run duration | 07m 46s |
Commit |
e17825ed06: feat: New Component - Resizable (#2458)
|
Committer | Nathon2Y |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
0
|
Pending |
11
|
Skipped |
0
|
Passing |
264
|
Upgrade your plan to view test results. |
中文模板 / Chinese Template
What kind of change does this PR introduce? (check at least one)
PR description
Fixes #
Changelog
🇨🇳 Chinese
🇺🇸 English
Checklist
Other
Additional information