Improve comments and namimg conventions
This commit is contained in:
parent
1a37e1fc95
commit
c888b703dd
2 changed files with 8 additions and 4 deletions
|
@ -25,7 +25,9 @@
|
|||
// Local flag for whether we are awaiting an async drop event
|
||||
let dropping = false
|
||||
|
||||
const insideGrid = e => {
|
||||
// Util to check if a DND event originates from a grid (or inside a grid).
|
||||
// This is important as we do not handle grid DND in this handler.
|
||||
const isGridEvent = e => {
|
||||
return e.target
|
||||
?.closest?.(".component")
|
||||
?.parentNode?.closest?.(".component")
|
||||
|
@ -69,7 +71,7 @@
|
|||
|
||||
// Callback when initially starting a drag on a draggable component
|
||||
const onDragStart = e => {
|
||||
if (insideGrid(e)) {
|
||||
if (isGridEvent(e)) {
|
||||
return
|
||||
}
|
||||
const component = e.target.closest(".component")
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
...(gridStyles ? { "z-index": 999 } : null),
|
||||
})
|
||||
|
||||
const isChildOfGrid = e => {
|
||||
// Util to check if a DND event originates from a grid (or inside a grid).
|
||||
// This is important as we do not handle grid DND in this handler.
|
||||
const isGridEvent = e => {
|
||||
return (
|
||||
e.target
|
||||
.closest?.(".component")
|
||||
|
@ -113,7 +115,7 @@
|
|||
|
||||
// Callback when initially starting a drag on a draggable component
|
||||
const onDragStart = e => {
|
||||
if (!isChildOfGrid(e)) {
|
||||
if (!isGridEvent(e)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue