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

Max-width does not work as intended with resizable handle "w" #1330

Closed
JanStorm opened this issue Aug 13, 2020 · 4 comments · Fixed by #1521
Closed

Max-width does not work as intended with resizable handle "w" #1330

JanStorm opened this issue Aug 13, 2020 · 4 comments · Fixed by #1521
Labels

Comments

@JanStorm
Copy link

JanStorm commented Aug 13, 2020

Subject of the issue

When using option resizable.handles 'sw', 'w' or 'nw' in combination with max-width, the widget can be dragged on x-axis instead of resizing, after we tried to make it further than the max-width property.

Your environment

  • Gridstack Version 1.2.0
  • Chrome Browser Version 85.0.4183.59

Steps to reproduce

  • Add the following option to you GridStack.init method:
resizable: {
    handles: 'sw'
}
  • Then add a max-width property to the widget you want to test
  • Now, when trying to resize the widget to the left, making it bigger than the max-width, it will move (with placeholder below) until the grid ends, and then only the draggable floats free outside the grid, movable on the x-axis

JSFiddle

When using this fiddle, just resize to the left.
The Widget with the number 2 is an example without maxwidth, so it work as intended ;)
https://jsfiddle.net/c5z2ywtn/4/

Expected behaviour

It should stop resizing at max width, like when using the default handle on the bottom right corner. And not even move, when trying to make bigger as max-width

Actual behaviour

it will move (with placeholder below) instead of resize (when being larger than the max-width), until the grid ends, and then only the draggable floats freely outside the grid, movable on the x-axis

@JanStorm JanStorm changed the title Max-width does not work as intended with resizable handle "sw" Max-width does not work as intended with resizable handle "w" Aug 13, 2020
@JanStorm
Copy link
Author

Edited because of course this applies to all handles which goes to the left: 'sw', 'w' or 'nw'

@adumesny
Copy link
Member

yep, thanks for the test case.

@adumesny
Copy link
Member

adumesny commented Dec 5, 2020

Note to test in float.html, just change to this

let grid = GridStack.init({float: true, resizable: { handles: 'sw' }});
...
{x: 3, y: 1, maxW: 2},

adumesny added a commit to adumesny/gridstack.js that referenced this issue Dec 6, 2020
fix gridstack#1330

* we now set maxWidth/maxHeight to prevent grid item from resizing past
their size
* fixed code to prevent item from moving left when they reach max width
* added sample test case
@adumesny
Copy link
Member

adumesny commented Dec 6, 2020

fix in upcoming 3.1.1

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 a pull request may close this issue.

2 participants