1
0
Fork 0
mirror of synced 2024-06-01 18:20:18 +12:00

Improve comments and namimg conventions

This commit is contained in:
Andrew Kingston 2022-10-24 13:32:48 +01:00
parent c6ddbb6d04
commit 702d1ad406
2 changed files with 8 additions and 4 deletions

View file

@ -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")

View file

@ -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
}