@@ -126,13 +126,13 @@ class ResolutionMasterCanvas {
126126 const sectionHeights = {
127127 actions : this . collapsedSections ?. actions ? 25 : 55 ,
128128 scaling : this . collapsedSections ?. scaling ? 25 : 130 ,
129- autoDetect : this . collapsedSections ?. autoDetect ? 25 : 120 ,
129+ autoDetect : this . collapsedSections ?. autoDetect ? 25 : 135 ,
130130 presets : this . collapsedSections ?. presets ? 25 : 90
131131 } ;
132132 Object . values ( sectionHeights ) . forEach ( height => {
133133 currentY += height + spacing ;
134134 } ) ;
135- if ( props . useCustomCalc && props . selectedCategory ) {
135+ if ( props . showCalcInfo && props . selectedCategory ) {
136136 currentY += 40 ;
137137 }
138138
@@ -179,6 +179,7 @@ class ResolutionMasterCanvas {
179179 selectedCategory : "Standard" ,
180180 selectedPreset : null ,
181181 useCustomCalc : false ,
182+ showCalcInfo : false ,
182183 manual_slider_min_w : 64 ,
183184 manual_slider_max_w : 2048 ,
184185 manual_slider_step_w : 64 ,
@@ -479,14 +480,14 @@ class ResolutionMasterCanvas {
479480
480481 collapsibleSection ( "Auto-Detect" , "autoDetect" , ( ctx , y , preview ) => {
481482 if ( ! preview ) return this . drawAutoDetectSection ( ctx , y ) ;
482- return 95 ;
483+ return 110 ;
483484 } ) ;
484485
485486 collapsibleSection ( "Presets" , "presets" , ( ctx , y , preview ) => {
486487 if ( ! preview ) return this . drawPresetSection ( ctx , y ) ;
487488 return 30 ;
488489 } ) ;
489- if ( props . useCustomCalc && props . selectedCategory ) {
490+ if ( props . showCalcInfo && props . selectedCategory ) {
490491 const messageHeight = this . drawInfoMessage ( ctx , currentY ) ;
491492 if ( messageHeight > 0 ) {
492493 currentY += messageHeight + spacing ;
@@ -972,26 +973,41 @@ class ResolutionMasterCanvas {
972973 const rowGap = 6 ;
973974 const actionWidth = ( availableWidth - actionGap ) / 2 ;
974975 const actionButtonWidth = actionWidth - checkboxWidth - 4 ;
976+ const showToggleWidth = 56 ;
975977 const calcEnabled = ! ! props . selectedCategory ;
976978 const actions = [
977979 { button : 'autoFitBtn' , checkbox : 'autoFitCheckbox' , icon : this . icons . autoFit , label : 'Fit' , checked : props . autoFitOnChange , disabled : ! props . selectedCategory , col : 0 , row : 0 } ,
978980 { button : 'autoResizeBtn' , checkbox : 'autoResizeCheckbox' , icon : this . icons . autoResize , label : 'Resize' , checked : props . autoResizeOnChange , disabled : false , col : 0 , row : 1 } ,
979981 { button : 'autoSnapBtn' , checkbox : 'autoSnapCheckbox' , icon : this . icons . snap , label : 'Snap' , checked : props . autoSnapOnChange , disabled : false , col : 1 , row : 0 } ,
980- { button : 'autoCalcBtn' , checkbox : 'customCalcCheckbox' , icon : this . icons . autoCalculate , label : 'Calc' , checked : props . useCustomCalc , disabled : ! calcEnabled , col : 1 , row : 1 }
982+ { button : 'autoCalcBtn' , checkbox : 'customCalcCheckbox' , icon : this . icons . autoCalculate , label : 'Calc' , checked : props . useCustomCalc , disabled : ! calcEnabled , col : 1 , row : 1 , showInfoToggle : true , textOffset : 8 }
981983 ] ;
982984
983985 actions . forEach ( ( action ) => {
984986 const x = margin + action . col * ( actionWidth + actionGap ) ;
985987 const actionY = currentY + action . row * ( 28 + rowGap ) ;
986- this . controls [ action . button ] = { x, y : actionY , w : actionButtonWidth , h : 28 } ;
987- this . drawButton ( ctx , x , actionY , actionButtonWidth , 28 , action . icon , this . hoverElement === action . button , action . disabled , action . label ) ;
988-
989- const checkboxX = x + actionButtonWidth + 4 ;
990- this . controls [ action . checkbox ] = { x : checkboxX , y : actionY + 5 , w : checkboxWidth , h : 18 } ;
991- this . drawCheckbox ( ctx , checkboxX , actionY + 5 , checkboxWidth , action . checked , this . hoverElement === action . checkbox , action . disabled ) ;
988+ const buttonWidth = action . showInfoToggle ? actionWidth - checkboxWidth - showToggleWidth - 8 : actionButtonWidth ;
989+ this . controls [ action . button ] = { x, y : actionY , w : buttonWidth , h : 28 } ;
990+ this . drawButton ( ctx , x , actionY , buttonWidth , 28 , action . icon , this . hoverElement === action . button , action . disabled , action . label , false , action . textOffset || 0 ) ;
991+
992+ if ( action . showInfoToggle ) {
993+ const toggleX = x + buttonWidth + 4 ;
994+ this . controls . calcInfoToggle = { x : toggleX , y : actionY + 3 , w : showToggleWidth , h : 22 } ;
995+ const previousAlpha = ctx . globalAlpha ;
996+ if ( action . disabled ) ctx . globalAlpha = 0.5 ;
997+ this . drawToggle ( ctx , toggleX , actionY + 3 , showToggleWidth , 22 , props . showCalcInfo , "Show" , this . hoverElement === 'calcInfoToggle' ) ;
998+ ctx . globalAlpha = previousAlpha ;
999+
1000+ const checkboxX = toggleX + showToggleWidth + 4 ;
1001+ this . controls [ action . checkbox ] = { x : checkboxX , y : actionY + 5 , w : checkboxWidth , h : 18 } ;
1002+ this . drawCheckbox ( ctx , checkboxX , actionY + 5 , checkboxWidth , action . checked , this . hoverElement === action . checkbox , action . disabled ) ;
1003+ } else {
1004+ const checkboxX = x + buttonWidth + 4 ;
1005+ this . controls [ action . checkbox ] = { x : checkboxX , y : actionY + 5 , w : checkboxWidth , h : 18 } ;
1006+ this . drawCheckbox ( ctx , checkboxX , actionY + 5 , checkboxWidth , action . checked , this . hoverElement === action . checkbox , action . disabled ) ;
1007+ }
9921008 } ) ;
9931009
994- return 95 ;
1010+ return 110 ;
9951011 }
9961012
9971013 drawPresetSection ( ctx , y ) {
@@ -1036,23 +1052,23 @@ class ResolutionMasterCanvas {
10361052 const category = props . selectedCategory ;
10371053
10381054 let message = "" ;
1039- if ( category === "SDXL" && props . useCustomCalc ) {
1055+ if ( category === "SDXL" ) {
10401056 message = "💡 SDXL Mode: Only using presets!" ;
1041- } else if ( category === "Flux" && props . useCustomCalc ) {
1057+ } else if ( category === "Flux" ) {
10421058 message = "💡 FLUX Mode: Round to: 32px | Edge range: 320-2560px | Max resolution: 4.0 MP" ;
1043- } else if ( category === "Flux.2" && props . useCustomCalc ) {
1059+ } else if ( category === "Flux.2" ) {
10441060 message = "💡 FLUX.2 Mode: Round to: 16px | Edge range: 320-3840px | Max resolution: 6.0 MP" ;
1045- } else if ( category === "WAN" && props . useCustomCalc && this . widthWidget && this . heightWidget ) {
1061+ } else if ( category === "WAN" && this . widthWidget && this . heightWidget ) {
10461062 const pixels = this . widthWidget . value * this . heightWidget . value ;
10471063 const model = pixels < 600000 ? "480p" : "720p" ;
10481064 message = `💡 WAN Mode: Suggesting ${ model } model | Round to: 16px | Resolution range: 320p-820p` ;
1049- } else if ( category === "HiDream Dev" && props . useCustomCalc ) {
1065+ } else if ( category === "HiDream Dev" ) {
10501066 message = "💡 HiDream Dev: Only using presets!" ;
1051- } else if ( category === "Qwen-Image" && props . useCustomCalc ) {
1067+ } else if ( category === "Qwen-Image" ) {
10521068 message = "💡 Qwen-Image: Resolution range: ~0.6MP-4.2MP. If input is already in this range, it remains unchanged." ;
1053- } else if ( [ 'Standard' , 'Social Media' , 'Print' , 'Cinema' ] . includes ( category ) && props . useCustomCalc ) {
1069+ } else if ( [ 'Standard' , 'Social Media' , 'Print' , 'Cinema' ] . includes ( category ) ) {
10541070 message = "💡 Calc Mode: Scales the selected preset to the closest current resolution, maintaining the preset's aspect ratio." ;
1055- } else if ( props . useCustomCalc ) {
1071+ } else {
10561072 message = "⚠️ Calc Mode: Custom calculation not available for this category)" ;
10571073 }
10581074
@@ -1126,7 +1142,7 @@ class ResolutionMasterCanvas {
11261142
11271143 return y + 45 ;
11281144 }
1129- drawButton ( ctx , x , y , w , h , content , hover = false , disabled = false , text = null , centerIconAndText = false ) {
1145+ drawButton ( ctx , x , y , w , h , content , hover = false , disabled = false , text = null , centerIconAndText = false , textOffset = 0 ) {
11301146 const grad = ctx . createLinearGradient ( x , y , x , y + h ) ;
11311147 if ( disabled ) {
11321148 grad . addColorStop ( 0 , "#4a4a4a" ) ;
@@ -1203,7 +1219,7 @@ class ResolutionMasterCanvas {
12031219 ctx . fillText ( text , textX , y + h / 2 + 1 ) ;
12041220 } else {
12051221 ctx . textAlign = "center" ;
1206- ctx . fillText ( text , x + w / 2 , y + h / 2 + 1 ) ;
1222+ ctx . fillText ( text , x + w / 2 + textOffset , y + h / 2 + 1 ) ;
12071223 }
12081224 }
12091225 }
@@ -1699,6 +1715,9 @@ class ResolutionMasterCanvas {
16991715 const widget = this . node . widgets ?. find ( w => w . name === 'auto_detect' ) ;
17001716 if ( widget ) widget . value = props . autoDetect ;
17011717 app . graph . setDirtyCanvas ( true ) ;
1718+ } else if ( toggleName === 'calcInfoToggle' && props . selectedCategory ) {
1719+ props . showCalcInfo = ! props . showCalcInfo ;
1720+ app . graph . setDirtyCanvas ( true ) ;
17021721 }
17031722 }
17041723
0 commit comments