pixelass / react-mops

🐶 Modify Orientation Position Size
https://react-mops.netlify.com/
MIT License
44 stars 7 forks source link

Support Orientation/Position/Size props change #11

Open ustccjw opened 5 years ago

ustccjw commented 5 years ago

make react-mops to be a control component

pawelkosmicki commented 4 years ago

Yeah, it would be great to have it, because there is no callbacks at the moment, such as: onDragStart, onDragStop, onResizeStart, onResizeStop.

pixelass commented 4 years ago

@ustccjw can you better explain what you expect? (codesample)

@pawelkosmicki There are callbacks for all of them here's an example: https://github.com/dekk-app/react-mops/blob/master/packages/demo/src/pages/home.tsx#L235-L243 where I use it in combination with redux.

onResizeStart, onResize, onResizeEnd
onDragStart, onDrag, onDragEnd
onRotateStart, onRotate, onRotateEnd

I am currently working on v2. It will include a documentation with better examples.

ustccjw commented 4 years ago

@pixelass when Orientation/Position/Size has been changed by props,component will change the Orientation/Position/Size state - this is my need.

pixelass commented 4 years ago

Right now those props only serve as initialStates. In v2 you can build your own custom box to add this feature.

v2 will most probably deliver several dedicated components with different behavior, so once implemented this could be added by a PR as new export.

I see how this can be helpful and it will definitely be added since I myself need this feature eventually.