Fix DND ghost cursor issue on mac

This commit is contained in:
Andrew Kingston 2024-08-01 09:00:18 +01:00
parent 7433b073c5
commit 99c7859fb2
No known key found for this signature in database
1 changed files with 10 additions and 5 deletions

View File

@ -10,6 +10,15 @@
getGridVarValue,
} from "utils/grid"
// Smallest possible 1x1 transparent GIF
const ghost = new Image(1, 1)
ghost.src =
"data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="
let dragInfo
let gridStyles = memo()
let id
// Grid CSS variables
$: vars = {
colStart: $getGridVar("col-start"),
@ -18,10 +27,6 @@
rowEnd: $getGridVar("row-end"),
}
let dragInfo
let gridStyles = memo()
let id
// Some memoisation of primitive types for performance
$: id = dragInfo?.id || id
@ -117,7 +122,7 @@
}
// Hide drag ghost image
e.dataTransfer.setDragImage(new Image(), 0, 0)
e.dataTransfer.setDragImage(ghost, 0, 0)
// Extract state
let mode, id, side