Skip to content

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

Closed

Description

@Voodu

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.

Activity

  1. adumesny commented on Sep 19, 2022

    @adumesny
    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.

  2. PPP01 commented on Sep 20, 2022

    @PPP01

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

  3. adumesny commented on Sep 20, 2022

    @adumesny
    Member

    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.

  4. adumesny commented on Sep 23, 2022

    @adumesny
    Member

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

  5. added a commit that references this issue on Oct 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions