fix: allow pointer events when editing a linear element (#7238)

This commit is contained in:
zsviczian 2023-11-10 15:21:59 +01:00 committed by GitHub
parent f66c93633c
commit 798e1fd858
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1173,6 +1173,19 @@ class App extends React.Component<AppProps, AppState> {
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 (
<div
className={clsx("excalidraw excalidraw-container", {
@ -1180,15 +1193,7 @@ class App extends React.Component<AppProps, AppState> {
"excalidraw--mobile": this.device.editor.isMobile,
})}
style={{
["--ui-pointerEvents" as any]:
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))
["--ui-pointerEvents" as any]: shouldBlockPointerEvents
? POINTER_EVENTS.disabled
: POINTER_EVENTS.enabled,
}}