Skip to content

feat: Vertical and horizontal resize handles supported #76

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

Conversation

RaoHai
Copy link

@RaoHai RaoHai commented Sep 11, 2017

  • close PR: horizontal and vertical resize handler supported #75
  • For more friendly interactions, offer horizontal and vertical resize handlers.
  • Add a props resizer to restricts resize handles
    • Default to both, show right-bottom resize handle.
    • x: only show right resize handle.
    • y: only show bottom resize handle.
    • all: show all (right, bottom, and bottom-right corner) resize handlers.
    • none: never show resize handle.
  • ResizeCallbackData add an extra param axis, shows which direction that user now resize in.
  •    <ResizableBox onResize={(event, { element, size, axis}) => {...}} />

screen shot 2017-09-11 at 9 53 18 am

@abenhamdine
Copy link

This should be soooo useful. @STRML any chance you can look at this ?

@nreese
Copy link

nreese commented May 31, 2018

@STRML Are you still maintaining this project? I would like to create a similar PR that adds handlers to all 4 corners but am a little nervous that the effort would be wasted since this PR never got merged or a response.

@STRML
Copy link
Collaborator

STRML commented Jan 7, 2019

This is a nice PR, unfortunately I missed it. I would accept an update @nreese - otherwise, @RaoHai , I would accept this PR if it did not update the version number, added a test, and an example.

@RaoHai RaoHai force-pushed the feat-vertical-and-horizontal-resize-handle branch from 143c216 to 449c0dc Compare January 8, 2019 01:45
@RaoHai
Copy link
Author

RaoHai commented Jan 8, 2019

@STRML Thanks. I've rebase my PR to master, but actually it have no independent example or test, because all origin examples will have this feature by default.

Should I add an extra props like resizer to restricts the visibility of resize handlers ?

@STRML
Copy link
Collaborator

STRML commented Jan 8, 2019

Yes that would be good, as this would otherwise be a change for all users. We want this to be opt-in not opt-out as not to cause breakage.

+ feat: support horizontal resize handles
+ feat: add `resizer` props to show resizer handlers
@RaoHai RaoHai force-pushed the feat-vertical-and-horizontal-resize-handle branch from 449c0dc to 48556a2 Compare January 10, 2019 05:41
@RaoHai
Copy link
Author

RaoHai commented Jan 10, 2019

I've add an extra prop resizers to restricts resize handles and some examples https://github.com/STRML/react-resizable/pull/76/files#diff-bfdc1995d9b6914d3bd61585d9d4dea9

  • Default to both, show right-bottom resize handle.
  • x: only show right resize handle.
  • y: only show bottom resize handle.
  • all: show all (right, bottom, and bottom-right corner) resize handlers.
  • none: never show resize handle.

@RoccoC
Copy link
Contributor

RoccoC commented Jan 11, 2019

This is great! However, I am wondering if it would make more sense for the resizer prop type to be more specific and granular, e.g.:

  • r show right resize handle.
  • b: show bottom resize handle.
  • br: show bottom-right resize handle.

This would be a bit more future-proof and would allow extending to support handles on the top and left sides, e.g.:

  • l: show left resize handle.
  • t: show top resize handle.
  • tl: show top-left-right resize handle.
  • bl: show bottom-left resize handle.
  • tr: show to-right resize handle.

In this case the resizer prop could accept an array to allow any combination of handles:

// show right, bottom, and bottom-right handles
<Resizable resizer={['r', 'b', 'br']} />

// show bottom-right handle only (default)
<Resizable resizer={['br']} />

// show handles on each corner
<Resizable resizer={['tl', 'tr', 'bl', 'br']} />

The support for other handles may be out of scope for this PR (I'd be happy to pick this up once this get merged), but updating the resizer prop per above would make this a logical and simple change to implement. :)

Thoughts?

@STRML
Copy link
Collaborator

STRML commented Jan 11, 2019 via email

@RoccoC
Copy link
Contributor

RoccoC commented Jan 11, 2019

Just did a quick search and found re-resizable, which follows a similar pattern:

export type Direction = 'top' | 'right' | 'bottom' | 'left' | 'topRight' | 'bottomRight' | 'bottomLeft' | 'topLeft';

react-resizable-component supports this as well, but uses cardinal directions (s, w, e, n, sw, nw, se, ne).

@RaoHai
Copy link
Author

RaoHai commented Jan 11, 2019

I prefer (s, w, e, n, sw, nw, se, ne)...

@RoccoC
Copy link
Contributor

RoccoC commented Jan 14, 2019

I prefer (s, w, e, n, sw, nw, se, ne)...

Works for me! Will you be updating your PR, or shall I submit one?

@abenhamdine
Copy link

@RaoHai any chance you could go forward with this PR ? There are conflicts.

@RoccoC
Copy link
Contributor

RoccoC commented May 7, 2019

@RaoHai , I hope you don't mind, but I took the liberty of raising a new PR with these changes: #101

This PR includes support for handles in each corner/side as we discussed earlier in this thread. :)

@RaoHai
Copy link
Author

RaoHai commented May 7, 2019

thanks @RoccoC

@RaoHai
Copy link
Author

RaoHai commented May 7, 2019

see #101

@RaoHai RaoHai closed this May 7, 2019
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.

PR: horizontal and vertical resize handler supported
5 participants