From 5e2055fc84eadcc45a6c7f3d8c47b9985d34ba66 Mon Sep 17 00:00:00 2001 From: Paul Kaplan <pkaplan@media.mit.edu> Date: Fri, 18 Jan 2019 15:09:12 -0500 Subject: [PATCH] Revert "Merge pull request #4354 from paulkaplan/fix-backpack-sprite" This reverts commit 97f8eb63b45e269d0e1d3e522980ff313c207fc7, reversing changes made to 2e017f060fbef580173c020731c066c6aae01ae3. --- src/containers/costume-tab.jsx | 2 +- src/containers/sound-tab.jsx | 2 +- src/containers/target-pane.jsx | 2 +- src/lib/sortable-hoc.jsx | 7 ++++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/containers/costume-tab.jsx b/src/containers/costume-tab.jsx index 8f2717e96..5df459150 100644 --- a/src/containers/costume-tab.jsx +++ b/src/containers/costume-tab.jsx @@ -206,7 +206,7 @@ class CostumeTab extends React.Component { this.fileInput.click(); } handleDrop (dropInfo) { - if (dropInfo.dragType === DragConstants.COSTUME && dropInfo.newIndex !== null) { + if (dropInfo.dragType === DragConstants.COSTUME) { const sprite = this.props.vm.editingTarget.sprite; const activeCostume = sprite.costumes[this.state.selectedCostumeIndex]; this.props.vm.reorderCostume(this.props.vm.editingTarget.id, diff --git a/src/containers/sound-tab.jsx b/src/containers/sound-tab.jsx index d8731b4c3..3df93b1f6 100644 --- a/src/containers/sound-tab.jsx +++ b/src/containers/sound-tab.jsx @@ -130,7 +130,7 @@ class SoundTab extends React.Component { } handleDrop (dropInfo) { - if (dropInfo.dragType === DragConstants.SOUND && dropInfo.newIndex !== null) { + if (dropInfo.dragType === DragConstants.SOUND) { const sprite = this.props.vm.editingTarget.sprite; const activeSound = sprite.sounds[this.state.selectedSoundIndex]; diff --git a/src/containers/target-pane.jsx b/src/containers/target-pane.jsx index b63a72a36..eb4100969 100644 --- a/src/containers/target-pane.jsx +++ b/src/containers/target-pane.jsx @@ -163,7 +163,7 @@ class TargetPane extends React.Component { } handleDrop (dragInfo) { const {sprite: targetId} = this.props.hoveredTarget; - if (dragInfo.dragType === DragConstants.SPRITE && dragInfo.newIndex !== null) { + if (dragInfo.dragType === DragConstants.SPRITE) { // Add one to both new and target index because we are not counting/moving the stage this.props.vm.reorderTarget(dragInfo.index + 1, dragInfo.newIndex + 1); } else if (dragInfo.dragType === DragConstants.BACKPACK_SPRITE) { diff --git a/src/lib/sortable-hoc.jsx b/src/lib/sortable-hoc.jsx index 57087867b..d3f9c59e1 100644 --- a/src/lib/sortable-hoc.jsx +++ b/src/lib/sortable-hoc.jsx @@ -33,9 +33,10 @@ const SortableHOC = function (WrappedComponent) { } this.containerBox = this.ref.getBoundingClientRect(); } else if (!newProps.dragInfo.dragging && this.props.dragInfo.dragging) { - this.props.onDrop(Object.assign({}, this.props.dragInfo, { - newIndex: this.getMouseOverIndex() - })); + const newIndex = this.getMouseOverIndex(); + if (newIndex !== null) { + this.props.onDrop(Object.assign({}, this.props.dragInfo, {newIndex})); + } } } -- GitLab