@@ -89,7 +89,13 @@ export class QuickConnection {
8989
9090 this . isComfyUI = this . canvas . connecting_links !== undefined ? true : false ;
9191
92- this . addOnCanvas ( 'onDrawOverlay' , ( ctx ) => this . onDrawOverlay ( ctx ) ) ;
92+ this . addOnCanvas ( 'onDrawOverlay' , ( ctx ) => {
93+ try {
94+ this . onDrawOverlay ( ctx ) ;
95+ } catch ( e ) {
96+ console . error ( 'onDrawOverlayCrash' , ctx ) ; // eslint-disable-line no-console
97+ }
98+ } ) ;
9399 }
94100
95101 getCurrentConnection ( ) {
@@ -230,13 +236,15 @@ export class QuickConnection {
230236 ctx . save ( ) ;
231237 this . canvas . ds . toCanvasContext ( ctx ) ;
232238
233- const slotPos = new Float32Array ( 2 ) ;
239+ // const slotPos = new Float32Array(2);
234240
235241 const isInput = input ? true : false ;
236242 const connecting = isInput ? input : output ;
237243 const connectionSlot = slot ;
238244
239- const pos = node . getConnectionPos ?. ( isInput , connectionSlot , slotPos ) ?? node . pos ;
245+ const pos = isInput ?
246+ node . getInputPos ( connectionSlot )
247+ : node . getOutputPos ( connectionSlot ) ;
240248
241249 if ( ! this . acceptingNodes ) {
242250 this . acceptingNodes = this . findAcceptingNodes (
@@ -407,13 +415,19 @@ export class QuickConnection {
407415 ctx . lineWidth = 3 ;
408416
409417 const aNode = acceptingNode . node ;
410- const destPos = new Float32Array ( 2 ) ;
411- aNode . getConnectionPos ( ! isInput , acceptingNode . connection_slot_index , destPos ) ;
412- ctx . moveTo ( pos [ 0 ] , pos [ 1 ] ) ;
413-
414- ctx . lineTo ( destPos [ 0 ] , destPos [ 1 ] ) ;
415- ctx . stroke ( ) ;
416- ctx . closePath ( ) ;
418+ // const destPos = new Float32Array(2);
419+ if ( ! aNode ?. getOutputPos || ! aNode . getInputPos ) {
420+ console . warn ( 'Node has no getInputPos/getOutputPos' , aNode ) ; // eslint-disable-line no-console
421+ } else {
422+ const destPos = isInput ?
423+ aNode . getOutputPos ( acceptingNode . connection_slot_index )
424+ : aNode . getInputPos ( acceptingNode . connection_slot_index ) ;
425+ ctx . moveTo ( pos [ 0 ] , pos [ 1 ] ) ;
426+
427+ ctx . lineTo ( destPos [ 0 ] , destPos [ 1 ] ) ;
428+ ctx . stroke ( ) ;
429+ ctx . closePath ( ) ;
430+ }
417431 } else {
418432 const slotColor =
419433 this . canvas . default_connection_color_byType [ acceptingNode . connection . type ]
0 commit comments