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

Added onResize callback #1

Closed
wants to merge 10 commits into from
Closed

Conversation

kuuup-at-work
Copy link

Hi.

I need to update some stuff while resizing. With these changes you can add a callback do SplitterLayout. It will be called constantly while you are dragging the splitter (so maybe debouncing is needed here).

Have fun 😃

@coveralls
Copy link

coveralls commented Apr 26, 2017

Coverage Status

Coverage increased (+6.6%) to 89.381% when pulling a8b5c7e on kuuup-at-work:master into 9792db5 on zesik:master.

@zesik
Copy link
Owner

zesik commented May 14, 2017

Hi,

Thanks for contributing!

I tested the code and found one problem: when dragging the splitter and mouse moves out of the containing area (browser window, for instance), splitter stops responding.

In addition, I'm thinking that the onResize could be an optional prop and could provide some event data in callback such as current position, etc. How does this sound to you?

Could you push a fix? I'm happy to include this new feature.

@kuuup-at-work
Copy link
Author

Hi,

I think the problem occurred because I moved mouseup and mousemove listeners to the container. It was my attempt to make this testable with TestUtils.Simulate. Do you have an idea how to implement a test when the listeners are bound to document? I'd dislike removing this test.

Providing current size or position as event data is a good idea and should be easy to implement.

@zesik
Copy link
Owner

zesik commented May 21, 2017

Hi,

Any luck on this yet? After some digging, I think some extra efforts might be needed to test document events.

References:
facebook/react#5043
jsdom/jsdom#1634
enzymejs/enzyme#426
http://stackoverflow.com/a/37925065

@kuuup-at-work
Copy link
Author

Hi.

Maybe it's a good idea to rename getSecondaryPaneSize to getPanelSize and return an object containing both values. Then it would be easy to provide the primary panel size as event data for onResize.

@coveralls
Copy link

coveralls commented May 22, 2017

Coverage Status

Coverage increased (+6.1%) to 88.889% when pulling dcaccbc on kuuup-at-work:master into 9792db5 on zesik:master.

@zesik
Copy link
Owner

zesik commented Jun 11, 2017

Hi.

Is there any update on this?

@kuuup
Copy link

kuuup commented Jun 11, 2017

Hi. I've updated the PR a few days ago.

@zesik
Copy link
Owner

zesik commented Jun 13, 2017

Hi,

I tested the newest commit. It seems the dragging problem is not fixed?

@kuuup-at-work
Copy link
Author

Which browser are you using? Tried Chrome and Firefox and can't reproduce the problem.

@zesik
Copy link
Owner

zesik commented Jun 13, 2017

Tried on Chrome. Splitter stops responding as soon as the cursor moves out of the browser window.

@kuuup-at-work
Copy link
Author

Tested on Windows now and the splitter doesn't move when you're outside of the window but it continues when you move back in. If I move the listener back to document it's hard to write a test.

For me it's not a deal breaker but we can close this PR if you're unhappy with this.

@zesik
Copy link
Owner

zesik commented Jun 13, 2017

Same behavior here. Sorry, but this is a blocker for me.

I'll leave this PR open here for now, in case you get the chance to look into this.

I posted several links a couple of days ago here, and some of them might be related to testing listeners of document. Hope it would be useful.

@Tsourdox
Copy link

This feature would have been amazing, any plans on fixing the issues?

@zesik
Copy link
Owner

zesik commented Oct 5, 2017

Closing this as newest release adds this event and has better coverage test.

@zesik zesik closed this Oct 5, 2017
@kuuup-at-work
Copy link
Author

Works! Thx!

zesik pushed a commit that referenced this pull request Feb 10, 2019
prevent unnecessary re-rendering on mouse up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants