Skip to content

Commit d70b7cc

Browse files
committed
Move more getInputOutputPos to getSlotPosition
1 parent 027e06d commit d70b7cc

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

src/lib/litegraph/src/LGraphCanvas.ts

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3315,7 +3315,15 @@ export class LGraphCanvas
33153315

33163316
if (slot && linkConnector.isInputValidDrop(node, slot)) {
33173317
highlightInput = slot
3318-
highlightPos = node.getInputSlotPos(slot)
3318+
if (LiteGraph.vueNodesMode) {
3319+
const idx = node.inputs.indexOf(slot)
3320+
highlightPos =
3321+
idx !== -1
3322+
? getSlotPosition(node, idx, true)
3323+
: node.getInputSlotPos(slot)
3324+
} else {
3325+
highlightPos = node.getInputSlotPos(slot)
3326+
}
33193327
linkConnector.overWidget = overWidget
33203328
}
33213329
}
@@ -3327,7 +3335,9 @@ export class LGraphCanvas
33273335
const result = node.findInputByType(firstLink.fromSlot.type)
33283336
if (result) {
33293337
highlightInput = result.slot
3330-
highlightPos = node.getInputSlotPos(result.slot)
3338+
highlightPos = LiteGraph.vueNodesMode
3339+
? getSlotPosition(node, result.index, true)
3340+
: node.getInputSlotPos(result.slot)
33313341
}
33323342
} else if (
33333343
inputId != -1 &&
@@ -3352,7 +3362,9 @@ export class LGraphCanvas
33523362
if (inputId === -1 && outputId === -1) {
33533363
const result = node.findOutputByType(firstLink.fromSlot.type)
33543364
if (result) {
3355-
highlightPos = node.getOutputPos(result.index)
3365+
highlightPos = LiteGraph.vueNodesMode
3366+
? getSlotPosition(node, result.index, false)
3367+
: node.getOutputPos(result.index)
33563368
}
33573369
} else {
33583370
// check if I have a slot below de mouse
@@ -5617,7 +5629,9 @@ export class LGraphCanvas
56175629
const { link, inputNode, input } = resolved
56185630
if (!inputNode || !input) continue
56195631

5620-
const endPos = inputNode.getInputPos(link.target_slot)
5632+
const endPos: Point = LiteGraph.vueNodesMode
5633+
? getSlotPosition(inputNode, link.target_slot, true)
5634+
: inputNode.getInputPos(link.target_slot)
56215635

56225636
this.#renderAllLinkSegments(
56235637
ctx,
@@ -5642,7 +5656,9 @@ export class LGraphCanvas
56425656
const { link, outputNode, output } = resolved
56435657
if (!outputNode || !output) continue
56445658

5645-
const startPos = outputNode.getOutputPos(link.origin_slot)
5659+
const startPos: Point = LiteGraph.vueNodesMode
5660+
? getSlotPosition(outputNode, link.origin_slot, false)
5661+
: outputNode.getOutputPos(link.origin_slot)
56465662

56475663
this.#renderAllLinkSegments(
56485664
ctx,
@@ -5707,7 +5723,9 @@ export class LGraphCanvas
57075723
if (!node) continue
57085724

57095725
const startPos = firstReroute.pos
5710-
const endPos = node.getInputPos(link.target_slot)
5726+
const endPos: Point = LiteGraph.vueNodesMode
5727+
? getSlotPosition(node, link.target_slot, true)
5728+
: node.getInputPos(link.target_slot)
57115729
const endDirection = node.inputs[link.target_slot]?.dir
57125730

57135731
firstReroute._dragging = true
@@ -5726,7 +5744,9 @@ export class LGraphCanvas
57265744
const node = graph.getNodeById(link.origin_id)
57275745
if (!node) continue
57285746

5729-
const startPos = node.getOutputPos(link.origin_slot)
5747+
const startPos: Point = LiteGraph.vueNodesMode
5748+
? getSlotPosition(node, link.origin_slot, false)
5749+
: node.getOutputPos(link.origin_slot)
57305750
const endPos = reroute.pos
57315751
const startDirection = node.outputs[link.origin_slot]?.dir
57325752

0 commit comments

Comments
 (0)