Skip to content

Commit

Permalink
fix: insert area visible whilst selecting or dragging
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Apr 4, 2022
1 parent c5de4d5 commit 5d1e68f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/lib/components/modes/treemode/JSONNode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@
items,
indexOffset: 0
}
singleton.dragging = true
document.addEventListener('mousemove', handleDragSelection, true)
document.addEventListener('mouseup', handleDragSelectionEnd)
Expand Down Expand Up @@ -320,6 +321,7 @@
}
dragging = undefined
singleton.dragging = false
document.removeEventListener('mousemove', handleDragSelection, true)
document.removeEventListener('mouseup', handleDragSelectionEnd)
Expand Down Expand Up @@ -375,6 +377,10 @@
}
function handleMouseOver(event) {
if (singleton.selecting || singleton.dragging) {
return
}
event.stopPropagation()
if (isChildOfAttribute(event.target, 'data-type', 'selectable-value')) {
Expand Down
6 changes: 4 additions & 2 deletions src/lib/components/modes/treemode/singleton.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// used by JSONNode during dragging
export const singleton = {
mousedown: false,
selecting: false,
selectionAnchor: null, // Path
selectionAnchorType: null, // Selection type
selectionFocus: null // Path
selectionFocus: null, // Path

dragging: false
}

0 comments on commit 5d1e68f

Please sign in to comment.