6
6
type LinkRenderContext ,
7
7
LitegraphLinkAdapter
8
8
} from '@/renderer/core/canvas/litegraph/LitegraphLinkAdapter'
9
- import { layoutStore } from '@/renderer/core/layout/store/LayoutStore'
10
9
11
10
import { CanvasPointer } from './CanvasPointer'
12
11
import type { ContextMenu } from './ContextMenu'
@@ -2198,14 +2197,11 @@ export class LGraphCanvas
2198
2197
this . processSelect ( node , e , true )
2199
2198
} else if ( this . links_render_mode !== LinkRenderType . HIDDEN_LINK ) {
2200
2199
// Reroutes
2201
- // Try layout store first, fallback to old method
2202
- const rerouteLayout = layoutStore . queryRerouteAtPoint ( {
2203
- x : e . canvasX ,
2204
- y : e . canvasY
2205
- } )
2206
- const reroute = rerouteLayout
2207
- ? graph . getReroute ( Number ( rerouteLayout . id ) )
2208
- : graph . getRerouteOnPos ( e . canvasX , e . canvasY , this . #visibleReroutes)
2200
+ const reroute = graph . getRerouteOnPos (
2201
+ e . canvasX ,
2202
+ e . canvasY ,
2203
+ this . #visibleReroutes
2204
+ )
2209
2205
if ( reroute ) {
2210
2206
if ( e . altKey ) {
2211
2207
pointer . onClick = ( upEvent ) => {
@@ -2406,21 +2402,16 @@ export class LGraphCanvas
2406
2402
this . ctx . lineWidth = this . connections_width + 7
2407
2403
const dpi = Math . max ( window ?. devicePixelRatio ?? 1 , 1 )
2408
2404
2409
- // Try layout store for link hit testing first
2410
- const hitLinkId = layoutStore . queryLinkAtPoint ( { x, y } , this . ctx )
2411
-
2412
2405
for ( const linkSegment of this . renderedPaths ) {
2413
2406
const centre = linkSegment . _pos
2414
2407
if ( ! centre ) continue
2415
2408
2416
- // Check if this link was hit (using layout store or fallback to old method)
2417
- const isLinkHit = hitLinkId
2418
- ? String ( linkSegment . id ) === hitLinkId
2419
- : linkSegment . path &&
2420
- this . ctx . isPointInStroke ( linkSegment . path , x * dpi , y * dpi )
2421
-
2422
2409
// If we shift click on a link then start a link from that input
2423
- if ( ( e . shiftKey || e . altKey ) && isLinkHit ) {
2410
+ if (
2411
+ ( e . shiftKey || e . altKey ) &&
2412
+ linkSegment . path &&
2413
+ this . ctx . isPointInStroke ( linkSegment . path , x * dpi , y * dpi )
2414
+ ) {
2424
2415
this . ctx . lineWidth = lineWidth
2425
2416
2426
2417
if ( e . shiftKey && ! e . altKey ) {
@@ -3148,27 +3139,8 @@ export class LGraphCanvas
3148
3139
// For input/output hovering
3149
3140
// to store the output of isOverNodeInput
3150
3141
const pos : Point = [ 0 , 0 ]
3151
-
3152
- // Try to use layout store for hit testing first, fallback to old method
3153
- let inputId : number = - 1
3154
- let outputId : number = - 1
3155
-
3156
- const slotLayout = layoutStore . querySlotAtPoint ( { x, y } )
3157
- if ( slotLayout && slotLayout . nodeId === String ( node . id ) ) {
3158
- if ( slotLayout . type === 'input' ) {
3159
- inputId = slotLayout . index
3160
- pos [ 0 ] = slotLayout . position . x
3161
- pos [ 1 ] = slotLayout . position . y
3162
- } else {
3163
- outputId = slotLayout . index
3164
- pos [ 0 ] = slotLayout . position . x
3165
- pos [ 1 ] = slotLayout . position . y
3166
- }
3167
- } else {
3168
- // Fallback to old method
3169
- inputId = isOverNodeInput ( node , x , y , pos )
3170
- outputId = isOverNodeOutput ( node , x , y , pos )
3171
- }
3142
+ const inputId = isOverNodeInput ( node , x , y , pos )
3143
+ const outputId = isOverNodeOutput ( node , x , y , pos )
3172
3144
const overWidget = node . getWidgetOnPos ( x , y , true ) ?? undefined
3173
3145
3174
3146
if ( ! node . mouseOver ) {
@@ -5054,7 +5026,6 @@ export class LGraphCanvas
5054
5026
node . _setConcreteSlots ( )
5055
5027
if ( ! node . collapsed ) {
5056
5028
node . arrange ( )
5057
- node . registerSlots ( ) // Register slots for hit detection
5058
5029
}
5059
5030
// Skip all node body/widget/title rendering. Vue overlay handles visuals.
5060
5031
return
@@ -5146,7 +5117,6 @@ export class LGraphCanvas
5146
5117
node . _setConcreteSlots ( )
5147
5118
if ( ! node . collapsed ) {
5148
5119
node . arrange ( )
5149
- node . registerSlots ( ) // Register slots for hit detection
5150
5120
node . drawSlots ( ctx , {
5151
5121
fromSlot : this . linkConnector . renderLinks [ 0 ] ?. fromSlot as
5152
5122
| INodeOutputSlot
@@ -5161,7 +5131,6 @@ export class LGraphCanvas
5161
5131
5162
5132
this . drawNodeWidgets ( node , null , ctx )
5163
5133
} else if ( this . render_collapsed_slots ) {
5164
- node . registerSlots ( ) // Register slots for collapsed nodes too
5165
5134
node . drawCollapsedSlots ( ctx )
5166
5135
}
5167
5136
@@ -5553,19 +5522,6 @@ export class LGraphCanvas
5553
5522
}
5554
5523
reroute . draw ( ctx , this . _pattern )
5555
5524
5556
- // Register reroute layout with layout store for hit testing
5557
- layoutStore . updateRerouteLayout ( String ( reroute . id ) , {
5558
- id : String ( reroute . id ) ,
5559
- position : { x : reroute . pos [ 0 ] , y : reroute . pos [ 1 ] } ,
5560
- radius : 8 , // Reroute.radius
5561
- bounds : {
5562
- x : reroute . pos [ 0 ] - 8 ,
5563
- y : reroute . pos [ 1 ] - 8 ,
5564
- width : 16 ,
5565
- height : 16
5566
- }
5567
- } )
5568
-
5569
5525
// Never draw slots when the pointer is down
5570
5526
if ( ! this . pointer . isDown ) reroute . drawSlots ( ctx )
5571
5527
}
@@ -6084,8 +6040,6 @@ export class LGraphCanvas
6084
6040
: segment . id
6085
6041
if ( linkId !== undefined ) {
6086
6042
graph . removeLink ( linkId )
6087
- // Clean up layout store
6088
- layoutStore . deleteLinkLayout ( String ( linkId ) )
6089
6043
}
6090
6044
break
6091
6045
}
@@ -8163,18 +8117,11 @@ export class LGraphCanvas
8163
8117
8164
8118
// Check for reroutes
8165
8119
if ( this . links_render_mode !== LinkRenderType . HIDDEN_LINK ) {
8166
- // Try layout store first, fallback to old method
8167
- const rerouteLayout = layoutStore . queryRerouteAtPoint ( {
8168
- x : event . canvasX ,
8169
- y : event . canvasY
8170
- } )
8171
- const reroute = rerouteLayout
8172
- ? this . graph . getReroute ( Number ( rerouteLayout . id ) )
8173
- : this . graph . getRerouteOnPos (
8174
- event . canvasX ,
8175
- event . canvasY ,
8176
- this . #visibleReroutes
8177
- )
8120
+ const reroute = this . graph . getRerouteOnPos (
8121
+ event . canvasX ,
8122
+ event . canvasY ,
8123
+ this . #visibleReroutes
8124
+ )
8178
8125
if ( reroute ) {
8179
8126
menu_info . unshift (
8180
8127
{
0 commit comments