@@ -126,7 +126,7 @@ 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 : 125 ,
129+ autoDetect : this . collapsedSections ?. autoDetect ? 25 : 160 ,
130130 presets : this . collapsedSections ?. presets ? 25 : 90
131131 } ;
132132 Object . values ( sectionHeights ) . forEach ( height => {
@@ -175,6 +175,7 @@ class ResolutionMasterCanvas {
175175 autoDetect : false ,
176176 autoFitOnChange : false ,
177177 autoResizeOnChange : false ,
178+ autoSnapOnChange : false ,
178179 selectedCategory : "Standard" ,
179180 selectedPreset : null ,
180181 useCustomCalc : false ,
@@ -478,7 +479,7 @@ class ResolutionMasterCanvas {
478479
479480 collapsibleSection ( "Auto-Detect" , "autoDetect" , ( ctx , y , preview ) => {
480481 if ( ! preview ) return this . drawAutoDetectSection ( ctx , y ) ;
481- return 100 ;
482+ return 135 ;
482483 } ) ;
483484
484485 collapsibleSection ( "Presets" , "presets" , ( ctx , y , preview ) => {
@@ -987,6 +988,17 @@ class ResolutionMasterCanvas {
987988 this . controls . autoResizeCheckbox = { x : autoCheckboxX , y : currentY + 5 , w : checkboxWidth , h : 18 } ;
988989 this . drawCheckbox ( ctx , autoCheckboxX , currentY + 5 , checkboxWidth , props . autoResizeOnChange , this . hoverElement === 'autoResizeCheckbox' ) ;
989990
991+ ctx . fillStyle = "#ddd" ;
992+ ctx . font = "11px Arial" ;
993+ ctx . textAlign = "left" ;
994+ ctx . fillText ( "Auto" , autoCheckboxX + checkboxWidth + 4 , currentY + 14 ) ;
995+ currentY += 35 ;
996+
997+ this . controls . autoSnapBtn = { x : autoFitStartX , y : currentY , w : autoFitWidth , h : 28 } ;
998+ this . drawButton ( ctx , autoFitStartX , currentY , autoFitWidth , 28 , this . icons . snap , this . hoverElement === 'autoSnapBtn' , false , "Auto-Snap" ) ;
999+ this . controls . autoSnapCheckbox = { x : autoCheckboxX , y : currentY + 5 , w : checkboxWidth , h : 18 } ;
1000+ this . drawCheckbox ( ctx , autoCheckboxX , currentY + 5 , checkboxWidth , props . autoSnapOnChange , this . hoverElement === 'autoSnapCheckbox' ) ;
1001+
9901002 ctx . fillStyle = "#ddd" ;
9911003 ctx . font = "11px Arial" ;
9921004 ctx . textAlign = "left" ;
@@ -1004,7 +1016,7 @@ class ResolutionMasterCanvas {
10041016 ctx . textAlign = "left" ;
10051017 ctx . fillText ( "Calc" , autoCheckboxX + checkboxWidth + 4 , currentY + 14 ) ;
10061018
1007- return 100 ;
1019+ return 135 ;
10081020 }
10091021
10101022 drawPresetSection ( ctx , y ) {
@@ -1640,6 +1652,7 @@ class ResolutionMasterCanvas {
16401652 megapixelsBtn : ( ) => this . handleMegapixelsScale ( ) ,
16411653 autoFitBtn : ( ) => this . handleAutoFit ( ) ,
16421654 autoResizeBtn : ( ) => this . handleAutoResize ( ) ,
1655+ autoSnapBtn : ( ) => this . handleSnap ( ) ,
16431656 autoCalcBtn : ( ) => this . handleAutoCalc ( ) ,
16441657 detectedInfo : ( ) => this . handleDetectedClick ( ) ,
16451658 managePresetsBtn : ( ) => this . handleManagePresets ( ) ,
@@ -1720,6 +1733,8 @@ class ResolutionMasterCanvas {
17201733 props . autoFitOnChange = ! props . autoFitOnChange ;
17211734 } else if ( checkboxName === 'autoResizeCheckbox' ) {
17221735 props . autoResizeOnChange = ! props . autoResizeOnChange ;
1736+ } else if ( checkboxName === 'autoSnapCheckbox' ) {
1737+ props . autoSnapOnChange = ! props . autoSnapOnChange ;
17231738 } else if ( checkboxName === 'customCalcCheckbox' ) {
17241739 props . useCustomCalc = ! props . useCustomCalc ;
17251740 } else if ( checkboxName === 'preserveScalingRatioCheckbox' ) {
@@ -2670,6 +2685,9 @@ class ResolutionMasterCanvas {
26702685 if ( props . autoResizeOnChange ) {
26712686 this . handleAutoResize ( ) ;
26722687 }
2688+ if ( props . autoSnapOnChange ) {
2689+ this . handleSnap ( ) ;
2690+ }
26732691 if ( props . useCustomCalc && props . selectedCategory ) {
26742692 this . handleAutoCalc ( ) ;
26752693 }
0 commit comments