Add setting to control tree explorer item padding (#700)

This commit is contained in:
Chenlei Hu
2024-09-01 14:36:15 -04:00
committed by GitHub
parent d04dbcd2c1
commit b0b5f92940
2 changed files with 26 additions and 0 deletions

View File

@@ -60,6 +60,14 @@ watchEffect(() => {
)
})
watchEffect(() => {
const padding = useSettingStore().get('Comfy.TreeExplorer.ItemPadding')
document.documentElement.style.setProperty(
'--comfy-tree-explorer-item-padding',
`${padding}px`
)
})
const { t } = useI18n()
const init = () => {
useSettingStore().addSettings(app.ui.settings)
@@ -126,6 +134,12 @@ onUnmounted(() => {
})
</script>
<style>
.p-tree-node-content {
padding: var(--comfy-tree-explorer-item-padding) !important;
}
</style>
<style scoped>
.spinner {
@apply absolute inset-0 flex justify-center items-center h-screen;

View File

@@ -267,6 +267,18 @@ export const useSettingStore = defineStore('setting', {
type: 'boolean',
defaultValue: false
})
app.ui.settings.addSetting({
id: 'Comfy.TreeExplorer.ItemPadding',
name: 'Tree explorer item padding',
type: 'slider',
defaultValue: 2,
attrs: {
min: 0,
max: 8,
step: 1
}
})
},
set<K extends keyof Settings>(key: K, value: Settings[K]) {