-
Notifications
You must be signed in to change notification settings - Fork 408
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
Persist size units after resizing #264
Conversation
Fixing tests |
test/default-split-pane-tests.js
Outdated
.dragResizer(0, {y: 300}) | ||
.assertSizes([600, 0]) | ||
.assertRatios([100, 0]) | ||
.assertSizes(['60000', '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.
should this be 600
not 60000
?
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.
Yes, it might be. I just multiply it by 100 to avoid float number. But I'm not sure that it somehow affects performance.
As I need to persist size units after resizing I convert the sizes from px to initial units. Px to px is clear, px to % - just calculates % of SplitPane container. For ratio just converts all sizes in ratio to px and multiply by 100.
test/default-split-pane-tests.js
Outdated
asserter(jsx, {height: 403}) | ||
.assertRatios([25, 25, 25, 25]) | ||
.assertSizes([100, 100, 100, 100]) | ||
asserter(jsx, {height: 400}) |
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.
How wide is the resizer you are using? I use values such as 403
as the width to accomodate 3 Resizers of 1 px each, and 4 panes of 100px.
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.
Resizer size is 11px, but it has a negative margin of right and left. I've changed it from 5px to -5.5px. So actually resizer does not affect the size of the splitPane container as it overflows part of the pane (in this case by 5.5px) which is not the best solution and I working on it now. The Desirable behavior is if I have an initial size of pane 100px it should be 100px if I have 50% size it should take a percentage of SplitPane container except for resizers.
Hi - thanks for the great work - I really appreciate the help! |
I've updated PR. @tomkp Can you take a look? |
Looks really good so far! I'll dig a little deeper asap... |
Thanks!! |
Thanks, @tomkp! I'm going to continue contribution according to the roadmap. Could you also publish it to npm? |
Published - version:2.0.2 / tag:next |
This PR allows the user to set initial size in px / % / ratio (by default 1). When you resize the window or pane size units persist their initial value, so px stays px, % stays %, ratio stays ratio.