bokuweb / react-rnd

🖱 A resizable and draggable component for React.
https://bokuweb.github.io/react-rnd/stories
MIT License
3.89k stars 323 forks source link

Allow programable bounds property. #388

Open bokuweb opened 6 years ago

bokuweb commented 6 years ago

Allow programable bounds linke, bounds={ top: 0, left: 0, right: 100, bottom: 100}.

related #209

Overview of the problem

I'm using react-rnd version [x.x.x]

My browser is:

I am sure this issue is not a duplicate?

Reproduced project

https://codesandbox.io/s/y3997qply9

Description

Steps to Reproduce

  1. First Step
  2. Second Step
  3. and so on...

Expected behavior

Actual behavior

leontalbot commented 5 years ago

Personal need: e.g. bounds={ top: 10, left: 10, right: 10, bottom: 10}

  1. These coords are related to parent div
  2. component with x=0 and y=0 still means it would touch top left corner (no margin)
  3. but component can't be at 0,0 because of bounds, so it would be block at 10,10.

Is that what you have in mind too?

burtonator commented 4 years ago

This would be great. I'm trying to use bounds in an iframe and things don't seem to be working even if specifying a window and document object.