Skip to content
This repository was archived by the owner on Jun 18, 2018. It is now read-only.

Commit 21e2f6f

Browse files
committed
Adding anchorOffset as a configuration for the drag preview
1 parent 69e872a commit 21e2f6f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/HTML5Backend.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,20 @@ export default class HTML5Backend {
285285
const sourceId = this.monitor.getSourceId();
286286
const sourceNode = this.sourceNodes[sourceId];
287287
const dragPreview = this.sourcePreviewNodes[sourceId] || sourceNode;
288-
const { anchorX, anchorY } = this.getCurrentSourcePreviewNodeOptions();
288+
const { anchorX, anchorY, anchorOffsetX, anchorOffsetY } = this.getCurrentSourcePreviewNodeOptions();
289289
const anchorPoint = { anchorX, anchorY };
290290
const dragPreviewOffset = getDragPreviewOffset(
291291
sourceNode,
292292
dragPreview,
293293
clientOffset,
294294
anchorPoint
295295
);
296-
dataTransfer.setDragImage(dragPreview, dragPreviewOffset.x, dragPreviewOffset.y);
296+
297+
// We needed to control the offset for the preview since we resize the clip
298+
dataTransfer.setDragImage(dragPreview,
299+
anchorOffsetX === undefined ? dragPreviewOffset.x : anchorOffsetX,
300+
anchorOffsetY === undefined ? dragPreviewOffset.y : anchorOffsetY);
301+
//this is the inlye
297302
}
298303

299304
try {

0 commit comments

Comments
 (0)