@@ -342,6 +342,10 @@ class ResolutionMasterCanvas {
342342 node . onMouseDown = function ( e , pos , canvas ) {
343343 const relX = e . canvasX - this . pos [ 0 ] ;
344344 const relY = e . canvasY - this . pos [ 1 ] ;
345+ if ( self . controls . compactHelpBtn && self . isPointInControl ( relX , relY , self . controls . compactHelpBtn ) ) {
346+ self . showHelpDialog ( ) ;
347+ return true ;
348+ }
345349 if ( self . controls . compactToggleBtn && self . isPointInControl ( relX , relY , self . controls . compactToggleBtn ) ) {
346350 self . handleSectionHeaderClick ( 'extraControlsHeader' ) ;
347351 return true ;
@@ -554,8 +558,26 @@ class ResolutionMasterCanvas {
554558 const buttonSize = 18 ;
555559 const x = this . node . size [ 0 ] - buttonSize - 9 ;
556560 const y = - LiteGraph . NODE_TITLE_HEIGHT + 5 ;
561+ const helpX = x - buttonSize - 6 ;
562+ this . controls . compactHelpBtn = { x : helpX , y, w : buttonSize , h : buttonSize } ;
557563 this . controls . compactToggleBtn = { x, y, w : buttonSize , h : buttonSize } ;
558564
565+ ctx . fillStyle = "rgba(255,255,255,0.08)" ;
566+ ctx . strokeStyle = this . hoverElement === 'compactHelpBtn'
567+ ? "rgba(255,255,255,0.65)"
568+ : "rgba(255,255,255,0.25)" ;
569+ ctx . lineWidth = 1 ;
570+ ctx . beginPath ( ) ;
571+ ctx . roundRect ( helpX , y , buttonSize , buttonSize , 5 ) ;
572+ ctx . fill ( ) ;
573+ ctx . stroke ( ) ;
574+
575+ ctx . fillStyle = this . hoverElement === 'compactHelpBtn' ? "#fff" : "#cfcfcf" ;
576+ ctx . font = "bold 13px Arial" ;
577+ ctx . textAlign = "center" ;
578+ ctx . textBaseline = "middle" ;
579+ ctx . fillText ( "?" , helpX + buttonSize / 2 , y + buttonSize / 2 + 0.5 ) ;
580+
559581 ctx . fillStyle = isActive ? "rgba(90, 170, 255, 0.45)" : "rgba(255,255,255,0.08)" ;
560582 ctx . strokeStyle = this . hoverElement === 'compactToggleBtn'
561583 ? "rgba(255,255,255,0.65)"
@@ -1620,11 +1642,66 @@ class ResolutionMasterCanvas {
16201642 autoResizeBtn : ( ) => this . handleAutoResize ( ) ,
16211643 autoCalcBtn : ( ) => this . handleAutoCalc ( ) ,
16221644 detectedInfo : ( ) => this . handleDetectedClick ( ) ,
1623- managePresetsBtn : ( ) => this . handleManagePresets ( )
1645+ managePresetsBtn : ( ) => this . handleManagePresets ( ) ,
1646+ compactHelpBtn : ( ) => this . showHelpDialog ( )
16241647 } ;
16251648 actions [ buttonName ] ?. ( ) ;
16261649 }
16271650
1651+ showHelpDialog ( ) {
1652+ this . closeHelpDialog ( ) ;
1653+
1654+ const overlay = document . createElement ( 'div' ) ;
1655+ this . helpDialogOverlay = overlay ;
1656+ overlay . style . cssText = `
1657+ position: fixed; inset: 0; background: rgba(0,0,0,0.45);
1658+ z-index: 9999; display: flex; align-items: center; justify-content: center;
1659+ ` ;
1660+ overlay . addEventListener ( 'mousedown' , ( e ) => {
1661+ if ( e . target === overlay ) this . closeHelpDialog ( ) ;
1662+ } ) ;
1663+
1664+ const dialog = document . createElement ( 'div' ) ;
1665+ this . helpDialog = dialog ;
1666+ dialog . addEventListener ( 'mousedown' , ( e ) => e . stopPropagation ( ) ) ;
1667+ dialog . style . cssText = `
1668+ width: min(420px, calc(100vw - 40px));
1669+ background: linear-gradient(135deg, #2a2a2a 0%, #1e1e1e 100%);
1670+ border: 1px solid rgba(160, 190, 255, 0.45);
1671+ border-radius: 8px; box-shadow: 0 12px 36px rgba(0,0,0,0.75);
1672+ color: #ddd; font-family: Arial, sans-serif; padding: 18px;
1673+ ` ;
1674+
1675+ dialog . innerHTML = `
1676+ <div style="display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px;">
1677+ <div style="font-size:16px; font-weight:700; color:#fff;">Resolution Master Help</div>
1678+ <button type="button" data-close style="width:28px; height:28px; border-radius:5px; border:1px solid #555; background:#333; color:#ddd; cursor:pointer; font-size:16px; line-height:1;">×</button>
1679+ </div>
1680+ <div style="font-size:12px; line-height:1.55; color:#cfcfcf;">
1681+ <div style="font-weight:700; color:#fff; margin-bottom:4px;">2D Canvas shortcuts</div>
1682+ <div>Drag: set width and height</div>
1683+ <div>Shift + drag: keep aspect ratio</div>
1684+ <div>Ctrl + drag: disable canvas snap</div>
1685+ <div>Ctrl + Shift + drag: keep exact aspect ratio</div>
1686+ <div style="font-weight:700; color:#fff; margin:14px 0 4px;">Project</div>
1687+ <a href="https://github.com/Azornes/Comfyui-Resolution-Master" target="_blank" rel="noopener noreferrer" style="color:#8fc7ff; text-decoration:none;">Azornes/Comfyui-Resolution-Master</a>
1688+ <div style="margin-top:10px; color:#aaa;">If this node helps you, please consider starring the repository.</div>
1689+ </div>
1690+ ` ;
1691+
1692+ dialog . querySelector ( '[data-close]' ) ?. addEventListener ( 'click' , ( ) => this . closeHelpDialog ( ) ) ;
1693+ overlay . appendChild ( dialog ) ;
1694+ document . body . appendChild ( overlay ) ;
1695+ }
1696+
1697+ closeHelpDialog ( ) {
1698+ if ( this . helpDialogOverlay ?. parentNode ) {
1699+ this . helpDialogOverlay . parentNode . removeChild ( this . helpDialogOverlay ) ;
1700+ }
1701+ this . helpDialogOverlay = null ;
1702+ this . helpDialog = null ;
1703+ }
1704+
16281705 handleToggleClick ( toggleName ) {
16291706 const props = this . node . properties ;
16301707 if ( toggleName === 'autoDetectToggle' ) {
0 commit comments