angular-gridster2 icon indicating copy to clipboard operation
angular-gridster2 copied to clipboard

Using VerticalFixed with setGridSize causes the grid to become wider on each update

Open jsarem opened this issue 3 years ago • 1 comments

Description

Using VerticalFixed scroll type while setGridSize is true causes the gridster component to become wider every time the grid is updated.

Reproduction

Open the Stackblitz example: https://stackblitz.com/edit/angular-ivy-qfentx

  1. Change the preview window size to non-mobile size
  2. Enable editing by clicking the button
  3. Resize or drag items
  4. The grid keeps getting wider each time

Possible solution

The GridsterComponent updates the curWidth variable each time the grid has changed, causing the grid margins to be added to the element width over and over again. Removing margins from following calculations seem to fix this problem. However this fix may cause regressions with other usages of the GridsterComponent.

https://github.com/tiberiuzuld/angular-gridster2/blob/a50fdd469db7d31d49095add779c2b0d2f8fa390/projects/angular-gridster2/src/lib/gridster.component.ts#L398-L401

https://github.com/tiberiuzuld/angular-gridster2/blob/a50fdd469db7d31d49095add779c2b0d2f8fa390/projects/angular-gridster2/src/lib/gridster.component.ts#L412-L420

jsarem avatar Nov 25 '22 10:11 jsarem

Sounds similar to https://github.com/tiberiuzuld/angular-gridster2/issues/371?

rsporsche avatar Nov 06 '23 15:11 rsporsche