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 · 2 comments · Fixed by #2501, #2502 or #2505
Closed

load() allows overlapping widgets #2492

cca-developer opened this issue Oct 3, 2023 · 2 comments · Fixed by #2501, #2502 or #2505
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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants