fix: allow pointer events when editing a linear element (#7238)
This commit is contained in:
parent
f66c93633c
commit
798e1fd858
@ -1173,6 +1173,19 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
pendingImageElementId: this.state.pendingImageElementId,
|
pendingImageElementId: this.state.pendingImageElementId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const shouldBlockPointerEvents =
|
||||||
|
!(
|
||||||
|
this.state.editingElement && isLinearElement(this.state.editingElement)
|
||||||
|
) &&
|
||||||
|
(this.state.selectionElement ||
|
||||||
|
this.state.draggingElement ||
|
||||||
|
this.state.resizingElement ||
|
||||||
|
(this.state.activeTool.type === "laser" &&
|
||||||
|
// technically we can just test on this once we make it more safe
|
||||||
|
this.state.cursorButton === "down") ||
|
||||||
|
(this.state.editingElement &&
|
||||||
|
!isTextElement(this.state.editingElement)));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={clsx("excalidraw excalidraw-container", {
|
className={clsx("excalidraw excalidraw-container", {
|
||||||
@ -1180,17 +1193,9 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
"excalidraw--mobile": this.device.editor.isMobile,
|
"excalidraw--mobile": this.device.editor.isMobile,
|
||||||
})}
|
})}
|
||||||
style={{
|
style={{
|
||||||
["--ui-pointerEvents" as any]:
|
["--ui-pointerEvents" as any]: shouldBlockPointerEvents
|
||||||
this.state.selectionElement ||
|
? POINTER_EVENTS.disabled
|
||||||
this.state.draggingElement ||
|
: POINTER_EVENTS.enabled,
|
||||||
this.state.resizingElement ||
|
|
||||||
(this.state.activeTool.type === "laser" &&
|
|
||||||
// technically we can just test on this once we make it more safe
|
|
||||||
this.state.cursorButton === "down") ||
|
|
||||||
(this.state.editingElement &&
|
|
||||||
!isTextElement(this.state.editingElement))
|
|
||||||
? POINTER_EVENTS.disabled
|
|
||||||
: POINTER_EVENTS.enabled,
|
|
||||||
}}
|
}}
|
||||||
ref={this.excalidrawContainerRef}
|
ref={this.excalidrawContainerRef}
|
||||||
onDrop={this.handleAppOnDrop}
|
onDrop={this.handleAppOnDrop}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user