Skip to content

Commit 51233b4

Browse files
authored
Fix node preview location when sidebar location is right (#435)
1 parent 5c4d1c2 commit 51233b4

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/components/sidebar/tabs/NodeLibrarySidebarTab.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@
3131
3232
const hoverTarget = event.target as HTMLElement
3333
const targetRect = hoverTarget.getBoundingClientRect()
34-
nodePreviewStyle.top = `${targetRect.top - 40}px`
35-
nodePreviewStyle.left = `${targetRect.right}px`
34+
if (sidebarLocation === 'left') {
35+
nodePreviewStyle.top = `${targetRect.top - 40}px`
36+
nodePreviewStyle.left = `${targetRect.right}px`
37+
} else {
38+
nodePreviewStyle.top = `${targetRect.top - 40}px`
39+
nodePreviewStyle.left = `${targetRect.left - 400}px`
40+
}
3641
},
3742
onMouseleave: () => {
3843
hoveredComfyNodeName = null
@@ -75,6 +80,7 @@ import type { TreeNode } from 'primevue/treenode'
7580
import TreePlus from '@/components/primevueOverride/TreePlus.vue'
7681
import NodePreview from '@/components/node/NodePreview.vue'
7782
import SidebarTabTemplate from '@/components/sidebar/tabs/SidebarTabTemplate.vue'
83+
import { useSettingStore } from '@/stores/settingStore'
7884
7985
const nodeDefStore = useNodeDefStore()
8086
const alphabeticalSort = ref(false)
@@ -86,6 +92,11 @@ const hoveredComfyNode = computed<ComfyNodeDefImpl | null>(() => {
8692
}
8793
return nodeDefStore.nodeDefsByName[hoveredComfyNodeName.value] || null
8894
})
95+
96+
const settingStore = useSettingStore()
97+
const sidebarLocation = computed<'left' | 'right'>(() =>
98+
settingStore.get('Comfy.Sidebar.Location')
99+
)
89100
const nodePreviewStyle = ref<Record<string, string>>({
90101
position: 'absolute',
91102
top: '0px',

0 commit comments

Comments
 (0)