@@ -37,7 +37,7 @@ class WorkflowImage {
3737 width : app . canvas . canvas . width ,
3838 height : app . canvas . canvas . height ,
3939 offset : app . canvas . ds . offset ,
40- transform : app . canvas . canvas . getContext ( '2d' ) . getTransform ( ) , // Save the original transformation matrix
40+ transform : app . canvas . canvas . getContext ( "2d" ) . getTransform ( ) , // Save the original transformation matrix
4141 } ;
4242 }
4343
@@ -46,7 +46,7 @@ class WorkflowImage {
4646 app . canvas . canvas . width = this . state . width ;
4747 app . canvas . canvas . height = this . state . height ;
4848 app . canvas . ds . offset = this . state . offset ;
49- app . canvas . canvas . getContext ( '2d' ) . setTransform ( this . state . transform ) ; // Reapply the original transformation matrix
49+ app . canvas . canvas . getContext ( "2d" ) . setTransform ( this . state . transform ) ; // Reapply the original transformation matrix
5050 }
5151
5252 updateView ( bounds ) {
@@ -427,9 +427,10 @@ class SvgWorkflowImage extends WorkflowImage {
427427 }
428428
429429 getDrawTextConfig ( _ , widget ) {
430+ const domWrapper = widget . inputEl . closest ( ".dom-widget" ) ?? widget . inputEl ;
430431 return {
431- x : parseInt ( widget . inputEl . style . left ) ,
432- y : parseInt ( widget . inputEl . style . top ) ,
432+ x : parseInt ( domWrapper . style . left ) ,
433+ y : parseInt ( domWrapper . style . top ) ,
433434 resetTransform : true ,
434435 } ;
435436 }
@@ -486,9 +487,7 @@ class SvgWorkflowImage extends WorkflowImage {
486487 }
487488
488489 getBlob ( workflow ) {
489- let svg = this . svgCtx
490- . getSerializedSvg ( true )
491- . replace ( "<svg " , `<svg style="background: ${ app . canvas . clear_background_color } " ` ) ;
490+ let svg = this . svgCtx . getSerializedSvg ( true ) . replace ( "<svg " , `<svg style="background: ${ app . canvas . clear_background_color } " ` ) ;
492491
493492 if ( workflow ) {
494493 svg = svg . replace ( "</svg>" , `<desc>${ SvgWorkflowImage . escapeXml ( workflow ) } </desc></svg>` ) ;
@@ -558,8 +557,9 @@ app.registerExtension({
558557 const style = document . defaultView . getComputedStyle ( this . inputEl , null ) ;
559558 const x = config . x ;
560559 const y = config . y ;
561- const w = parseInt ( this . inputEl . style . width ) ;
562- const h = parseInt ( this . inputEl . style . height ) ;
560+ const domWrapper = this . inputEl . closest ( ".dom-widget" ) ?? widget . inputEl ;
561+ const w = parseInt ( domWrapper . style . width ) ;
562+ const h = parseInt ( domWrapper . style . height ) ;
563563 ctx . fillStyle = style . getPropertyValue ( "background-color" ) ;
564564 ctx . fillRect ( x , y , w , h ) ;
565565
0 commit comments