Decisively fix numerical enum bug

This commit is contained in:
Benjamin Lu
2025-09-17 21:14:11 -07:00
parent bcce2c8ab2
commit 6eb1f5e9c6
6 changed files with 9 additions and 10 deletions

View File

@@ -330,7 +330,7 @@ export class LinkConnector {
network.outputNode,
output
)
renderLink.fromDirection = LinkDirection.NONE
renderLink.fromDirection = LinkDirection.CENTER
renderLinks.push(renderLink)
continue
@@ -486,7 +486,7 @@ export class LinkConnector {
input,
reroute
)
renderLink.fromDirection = LinkDirection.NONE
renderLink.fromDirection = LinkDirection.CENTER
this.renderLinks.push(renderLink)
this.state.connectingTo = 'input'
@@ -513,7 +513,7 @@ export class LinkConnector {
outputSlot,
reroute
)
renderLink.fromDirection = LinkDirection.NONE
renderLink.fromDirection = LinkDirection.CENTER
this.renderLinks.push(renderLink)
this.state.connectingTo = 'input'
@@ -550,7 +550,7 @@ export class LinkConnector {
output,
reroute
)
renderLink.fromDirection = LinkDirection.NONE
renderLink.fromDirection = LinkDirection.CENTER
this.renderLinks.push(renderLink)
this.state.connectingTo = 'output'
@@ -600,7 +600,7 @@ export class LinkConnector {
const reroute = network.getReroute(linkSegment.parentId)
const renderLink = new ToInputRenderLink(network, node, slot, reroute)
renderLink.fromDirection = LinkDirection.NONE
renderLink.fromDirection = LinkDirection.CENTER
this.renderLinks.push(renderLink)
state.connectingTo = 'input'

View File

@@ -36,7 +36,7 @@ export class MovingInputLink extends MovingLinkBase {
this.node = this.outputNode
this.fromSlot = this.outputSlot
this.fromPos = fromReroute?.pos ?? this.outputPos
this.fromDirection = LinkDirection.NONE
this.fromDirection = LinkDirection.CENTER
this.fromSlotIndex = this.outputIndex
}

View File

@@ -241,7 +241,7 @@ describe('LinkConnector', () => {
expect(renderLink.node).toEqual(originNode)
expect(renderLink.fromSlot).toEqual(output)
expect(renderLink.fromReroute).toEqual(reroute)
expect(renderLink.fromDirection).toEqual(LinkDirection.NONE)
expect(renderLink.fromDirection).toEqual(LinkDirection.CENTER)
expect(renderLink.network).toEqual(network)
})
})

View File

@@ -205,7 +205,6 @@ export class LitegraphLinkAdapter {
case LinkDirection.DOWN:
return 'down'
case LinkDirection.CENTER:
case LinkDirection.NONE:
return 'none'
default:
return 'right'

View File

@@ -54,7 +54,7 @@ export function attachSlotLinkPreviewRenderer(canvas: LGraphCanvas) {
const to: ReadOnlyPoint = [pointer.canvas.x, pointer.canvas.y]
const startDir = source.direction ?? LinkDirection.RIGHT
const endDir = LinkDirection.NONE
const endDir = LinkDirection.CENTER
const colour = resolveConnectingLinkColor(sourceSlot?.type)

View File

@@ -241,7 +241,7 @@ describe('LinkConnector', () => {
expect(renderLink.node).toEqual(originNode)
expect(renderLink.fromSlot).toEqual(output)
expect(renderLink.fromReroute).toEqual(reroute)
expect(renderLink.fromDirection).toEqual(LinkDirection.NONE)
expect(renderLink.fromDirection).toEqual(LinkDirection.CENTER)
expect(renderLink.network).toEqual(network)
})
})