react-rnd icon indicating copy to clipboard operation
react-rnd copied to clipboard

Using resizeGrid causes left resize to actually change size to the right

Open N1cc3 opened this issue 5 years ago • 4 comments

Overview of the problem

Using resizeGrid causes resizing left to actually resize to right.

Happens at 10.2.2 forwards. Does not happen at 10.2.1. Most probably caused by #727.

Reproduced project

https://codesandbox.io/s/rnd-resize-left-bug-e9vnr

Steps to Reproduce

  1. Use any horizontal resizeGrid
  2. Try resizing left side
  3. Rnd component will change size to right side while left will stay fixed.

Expected behavior

Resizing should happen at the side that's grabbed.

Actual behavior

Resizes to opposite side.

N1cc3 avatar Dec 10 '20 21:12 N1cc3

please add the settings dragAxis={'x'}, it works

samgu1219 avatar Jan 15 '21 09:01 samgu1219

That fixes it BUT also restricts dragging the element in y-axis. Which is not wanted.

N1cc3 avatar Jan 21 '21 07:01 N1cc3

I am experiencing the same problem except with the vertical resizeGrid. I want to resize my grid upwards but they get stretched down at the bottom. Here's a video example.

Using dragAxis="y" in my case did not resolve the issue.

https://user-images.githubusercontent.com/24761660/138121957-2faaf736-df9b-433f-a1dc-8f402f110bf6.mov

Here is my code:


    <Rnd
      className={classes.root}
      bounds="parent"
      minHeight={gridHeight}
      default={{
        x: left,
        y: top,
        height,
        width: gridWidth,
      }}
      resizeGrid={[0, gridHeight / 3]}
      dragGrid={[gridWidth, gridHeight / 3]}
      enableResizing={{
        top: true,
        bottom: true,
        topLeft: false,
        topRight: false,
        left: false,
        bottomLeft: false,
        right: false,
        bottomRight: false,
      }}>
      <div className={classes.card}>Appointment card</div>
    </Rnd>

FrenchMajesty avatar Oct 20 '21 15:10 FrenchMajesty

I'm seeing this same issue in 10.3.5, however I am setting the dragAxis={'x'} and the right side still scales out.

This happens when you set the resizeGrid={[1, 0]}

In other words if you set snap grid to 0 in the Y axis even if you have constrained it to the X axis is causes the Right side to example when you drag the left dragger.

JoshuaHintze avatar Nov 30 '21 04:11 JoshuaHintze