Skip to content
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

Merged
merged 11 commits into from
May 16, 2018

Conversation

walerun
Copy link

@walerun walerun commented Apr 29, 2018

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.

@walerun
Copy link
Author

walerun commented Apr 30, 2018

Fixing tests

@walerun walerun mentioned this pull request Apr 30, 2018
@coveralls
Copy link

coveralls commented May 1, 2018

Coverage Status

Coverage increased (+2.0%) to 93.464% when pulling ae2eb7f on walerun:persist-size-units-after-resizing into daa88ca on tomkp:v2.

.dragResizer(0, {y: 300})
.assertSizes([600, 0])
.assertRatios([100, 0])
.assertSizes(['60000', '0'])
Copy link
Owner

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 ?

Copy link
Author

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.

asserter(jsx, {height: 403})
.assertRatios([25, 25, 25, 25])
.assertSizes([100, 100, 100, 100])
asserter(jsx, {height: 400})
Copy link
Owner

@tomkp tomkp May 3, 2018

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.

Copy link
Author

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.

@tomkp tomkp added the v2 label May 3, 2018
@tomkp
Copy link
Owner

tomkp commented May 3, 2018

Hi - thanks for the great work - I really appreciate the help!

@walerun
Copy link
Author

walerun commented May 13, 2018

I've updated PR. @tomkp Can you take a look?

@tomkp
Copy link
Owner

tomkp commented May 13, 2018

Looks really good so far! I'll dig a little deeper asap...
Thanks!

@tomkp tomkp merged commit 46fd033 into tomkp:v2 May 16, 2018
@tomkp
Copy link
Owner

tomkp commented May 16, 2018

Thanks!!

@walerun
Copy link
Author

walerun commented May 16, 2018

Thanks, @tomkp! I'm going to continue contribution according to the roadmap. Could you also publish it to npm?

@tomkp
Copy link
Owner

tomkp commented May 17, 2018

Published - version:2.0.2 / tag:next
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants