question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resizer bar not auto adapt to window size if user manual changed the splitter

See original GitHub issue

Set splitter as below: <SplitPane defaultSize="50%" split="vertical"> <div>a</div> <div>b</div> </SplitPane>

At page load, the splitter will stay at the center of the window. If you change the window size, you can see the splitter is always keep in the center of the window.

Then, if you manual change the splitter, e.g., move a little to left/right, then change the window size, you will see the splitter just stay at the fixed location where it is, not auto adapt to the correct percentage location as above.

Open the image to see detail

Is that a bug? How to keep the splitter in percentage location with window size change?

Thanks.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
yuxincscommented, Jun 18, 2019

@chris-torrence, I was hacking the source code of react-split-pane more than a year ago, so it may not apply for the code today.

The idea is to calculate a parentSize of SplitPane around this line and try to pass it into Pane class, then in Pane class (these lines) set the width and height to a percent-based string. Something like (not tested on today’s code)

if (size !== undefined) {
        if (split === 'vertical') {
          style.width = typeof size === 'string' && size.endsWith('%') ? size : size / parentSize * 100 + '%';
        } else {
          style.height = typeof size === 'string' && size.endsWith('%') ? size : size / parentSize * 100 + '%';
          style.display = 'flex';
        }
        style.flex = 'none';
      }

Hope this helps.

0reactions
chris-torrencecommented, Jun 18, 2019

hey @yxwangcs thanks for the code - I’ll give it a try!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Websplitter panes 50-50 after resize | Infragistics Forums
Hi,. is it possible to resize the the splitter panes so that the size of each is 50%. Or - with other word...
Read more >
How to: Define Resize and Positioning Behavior in a Split ...
Learn how to define resize and positioning behavior in a split window with the SplitterIncrement and other properties.
Read more >
Now Component Library | ServiceNow Developers
A user can click the divider and drag their mouse to the right or left and adjust the width of the resizable panes....
Read more >
Move and resize windows in Logic Pro - Apple Support
You can move and resize open windows individually, even across multiple monitors. You can also change the size of all window elements that...
Read more >
How to resize ASPxGridview in SplitterPane dynamically
and the vertical scroll bar length to something longer like 250. If I ... So user will not be able to scroll to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found