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
|
// Set ephemeral grid styles on the dragged component
|
||||||
$: instance = componentStore.actions.getComponentInstance(id)
|
$: instance = componentStore.actions.getComponentInstance(id)
|
||||||
$: $instance?.setEphemeralStyles({
|
$: componentStyles = getComponentStyles($gridStyles)
|
||||||
...$gridStyles,
|
$: $instance?.setEphemeralStyles(componentStyles)
|
||||||
...($gridStyles ? { "z-index": 999 } : null),
|
|
||||||
})
|
|
||||||
|
|
||||||
// Sugar for a combination of both min and max
|
// Sugar for a combination of both min and max
|
||||||
const minMax = (value, min, max) => Math.min(max, Math.max(min, value))
|
const minMax = (value, min, max) => Math.min(max, Math.max(min, value))
|
||||||
|
@ -41,6 +39,15 @@
|
||||||
return [...component?.children][0]
|
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) => {
|
const processEvent = Utils.throttle((mouseX, mouseY) => {
|
||||||
if (!dragInfo?.grid) {
|
if (!dragInfo?.grid) {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue