From b074e0eff35ac8b1b34efa902681aa19ba2b8629 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Mon, 22 Oct 2018 07:26:37 -0700 Subject: [PATCH] Fix how we calculate the position of trackes dropped into the playlist Fixes #688 --- js/components/DropTarget.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/components/DropTarget.tsx b/js/components/DropTarget.tsx index 5c9c27e8..c9dddcf4 100644 --- a/js/components/DropTarget.tsx +++ b/js/components/DropTarget.tsx @@ -19,12 +19,14 @@ export default class DropTarget extends React.Component { handleDrop = (e: React.DragEvent) => { this.supress(e); - const { target } = e; - if (!(target instanceof Element)) { + // TODO: We could probably move this coordinate logic into the playlist. + // I think that's the only place it gets used. + const { currentTarget } = e; + if (!(currentTarget instanceof Element)) { return; } - const { left: x, top: y } = target.getBoundingClientRect(); + const { left: x, top: y } = currentTarget.getBoundingClientRect(); this.props.handleDrop(e, { x, y }); };