react-mops
react-mops copied to clipboard
Move with Handle
Is your feature request related to a problem? Please describe.
Instead of the entire Box being draggable, it would be nice if we could associate a moveHandle
or something to a specific component so that the rest of the box does not steal away pointer-events.
This is available in v2.
It will look something like this
const MyDraggable = ({initialPosition, children}) => {
const [{x, y}, {
onMouseDown,
onTouchStart,
...positionProps
}] = usePosition(initialPosition, {});
return (
<div style={{transform: `translate3d(${x}px, ${y}px, 0)`}}>
<div
className="drag-handle"
onMouseDown={onMouseDown}
onTouchStart={onTouchStart}/>
<div className="content">{children}</div>
</div>
}
@pixelass Do you know when you'd expect to release v2?
I'm targeting the end of this month. Things are looking good. There are minor things that need to be changed/added back in.
@pixelass I'm not trying to rush, only assist. Would it be useful for you to have me begin implementing v2
to see if I run into any issues/bugs/lacking documentation... etc?
If it would only interfere with your progress, then no worries, just didn't want to begin any migration to the next version if you felt like the API may change
The API will remain almost unchanged. I am currently struggling with minor features (e.g. aspect-ratio resizing) I also need to refactor the new snapping logic (currently working on that)
I will try to finish the snapping and then release a beta before I add aspect-ratio.I should be able to finish it within the next one or two days. I hope that helps.
Besides that I'm happy for any help offered. I am especially missing documentation and tests which should both be present before a stable v2 will be released. Feel free to open new issues to discuss this further.
@kyleknighted
https://www.npmjs.com/package/react-mops/v/2.0.0-beta.0