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

can't drag between 2 grids with max row set #1687

Closed
Justin99b opened this issue Mar 26, 2021 · 10 comments · Fixed by #1695 or #1708
Closed

can't drag between 2 grids with max row set #1687

Justin99b opened this issue Mar 26, 2021 · 10 comments · Fixed by #1695 or #1708
Labels

Comments

@Justin99b
Copy link

Justin99b commented Mar 26, 2021

Subject of the issue

Widgets collide and bug over each other when hovering over another grid

Your environment

Gridstack (the verison used on the official site) sorry dont know that one) (V4 if im not mistaken) <- 4.0.1
Chrome Version 89.0.4389.90 (64-Bit)

Steps to reproduce

https://gridstackjs.com/#demo
when moving the item from top to bottom (i hope thats eough to reproduce)

Expected behavior

Widget does not collide with others and just can correctly place back like in the previous v3 versions

Actual behavior

When dragging one widget to another grid and then back (without releasing it) the widget will come nearly impossible to place back in the old grid and even collid or stack on to another object.
Its also happening when just dragging it into another grid.
You can also see the collision happening here https://gridstackjs.com/demo/advance.html
p.s im sorry if im not giving enough information.
if you need anything more please comment

@adumesny
Copy link
Member

can you please provide a video because I'm not seeing your issue. you can also try using https://gridstackjs.com/demo/two.html or a modified version if you need 2 grids.

@Justin99b
Copy link
Author

Justin99b commented Mar 27, 2021

Actually i found out how to reproduce it

https://jsfiddle.net/rhq02fkL/29/
https://gyazo.com/de4abc0265c37760a7e8e8b71338b7ab

@adumesny adumesny changed the title Dragging widget to another grid makes it impossible to place two drop shadows when dragging between 2 vertical grids Mar 27, 2021
@adumesny
Copy link
Member

adumesny commented Mar 27, 2021

should not see two drop shadow when #393 was fixed....

Also see issues with your demo outside of this:

  1. you say 3 column but don't include extra.css so CSS layout is hosed when dragging around.
  2. you call addGrid() which creates nested .grid-stack divs (I have a local fix) as parent incorrectly has '.grid-stack' style (see you CSS doubling the border)
  3. resize handles are always showing. resizable:false is NOT an options - use disableResize:true instead (I can see why you made that mistake)

regardless I can see 2 drop shadows when doing vertical grids, so I will create demo for that so I can fix.

@Justin99b
Copy link
Author

Justin99b commented Mar 27, 2021

oh? Well im working on an inventory system with gridstack and use addGrid to dynamicly add grids. didnt know that this is the wrong way of doing it

@Justin99b
Copy link
Author

Justin99b commented Mar 27, 2021

Okay i've updated my example with your fixes named just to make sure its correct

https://jsfiddle.net/hfjr65qw/32/

Also its not only the drop shadow
here is a video of it happening in a different scenario. but you can recreate it with the link above

This example is even more broken than my version somehow lol

https://gyazo.com/3aa64bfd28f08147595a66440fff6a81
https://gyazo.com/a77811b3982037bf013b5653b2003a5a

@adumesny
Copy link
Member

adumesny commented Mar 28, 2021

Also its not only the drop shadow

I know, but that is the clue bad things will happen!

Update: actually the real issue with is with row:1 setting maxRow which goes through very different code path I had not tested

@adumesny adumesny changed the title two drop shadows when dragging between 2 vertical grids can't drag between 2 grids with max row set Mar 28, 2021
adumesny added a commit to adumesny/gridstack.js that referenced this issue Mar 28, 2021
* fix gridstack#1687
* broken in 4.x - dragging between 2 grids with maxRow/row set
* willItFit() could modify the passed in node (with new algorithm) instead of making a clone copy to check if it fits.
* added a new vertical grid demo (which has known issues documented)
* added unit test
@adumesny
Copy link
Member

fixed in next release. don't forget to donate if you find lib useful!

@Justin99b
Copy link
Author

If my projects works out and dont forget it i will donate you something 😄

I checked out the master after you pushed. It seem to work way better than before

Im still having problems with the shadow tho. i have a 1x1 field to drop an item into.
besides the fact that 1x1 fields dont work at all in v3 and in v4 with your fix it works somewhat

Sometimes the drop shadows still wont dissapear. I will test this further and make sure to make a demo for you

Do you mean 4.0.3 or master when you say release?

@adumesny
Copy link
Member

4.0.3

@adumesny
Copy link
Member

adumesny commented Mar 29, 2021

a change in 4.0.3 broke my example (like yours).... will have to revisit this. Lot more work than expected. Get that donation going...

@adumesny adumesny reopened this Mar 29, 2021
adumesny added a commit to adumesny/gridstack.js that referenced this issue Mar 29, 2021
* partial fix for gridstack#1687
last change to willItFit() broke this case. Working but still some issues...
adumesny added a commit to adumesny/gridstack.js that referenced this issue Apr 3, 2021
* fix gridstack#1687
* willItFit() will now save the location we can be added to, which is used upon inserting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants