react-grid-layout icon indicating copy to clipboard operation
react-grid-layout copied to clipboard

Resize neighbors instead of pushing them

Open NicoLaval opened this issue 1 year ago • 0 comments

Describe the bug

Hi,

Default behavior when resizing a box is to push neighbors.

If I have a 12 columns grid with:

  • A: x:0, y:0, h:10, w:6
  • B: x:0, y:6, h:10, w:6

When I increase A width by 2, B will be push below.

Your Example Website or App

https://nicolaval.github.io/react-grid-layout-sample/

Steps to Reproduce the Bug or Issue

Move vertical bar between A and B boxes in the "1 - " example.

(see deployed app here)

Expected behavior

I would like to obtain:

  • A: x:0, y:0, h:10, w:8
  • B: x:0, y:8, h:10, w:4 Or anything where wA + wB = 12

I think a way to do it is to handle the case in onResize or in onResizeStop. But if I have a lot of boxes, I'm not sure about performance (and code maintainability).

Any clean way to achieve this?

react-grid-layout library version

1.4.2

Operating System Version

Windows

Browser

Chrome

Additional context

No response

Screenshots or Videos

No response

NicoLaval avatar Oct 26 '23 07:10 NicoLaval