Skip to content

Commit 61b8f7b

Browse files
committed
Refactor jank offset
1 parent bc10977 commit 61b8f7b

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

src/components/graph/vueNodes/LGraphNode.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
lodCssClass
1616
]"
1717
:style="{
18-
transform: `translate(${position?.x ?? 0}px, ${position?.y ?? 0}px)`,
18+
transform: `translate(${position?.x ?? 0}px, ${(position?.y ?? 0) - LiteGraph.NODE_TITLE_HEIGHT}px)`,
1919
width: size ? `${size.width}px` : '200px',
2020
height: size ? `${size.height}px` : 'auto',
2121
backgroundColor: '#353535'
@@ -81,6 +81,7 @@
8181
</template>
8282

8383
<script setup lang="ts">
84+
import { LiteGraph } from '@comfyorg/litegraph'
8485
import { computed, onErrorCaptured, ref, toRef, watch } from 'vue'
8586
8687
// Import the VueNodeData type

src/components/graph/vueNodes/NodeHeader.vue

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
class="lg-node-header flex items-center justify-between p-2 rounded-t-lg cursor-move"
88
:style="{
99
backgroundColor: headerColor,
10-
color: textColor,
11-
marginTop: headerOffsetForLiteGraphAlignment
10+
color: textColor
1211
}"
1312
@dblclick="handleDoubleClick"
1413
>
@@ -38,7 +37,6 @@
3837

3938
<script setup lang="ts">
4039
import type { LGraphNode } from '@comfyorg/litegraph'
41-
import { LiteGraph } from '@comfyorg/litegraph'
4240
import { computed, onErrorCaptured, ref, watch } from 'vue'
4341
4442
import EditableText from '@/components/common/EditableText.vue'
@@ -117,11 +115,6 @@ const textColor = computed(() => {
117115
return brightness > 128 ? '#000' : '#fff'
118116
})
119117
120-
// Negative margin to align Vue node header with LiteGraph node positioning
121-
const headerOffsetForLiteGraphAlignment = computed(
122-
() => `${-LiteGraph.NODE_TITLE_HEIGHT}px`
123-
)
124-
125118
// Event handlers
126119
const handleCollapse = () => {
127120
emit('collapse')

0 commit comments

Comments
 (0)