mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 19:21:54 +00:00
Add sidebar size setting (normal/small) (#397)
* Add sidebar size setting (normal/small) * Set default small sidebar size for small window
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<teleport :to="teleportTarget">
|
<teleport :to="teleportTarget">
|
||||||
<nav class="side-tool-bar-container">
|
<nav :class="'side-tool-bar-container' + (isSmall ? ' small-sidebar' : '')">
|
||||||
<SideBarIcon
|
<SideBarIcon
|
||||||
v-for="tab in tabs"
|
v-for="tab in tabs"
|
||||||
:key="tab.id"
|
:key="tab.id"
|
||||||
@@ -55,6 +55,10 @@ const teleportTarget = computed(() =>
|
|||||||
: '.comfyui-body-right'
|
: '.comfyui-body-right'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const isSmall = computed(
|
||||||
|
() => settingStore.get('Comfy.SideBar.Size') === 'small'
|
||||||
|
)
|
||||||
|
|
||||||
const tabs = computed(() => workspaceStore.getSidebarTabs())
|
const tabs = computed(() => workspaceStore.getSidebarTabs())
|
||||||
const selectedTab = computed<SidebarTabExtension | null>(() => {
|
const selectedTab = computed<SidebarTabExtension | null>(() => {
|
||||||
const tabId = workspaceStore.activeSidebarTab
|
const tabId = workspaceStore.activeSidebarTab
|
||||||
@@ -82,6 +86,10 @@ onBeforeUnmount(() => {
|
|||||||
--sidebar-width: 64px;
|
--sidebar-width: 64px;
|
||||||
--sidebar-icon-size: 1.5rem;
|
--sidebar-icon-size: 1.5rem;
|
||||||
}
|
}
|
||||||
|
:root .small-sidebar {
|
||||||
|
--sidebar-width: 40px;
|
||||||
|
--sidebar-icon-size: 1rem;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -89,6 +89,14 @@ export const useSettingStore = defineStore('setting', {
|
|||||||
options: ['left', 'right'],
|
options: ['left', 'right'],
|
||||||
defaultValue: 'left'
|
defaultValue: 'left'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.ui.settings.addSetting({
|
||||||
|
id: 'Comfy.SideBar.Size',
|
||||||
|
name: 'Sidebar size',
|
||||||
|
type: 'combo',
|
||||||
|
options: ['normal', 'small'],
|
||||||
|
defaultValue: window.innerWidth < 1600 ? 'small' : 'normal'
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
set(key: string, value: any) {
|
set(key: string, value: any) {
|
||||||
|
|||||||
Reference in New Issue
Block a user