We can't close the sidebar if we are dragging from the sidebar

This commit is contained in:
Oleg Isonen committed 2022-03-25 14:22:15 +00:00
1 parent 5c72ed5a82
commit 63e5eaaa80
1 file changed
+6 -2
@@ -40,13 +40,17 @@ export const SidebarLeft = ({
const close = useCallback(() => setActiveTab("none"), []);
useSubscribe<"clickCanvas">("clickCanvas", close);
useSubscribe("dragStartInstance", close);
useSubscribe("dragStartInstance", () => {
// We can't close the sidebar if we are dragging from the sidebar
if (isDragging === true) return;
close();
});
const handleDragChange = useCallback(
(isDragging: boolean) => {
// After dragging is done, container is going to become visible
// and we need to close it for good.
if (isDragging === false) close();
if (isDragging === false) setActiveTab("none");
setIsDragging(isDragging);
onDragChange(isDragging);
},