mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 19:21:54 +00:00
Add menu button to toggle focus mode (#1446)
* Add focus mode toggle button * handle menu position * nit
This commit is contained in:
@@ -2,10 +2,12 @@
|
|||||||
<Button
|
<Button
|
||||||
v-show="workspaceState.focusMode"
|
v-show="workspaceState.focusMode"
|
||||||
class="comfy-menu-hamburger"
|
class="comfy-menu-hamburger"
|
||||||
|
:style="positionCSS"
|
||||||
icon="pi pi-bars"
|
icon="pi pi-bars"
|
||||||
severity="secondary"
|
severity="secondary"
|
||||||
text
|
text
|
||||||
size="large"
|
size="large"
|
||||||
|
v-tooltip="{ value: $t('menu.showMenu'), showDelay: 300 }"
|
||||||
@click="exitFocusMode"
|
@click="exitFocusMode"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@@ -13,7 +15,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Button from 'primevue/button'
|
import Button from 'primevue/button'
|
||||||
import { useWorkspaceStore } from '@/stores/workspaceStore'
|
import { useWorkspaceStore } from '@/stores/workspaceStore'
|
||||||
import { watchEffect } from 'vue'
|
import { computed, CSSProperties, watchEffect } from 'vue'
|
||||||
import { app } from '@/scripts/app'
|
import { app } from '@/scripts/app'
|
||||||
import { useSettingStore } from '@/stores/settingStore'
|
import { useSettingStore } from '@/stores/settingStore'
|
||||||
|
|
||||||
@@ -33,14 +35,21 @@ watchEffect(() => {
|
|||||||
app.ui.menuContainer.style.display = 'block'
|
app.ui.menuContainer.style.display = 'block'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const menuSetting = computed(() => settingStore.get('Comfy.UseNewMenu'))
|
||||||
|
const positionCSS = computed<CSSProperties>(() =>
|
||||||
|
// 'Bottom' menuSetting shows the hamburger button in the bottom right corner
|
||||||
|
// 'Disabled', 'Top' menuSetting shows the hamburger button in the top right corner
|
||||||
|
menuSetting.value === 'Bottom'
|
||||||
|
? { bottom: '0px', right: '0px' }
|
||||||
|
: { top: '0px', right: '0px' }
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.comfy-menu-hamburger {
|
.comfy-menu-hamburger {
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0px;
|
|
||||||
right: 0px;
|
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<teleport to=".graph-canvas-container">
|
<teleport to=".graph-canvas-container">
|
||||||
<LiteGraphCanvasSplitterOverlay v-if="betaMenuEnabled">
|
<LiteGraphCanvasSplitterOverlay
|
||||||
|
v-if="betaMenuEnabled && !workspaceStore.focusMode"
|
||||||
|
>
|
||||||
<template #side-bar-panel>
|
<template #side-bar-panel>
|
||||||
<SideToolbar />
|
<SideToolbar />
|
||||||
</template>
|
</template>
|
||||||
@@ -65,9 +67,7 @@ const workspaceStore = useWorkspaceStore()
|
|||||||
const canvasStore = useCanvasStore()
|
const canvasStore = useCanvasStore()
|
||||||
const modelToNodeStore = useModelToNodeStore()
|
const modelToNodeStore = useModelToNodeStore()
|
||||||
const betaMenuEnabled = computed(
|
const betaMenuEnabled = computed(
|
||||||
() =>
|
() => settingStore.get('Comfy.UseNewMenu') !== 'Disabled'
|
||||||
settingStore.get('Comfy.UseNewMenu') !== 'Disabled' &&
|
|
||||||
!workspaceStore.focusMode
|
|
||||||
)
|
)
|
||||||
const canvasMenuEnabled = computed(() =>
|
const canvasMenuEnabled = computed(() =>
|
||||||
settingStore.get('Comfy.Graph.CanvasMenu')
|
settingStore.get('Comfy.Graph.CanvasMenu')
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div
|
<div
|
||||||
ref="topMenuRef"
|
ref="topMenuRef"
|
||||||
class="comfyui-menu flex items-center"
|
class="comfyui-menu flex items-center"
|
||||||
v-show="betaMenuEnabled"
|
v-show="betaMenuEnabled && !workspaceState.focusMode"
|
||||||
:class="{ dropzone: isDropZone, 'dropzone-active': isDroppable }"
|
:class="{ dropzone: isDropZone, 'dropzone-active': isDroppable }"
|
||||||
>
|
>
|
||||||
<h1 class="comfyui-logo mx-2">ComfyUI</h1>
|
<h1 class="comfyui-logo mx-2">ComfyUI</h1>
|
||||||
@@ -15,11 +15,19 @@
|
|||||||
<div class="comfyui-menu-right" ref="menuRight"></div>
|
<div class="comfyui-menu-right" ref="menuRight"></div>
|
||||||
<Actionbar />
|
<Actionbar />
|
||||||
<BottomPanelToggleButton />
|
<BottomPanelToggleButton />
|
||||||
|
<Button
|
||||||
|
icon="pi pi-bars"
|
||||||
|
severity="secondary"
|
||||||
|
text
|
||||||
|
v-tooltip="{ value: $t('menu.hideMenu'), showDelay: 300 }"
|
||||||
|
@click="workspaceState.focusMode = true"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</teleport>
|
</teleport>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import Button from 'primevue/button'
|
||||||
import Divider from 'primevue/divider'
|
import Divider from 'primevue/divider'
|
||||||
import WorkflowTabs from '@/components/topbar/WorkflowTabs.vue'
|
import WorkflowTabs from '@/components/topbar/WorkflowTabs.vue'
|
||||||
import CommandMenubar from '@/components/topbar/CommandMenubar.vue'
|
import CommandMenubar from '@/components/topbar/CommandMenubar.vue'
|
||||||
@@ -37,9 +45,7 @@ const workflowTabsPosition = computed(() =>
|
|||||||
settingStore.get('Comfy.Workflow.WorkflowTabsPosition')
|
settingStore.get('Comfy.Workflow.WorkflowTabsPosition')
|
||||||
)
|
)
|
||||||
const betaMenuEnabled = computed(
|
const betaMenuEnabled = computed(
|
||||||
() =>
|
() => settingStore.get('Comfy.UseNewMenu') !== 'Disabled'
|
||||||
settingStore.get('Comfy.UseNewMenu') !== 'Disabled' &&
|
|
||||||
!workspaceState.focusMode
|
|
||||||
)
|
)
|
||||||
const teleportTarget = computed(() =>
|
const teleportTarget = computed(() =>
|
||||||
settingStore.get('Comfy.UseNewMenu') === 'Top'
|
settingStore.get('Comfy.UseNewMenu') === 'Top'
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ const messages = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
menu: {
|
menu: {
|
||||||
|
hideMenu: 'Hide Menu',
|
||||||
|
showMenu: 'Show Menu',
|
||||||
batchCount: 'Batch Count',
|
batchCount: 'Batch Count',
|
||||||
batchCountTooltip:
|
batchCountTooltip:
|
||||||
'The number of times the workflow generation should be queued',
|
'The number of times the workflow generation should be queued',
|
||||||
@@ -193,6 +195,8 @@ const messages = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
menu: {
|
menu: {
|
||||||
|
hideMenu: '隐藏菜单',
|
||||||
|
showMenu: '显示菜单',
|
||||||
batchCount: '批次数量',
|
batchCount: '批次数量',
|
||||||
batchCountTooltip: '工作流生成次数',
|
batchCountTooltip: '工作流生成次数',
|
||||||
autoQueue: '自动执行',
|
autoQueue: '自动执行',
|
||||||
@@ -307,6 +311,8 @@ const messages = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
menu: {
|
menu: {
|
||||||
|
hideMenu: 'Скрыть меню',
|
||||||
|
showMenu: 'Показать меню',
|
||||||
batchCount: 'Количество пакетов',
|
batchCount: 'Количество пакетов',
|
||||||
batchCountTooltip:
|
batchCountTooltip:
|
||||||
'Количество раз, когда генерация рабочего процесса должна быть помещена в очередь',
|
'Количество раз, когда генерация рабочего процесса должна быть помещена в очередь',
|
||||||
|
|||||||
Reference in New Issue
Block a user