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
Conversation
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? |
Still no news. I had to fork the repo and use my version. |
@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(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Added two optionals fields (offsetX and offsetY) to createDragPreview options.
Those fields allow to force specific offsets values.
Linked to #775