better fix for closing the sidebar tempo

This commit is contained in:
Oleg Isonen committed 2022-03-25 15:24:44 +00:00
1 parent 63e5eaaa80
commit 199b86fd7b
1 file changed
+8 -6
@@ -38,12 +38,14 @@ export const SidebarLeft = ({
const [isDragging, setIsDragging] = useState(false);
const { TabContent } = activeTab === "none" ? none : panels[activeTab];
const close = useCallback(() => setActiveTab("none"), []);
useSubscribe<"clickCanvas">("clickCanvas", close);
useSubscribe<"clickCanvas">("clickCanvas", () => {
setActiveTab("none");
});
useSubscribe("dragStartInstance", () => {
// We can't close the sidebar if we are dragging from the sidebar
if (isDragging === true) return;
close();
setIsDragging(true);
});
useSubscribe("dragEndInstance", () => {
setIsDragging(false);
});
const handleDragChange = useCallback(
@@ -54,7 +56,7 @@ export const SidebarLeft = ({
setIsDragging(isDragging);
onDragChange(isDragging);
},
[onDragChange, close]
[onDragChange]
);
return (