Skip to content

Instantly share code, notes, and snippets.

@JBKahn
Created May 1, 2014 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JBKahn/250a28288c309fa61bef to your computer and use it in GitHub Desktop.
Save JBKahn/250a28288c309fa61bef to your computer and use it in GitHub Desktop.
Drag & Drop Attempt 3
getDirectionMoved: (e, collectionLength, mousePos, spacerHeight) =>
spacerOffsetTop = @$spacer.offset().top
isOnTopOfSpacer = mousePos > spacerOffsetTop and mousePos < spacerOffsetTop + spacerHeight
isAboveSpacer = mousePos < spacerOffsetTop
isBelowSpacer = not isAboveSpacer and not isOnTopOfSpacer
spacerIsAtTop = Data.FinancialTransactions.dragCurrentIndex is 0
spacerIsAtBottom = Data.FinancialTransactions.dragCurrentIndex is collectionLength
return 'above' if isAboveSpacer and not spacerIsAtTop #and isOnTopOfTable
return 'below' if isBelowSpacer and not spacerIsAtBottom #and isOnTopOfTable
return 'none'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment