Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass offsetX and offsetY as createDragPreview options to force offsets #776

Merged
merged 6 commits into from Jun 13, 2017

Conversation

pschupp01
Copy link
Contributor

@pschupp01 pschupp01 commented May 22, 2017

Added two optionals fields (offsetX and offsetY) to createDragPreview options.
Those fields allow to force specific offsets values.

Linked to #775

@bjrmatos
Copy link

any news on this? this looks very useful and i'm currently needing this, is there anything that i can do to help to land this feature?

@pschupp01
Copy link
Contributor Author

Still no news. I had to fork the repo and use my version.

@pschupp01
Copy link
Contributor Author

@darthtrevino Maybe this PR can be merge?

@@ -314,15 +314,21 @@ export default class HTML5Backend {
const sourceId = this.monitor.getSourceId();
const sourceNode = this.sourceNodes[sourceId];
const dragPreview = this.sourcePreviewNodes[sourceId] || sourceNode;
const { anchorX, anchorY } = this.getCurrentSourcePreviewNodeOptions();
const { anchorX, anchorY, offsetX, offsetY } = this.getCurrentSourcePreviewNodeOptions();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should pass in the the offsetX and offsetY as an additional argument to getDragPreviewOffset
(offsetPoint) instead of doing the computation here.

Copy link
Contributor Author

@pschupp01 pschupp01 Jun 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i did the changes, offsets are now pass as an additional argument to getDragPreviewOffset.

I choosed to not optimize the method and even if offsets are forced the function still calculate the interpolated offsets.

I didn't want to take any risk to break this part.

@darthtrevino darthtrevino merged commit d1f078b into react-dnd:master Jun 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants