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

Dynamically adding components and jumping issue

Open leifriksheim opened this issue 3 years ago • 2 comments
trafficstars

Hi!

I'm creating a visual coding environment and need to create draggable div's on-demand. There seems to be an issue where if I add components they get added side by side even if I explicitly set the position to for example {x: 0, y: 0}. The expected behavior is that the divs will be added exactly on the point that I have defined. This same problem happens when I remove a div, the other boxes jump around the screen as if they remember which position they were added in.

Any way to disable this behavior?

example

leifriksheim avatar Apr 28 '22 14:04 leifriksheim

Related to #650

leifriksheim avatar Apr 28 '22 15:04 leifriksheim

The trick that worked for me is applying css position: 'relative' to the parent element (the one containing the draggables) and adding css position: 'absolute' to the draggable's css class "handle". Then the elements are positioned exactly where you define the initialPosition and they overlap if needed.

miestr avatar May 19 '22 07:05 miestr