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

Resizing from top or left border disabled by default #37

Closed
dduugg opened this issue Jun 26, 2014 · 9 comments · Fixed by #145
Closed

Resizing from top or left border disabled by default #37

dduugg opened this issue Jun 26, 2014 · 9 comments · Fixed by #145

Comments

@dduugg
Copy link

dduugg commented Jun 26, 2014

It seems resizing an element is only enabled by default along the bottom and right borders. In other words, if the dotted lines in this image were element boundaries, the resize handles marked "X" would not work at all, and those marked "/" would only work along one dimension:

image

Is this behavior intentional, or am I doing something wrong? If the former, would you be amenable to a PR to enable resizing along all four borders?

@taye
Copy link
Owner

taye commented Jun 26, 2014

It is intentional and I don't think it would be a good idea to change it soon. The resize axis option string would need to be changed to something like a directions object with left, right, up and down and the resize event properties would need to be changed as well. I plan on changing it in the not-so-distant future but would like to add some other features before changing the API.

If you will have elements which are resize handles, you can make them draggable and resize the item that they surround in response to the drag events.

@gdcesare
Copy link

Hi taye! Could you give an example of what you said, a resizable item in response to the drag events of one of the item's handles. I couldn't get it… Thanks!

@taye
Copy link
Owner

taye commented Nov 19, 2014

Here's one I made in a hurry about a month ago: http://plnkr.co/edit/F9eey5rK2yDkBNuWq7TT?p=info

Most of the relevant code is in the slider.js file

A custom Resize handle box is needed as interact.js does not provide one.
Each handle is draggable and dragging updates the current resize parameters
in the application.

Here, window.Resize is exposed with methods to allow response to resizing and
to position the resize handles.

Resize has the following methods:

  • set (dimensions) : Takes a dimensions object with x, y, width, height.
    This will be the new position and size of the box.
  • draw () : Redraw the resize box.
  • hide () : hide the resize box
  • show () : show the resize box
  • addListener (listener) : Takes a function to call when a resize happens.
    The function recieves a drag event and the new
    dimensions as arguments -
    function (event, dimensions) { ... }
  • removeLisener (listener) : Removes a previously added listener

@gdcesare
Copy link

Than you!!! I will try!

@lewisdiamond
Copy link

+1 for this feature. In the meantime I'll implement it with multiple draggable nodes.

@diegope
Copy link

diegope commented Jan 13, 2015

+1 for this as well!

@jacquescrocker
Copy link

+1, this blocked me from using interact.js (had to switch to jquery ui). My app requires a sidebar on the right side of the page. Resizing would only work from the left edge.

@taye
Copy link
Owner

taye commented Jan 21, 2015

As noted above the previous two comments, four-direction resizing is being implemented in PR #145. You can try it out now; I don't think the API will change much before it's ready to be merged. I'd appreciate any feedback.

@jacquescrocker
Copy link

will do, thanks @taye!

@taye taye closed this as completed in #145 Feb 27, 2015
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 a pull request may close this issue.

6 participants