Fix how we calculate the position of trackes dropped into the playlist

Fixes #688
This commit is contained in:
Jordan Eldredge 2018-10-22 07:26:37 -07:00
parent 291b518765
commit b074e0eff3

View file

@ -19,12 +19,14 @@ export default class DropTarget extends React.Component<Props> {
handleDrop = (e: React.DragEvent<HTMLDivElement>) => {
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 });
};