@@ -82,8 +82,16 @@ const MECHANISM_COMPONENT_HOLDER = {
8282 this . setInputsInline ( false ) ;
8383 this . appendStatementInput ( INPUT_MECHANISMS ) . setCheck ( MECHANISM_OUTPUT ) . appendField ( Blockly . Msg . MECHANISMS ) ;
8484 this . appendStatementInput ( INPUT_COMPONENTS ) . setCheck ( COMPONENT_OUTPUT ) . appendField ( Blockly . Msg . COMPONENTS ) ;
85- this . appendStatementInput ( INPUT_PRIVATE_COMPONENTS ) . setCheck ( COMPONENT_OUTPUT ) . appendField ( Blockly . Msg . PRIVATE_COMPONENTS ) ;
85+ const privateComponentsInput = this . appendStatementInput ( INPUT_PRIVATE_COMPONENTS ) . setCheck ( COMPONENT_OUTPUT ) . appendField ( Blockly . Msg . PRIVATE_COMPONENTS ) ;
86+ // Set tooltip on the private components field
87+ const privateComponentsField = privateComponentsInput . fieldRow [ 0 ] ;
88+ if ( privateComponentsField ) {
89+ privateComponentsField . setTooltip ( Blockly . Msg . PRIVATE_COMPONENTS_TOOLTIP ) ;
90+ }
8691 this . appendStatementInput ( INPUT_EVENTS ) . setCheck ( EVENT_OUTPUT ) . appendField ( Blockly . Msg . EVENTS ) ;
92+
93+ // Update components tooltip based on private components visibility
94+ this . updateComponentsTooltip_ ( ) ;
8795
8896 this . setOutput ( false ) ;
8997 this . setStyle ( MRC_STYLE_MECHANISMS ) ;
@@ -112,6 +120,21 @@ const MECHANISM_COMPONENT_HOLDER = {
112120 this . mrcHidePrivateComponents = ( extraState . hidePrivateComponents == undefined ) ? false : extraState . hidePrivateComponents ;
113121 this . updateBlock_ ( ) ;
114122 } ,
123+ /**
124+ * Update the components tooltip based on private components visibility.
125+ */
126+ updateComponentsTooltip_ : function ( this : MechanismComponentHolderBlock ) : void {
127+ const componentsInput = this . getInput ( INPUT_COMPONENTS ) ;
128+ if ( componentsInput && componentsInput . fieldRow [ 0 ] ) {
129+ const componentsField = componentsInput . fieldRow [ 0 ] ;
130+ // Only show tooltip if private components are also visible (not hidden)
131+ if ( ! this . mrcHidePrivateComponents ) {
132+ componentsField . setTooltip ( Blockly . Msg . COMPONENTS_TOOLTIP ) ;
133+ } else {
134+ componentsField . setTooltip ( '' ) ;
135+ }
136+ }
137+ } ,
115138 /**
116139 * Update the block to reflect the newly loaded extra state.
117140 */
@@ -137,10 +160,18 @@ const MECHANISM_COMPONENT_HOLDER = {
137160 }
138161 else {
139162 if ( this . getInput ( INPUT_PRIVATE_COMPONENTS ) == null ) {
140- this . appendStatementInput ( INPUT_PRIVATE_COMPONENTS ) . setCheck ( COMPONENT_OUTPUT ) . appendField ( Blockly . Msg . PRIVATE_COMPONENTS ) ;
163+ const privateComponentsInput = this . appendStatementInput ( INPUT_PRIVATE_COMPONENTS ) . setCheck ( COMPONENT_OUTPUT ) . appendField ( Blockly . Msg . PRIVATE_COMPONENTS ) ;
164+ // Set tooltip on the field
165+ const privateComponentsField = privateComponentsInput . fieldRow [ 0 ] ;
166+ if ( privateComponentsField ) {
167+ privateComponentsField . setTooltip ( Blockly . Msg . PRIVATE_COMPONENTS_TOOLTIP ) ;
168+ }
141169 this . moveInputBefore ( INPUT_PRIVATE_COMPONENTS , INPUT_EVENTS )
142170 }
143171 }
172+
173+ // Update components tooltip based on private components visibility
174+ this . updateComponentsTooltip_ ( ) ;
144175 } ,
145176 onBlockChanged : function ( block : Blockly . BlockSvg , blockEvent : Blockly . Events . BlockBase ) {
146177 if ( blockEvent . type == Blockly . Events . BLOCK_MOVE ) {
0 commit comments