mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-08 13:05:08 +09:00
better fix for closing the sidebar tempo
This commit is contained in:
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 (
|
||||
|
||||
Reference in new issue
Block a user