Created
November 23, 2016 03:05
-
-
Save arackaf/606aa0cab08b68d942686cd93b6818d8 to your computer and use it in GitHub Desktop.
11-22-16-dropGist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const subjectsModuleSelector = createSelector([ | |
state => state.app.subjectHash, | |
state => state.subjectsModule.draggingId, | |
state => state.subjectsModule.currentDropCandidateId | |
], (subjectHash, draggingId, currentDropCandidateId) => { | |
let subjects; | |
if (currentDropCandidateId){ | |
subjectHash = {...subjectHash}; | |
let dropTarget = subjectHash[currentDropCandidateId], | |
draggingSubject = subjectHash[`${draggingId}_dragging`] = {...subjectHash[draggingId], candidateMove: true}; | |
draggingSubject.path = !dropTarget.path ? `,${dropTarget._id},` : dropTarget.path + `${dropTarget._id},`; | |
subjects = stackAndGetTopLevelSubjects(subjectHash); | |
} else { | |
subjects = subjectsSelector(subjectHash).subjects; | |
} | |
return { | |
subjects, | |
draggingId, | |
currentDropCandidateId | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment