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

Jittering when swapping elements with the same width/height #2043

Closed
Voodu opened this issue Sep 19, 2022 · 4 comments · Fixed by #2046
Closed

Jittering when swapping elements with the same width/height #2043

Voodu opened this issue Sep 19, 2022 · 4 comments · Fixed by #2046

Comments

@Voodu
Copy link

Voodu commented Sep 19, 2022

Subject of the issue

When there are two elements with the same height placed next to each other (horizontally) and I want to swap them (i.e. drag one over the another so they switch places), there's visible jittering of both of them.

The same happens for same width and swapping elements placed vertically.

Your environment

  • version of gridstack.js: 6.0.1
  • which browser/OS: tested on Chrome and Firefox, Ubuntu 20.04

Steps to reproduce

You MUST provide a working demo (keep it simple!) you can use
https://jsfiddle.net/ogm3L8q1/1/

Expected behavior

The swap should happen smoothly

Actual behavior

Both elements jitter. The slower the movement/the bigger the elements, the more visible it is.

@adumesny
Copy link
Member

that's so bizzar as it works locally... and not supposed to swap until you hit 50% (with margin) preventing possible back-and-forth.

need to investigate. thanks.

@PPP01
Copy link

PPP01 commented Sep 20, 2022

I had this behavior as well - with v5 and v6.
It happens, when you add the "row" parameter. Without, everything works smooth.

@adumesny
Copy link
Member

adumesny commented Sep 20, 2022

oh, that's great info @PPP01 thank you. I had not seen it before...

Update: it also only happens row=N and larger shapes (3x3) as 1x1 I often test work fine. looks like the shape are switch before they reach mid point.

@adumesny
Copy link
Member

fixed in 6.0.2 - don't forget to donate if you find this lib useful!

adumesny added a commit to adumesny/gridstack.js that referenced this issue Oct 8, 2022
* fix bug introduced when fixing gridstack#2043 (checking for 50% coverage before swap)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants