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

load() allows overlapping widgets #2492

Closed
cca-developer opened this issue Oct 3, 2023 · 3 comments · Fixed by #2501, #2502, #2505 or #2861
Closed

load() allows overlapping widgets #2492

cca-developer opened this issue Oct 3, 2023 · 3 comments · Fixed by #2501, #2502, #2505 or #2861
Labels

Comments

@cca-developer
Copy link

Widgets should not be allowed to overlap

When calling load after items have been put in place, it will allow widgets to overlap each other.

Your environment

  • gridstack 9.2.1
  • Chrome/Windows

Steps to reproduce

https://jsfiddle.net/xc7540dt/2/
This differs from the baseline fiddle only in that it calls grid.load(items) at the end. But if you drag the widgets labeled 0 or 1, you can see that there is a duplicate behind them.

Expected behavior

The expectation is that widgets should never overlap each other.

@adumesny
Copy link
Member

adumesny commented Oct 3, 2023

an easy fix for this example is to make sure widgets have id, but when loading a new layout it shouldn't overlap anyway.

@adumesny adumesny changed the title Running load allows overlapping widgets load() allows overlapping widgets Oct 11, 2023
adumesny added a commit to adumesny/gridstack.js that referenced this issue Oct 14, 2023
* fix gridstack#2492
* make sure we use existing items and not reset to start from scratch so we do collision at each step.
adumesny added a commit to adumesny/gridstack.js that referenced this issue Oct 14, 2023
* more fix gridstack#2492
* load() now calls doContentResize() at the end.
* also fixed update() same content bug returning pre-maturely.
adumesny added a commit to adumesny/gridstack.js that referenced this issue Oct 15, 2023
* more fix gridstack#2492
* back to clearing the list when doing load() to make sure we insert like if it was new, but make sure we force a collision check
@adumesny adumesny mentioned this issue Oct 15, 2023
3 tasks
@adumesny
Copy link
Member

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

@adumesny
Copy link
Member

this broke in v10.3.0 as part of this change. will need to fix it again and add it to the test suite...

SHA-1: ec3c7e4

  • load() now creates in order

  • changed code to create widgets in sorted order instead of reverse order (fixed collision code to handle that case to push down items during collision)

  • updated two.html to force collision loading to test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment