Skip to content

Commit

Permalink
Fixed dnd for tabs
Browse files Browse the repository at this point in the history
Resolves brave#6033

Auditors: @bsclifton

Test Plan:
- try dnd tabs as mentioned in brave#6033
  • Loading branch information
NejcZdovc committed Jan 22, 2017
1 parent 94f8976 commit 38a4e53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion js/dnd.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports.onDragOver = (dragType, sourceBoundingRect, draggingOverKey, drag

e.preventDefault()
e.dataTransfer.dropEffect = 'move'
// Otherise, only accept it if we have some frameProps
// Otherwise, only accept it if we have some frameProps
if (!dndData.hasDragData(e.dataTransfer, dragType)) {
windowActions.setIsBeingDraggedOverDetail(dragType, draggingOverKey, {
draggingOverLeftHalf: false,
Expand All @@ -58,6 +58,8 @@ module.exports.onDragOver = (dragType, sourceBoundingRect, draggingOverKey, drag
return
}

console.log(e.target)

if (e.clientX > sourceBoundingRect.left && e.clientX < sourceBoundingRect.left + sourceBoundingRect.width / 5 &&
(!draggingOverDetail || !draggingOverDetail.get('draggingOverLeftHalf'))) {
windowActions.setIsBeingDraggedOverDetail(dragType, draggingOverKey, {
Expand Down
2 changes: 1 addition & 1 deletion js/dndData.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
const Immutable = require('immutable')

module.exports.hasDragData = (dataTransfer, dragType) => {
return !!dataTransfer.getData(`application/x-brave-${dragType}`)
return dataTransfer.types.includes(`application/x-brave-${dragType}`)
}

module.exports.getDragData = (dataTransfer, dragType) => {
Expand Down

0 comments on commit 38a4e53

Please sign in to comment.