Prevent pointer events in components while dragging
This commit is contained in:
parent
391294f7a1
commit
7433b073c5
|
@ -27,10 +27,8 @@
|
|||
|
||||
// Set ephemeral grid styles on the dragged component
|
||||
$: instance = componentStore.actions.getComponentInstance(id)
|
||||
$: $instance?.setEphemeralStyles({
|
||||
...$gridStyles,
|
||||
...($gridStyles ? { "z-index": 999 } : null),
|
||||
})
|
||||
$: componentStyles = getComponentStyles($gridStyles)
|
||||
$: $instance?.setEphemeralStyles(componentStyles)
|
||||
|
||||
// Sugar for a combination of both min and max
|
||||
const minMax = (value, min, max) => Math.min(max, Math.max(min, value))
|
||||
|
@ -41,6 +39,15 @@
|
|||
return [...component?.children][0]
|
||||
}
|
||||
|
||||
const getComponentStyles = gridStyles => {
|
||||
let styles = { ...gridStyles }
|
||||
if (gridStyles) {
|
||||
styles["z-index"] = 999
|
||||
styles["pointer-events"] = "none"
|
||||
}
|
||||
return styles
|
||||
}
|
||||
|
||||
const processEvent = Utils.throttle((mouseX, mouseY) => {
|
||||
if (!dragInfo?.grid) {
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue