Skip to content

Commit

Permalink
Close side bar on menu location set as disabled (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei authored Jul 22, 2024
1 parent eec6d08 commit 63d874b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/components/sidebar/SideToolBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import SideBarThemeToggleIcon from "./SideBarThemeToggleIcon.vue";
import SideBarSettingsToggleIcon from "./SideBarSettingsToggleIcon.vue";
import NodeDetailSideBarItem from "./items/NodeDetailSideBarItem.vue";
import QueueSideBarItem from "./items/QueueSideBarItem.vue";
import { markRaw, ref, watch } from "vue";
import { markRaw, onMounted, onUnmounted, ref, watch } from "vue";
const items = ref([
{ icon: "pi pi-map", component: markRaw(NodeDetailSideBarItem) },
Expand All @@ -42,6 +42,24 @@ const emit = defineEmits(["change"]);
watch(selectedItem, (newVal) => {
emit("change", newVal !== null);
});
const onBetaMenuDisabled = () => {
selectedItem.value = null;
};
onMounted(() => {
document.addEventListener(
"comfy:setting:beta-menu-disabled",
onBetaMenuDisabled
);
});
onUnmounted(() => {
document.removeEventListener(
"comfy:setting:beta-menu-disabled",
onBetaMenuDisabled
);
});
</script>

<style>
Expand Down
1 change: 1 addition & 0 deletions src/scripts/ui/menu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ export class ComfyAppMenu {
app.ui.menuContainer.style.removeProperty("display");
this.element.style.display = "none";
app.ui.restoreMenuPosition();
document.dispatchEvent(new Event("comfy:setting:beta-menu-disabled"));
}
window.dispatchEvent(new Event("resize"));
},
Expand Down

0 comments on commit 63d874b

Please sign in to comment.