fix: hide canvas-modifying UI in view mode (#5815)

* fix: hide canvas-modifying UI in view mode

* add class for better targeting

* fix missing `key`

* fix: useOutsideClick not working in view mode
This commit is contained in:
David Luzar 2022-11-01 22:25:12 +01:00 committed by GitHub
parent 7f91cdc0c9
commit 8c298336fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 61 additions and 40 deletions

View file

@ -21,10 +21,11 @@ export const useOutsideClickHook = (handler: (event: Event) => void) => {
handler(event);
};
document.addEventListener("mousedown", listener);
document.addEventListener("pointerdown", listener);
document.addEventListener("touchstart", listener);
return () => {
document.removeEventListener("mousedown", listener);
document.removeEventListener("pointerdown", listener);
document.removeEventListener("touchstart", listener);
};
},