pixelass / react-mops

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

Move with Handle #10

Open kyleknighted opened 5 years ago

kyleknighted commented 5 years ago

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.

pixelass commented 5 years ago

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>
}
kyleknighted commented 5 years ago

@pixelass Do you know when you'd expect to release v2?

pixelass commented 5 years ago

I'm targeting the end of this month. Things are looking good. There are minor things that need to be changed/added back in.

kyleknighted commented 4 years ago

@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

pixelass commented 4 years ago

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.

pixelass commented 4 years ago

@kyleknighted

https://www.npmjs.com/package/react-mops/v/2.0.0-beta.0