@@ -117,11 +117,11 @@ Blockly.ScratchBlocks.ProcedureUtils.definitionDomToMutation = function(xmlEleme
117
117
this . argumentDefaults_ = JSON . parse ( xmlElement . getAttribute ( 'argumentdefaults' ) ) ;
118
118
this . output_ = JSON . parse ( xmlElement . getAttribute ( 'returns' ) ) ;
119
119
this . outputType = JSON . parse ( xmlElement . getAttribute ( 'optype' ) ) ;
120
- this . updateDisplay_ ( ) ;
121
120
this . edited = JSON . parse ( xmlElement . getAttribute ( 'edited' ) ) ;
122
121
this . image = xmlElement . innerText ;
123
122
this . color = JSON . parse ( xmlElement . getAttribute ( 'color' ) ) ;
124
123
this . image = xmlElement . innerText ;
124
+ this . updateDisplay_ ( ) ;
125
125
if ( this . updateArgumentReporterNames_ ) {
126
126
this . updateArgumentReporterNames_ ( prevArgIds , prevDisplayNames ) ;
127
127
}
@@ -159,7 +159,16 @@ Blockly.ScratchBlocks.ProcedureUtils.updateDisplay_ = function() {
159
159
this . createAllInputs_ ( connectionMap ) ;
160
160
this . deleteShadows_ ( connectionMap ) ;
161
161
this . setOutputShape ( Blockly . OUTPUT_SHAPE_SQUARE ) ;
162
- if ( this . color ) this . setColour ( this . color . primary , this . color . secondary , this . color . tertiary )
162
+ if ( ! this . color ) this . color = [ Blockly . Colours . more . primary , Blockly . Colours . more . secondary , Blockly . Colours . more . tertiary ]
163
+ this . setColour ( ...this . color )
164
+ if (
165
+ this . outputConnection &&
166
+ this . outputConnection . targetConnection &&
167
+ this . outputConnection . targetConnection . parentBlock_ &&
168
+ ( this . outputConnection . targetConnection . parentBlock_ . type === 'procedures_definition' ||
169
+ this . outputConnection . targetConnection . parentBlock_ . type === 'procedures_definition_return' ) ) {
170
+ this . outputConnection . targetConnection . parentBlock_ . setColour ( ...this . color )
171
+ }
163
172
if ( this . output_ ) {
164
173
this . setPreviousStatement ( false )
165
174
this . setNextStatement ( false )
@@ -755,16 +764,12 @@ Blockly.ScratchBlocks.ProcedureUtils.unsetImage = function() {
755
764
}
756
765
757
766
Blockly . ScratchBlocks . ProcedureUtils . setColor = function ( primary , secondary , tertiary ) {
758
- this . color = {
759
- primary,
760
- secondary,
761
- tertiary
762
- }
767
+ this . color = [ primary , secondary , tertiary ]
763
768
this . updateDisplay_ ( ) ;
764
769
}
765
770
766
771
Blockly . ScratchBlocks . ProcedureUtils . removeColor = function ( ) {
767
- this . color = Blockly . Colours . more
772
+ this . color = [ Blockly . Colours . more . primary , Blockly . Colours . more . secondary , Blockly . Colours . more . tertiary ]
768
773
this . updateDisplay_ ( ) ;
769
774
}
770
775
@@ -935,7 +940,7 @@ Blockly.Blocks['procedures_call'] = {
935
940
this . edited = false
936
941
this . outputType = 'statement'
937
942
this . image = ''
938
- this . color = Blockly . Colours . more
943
+ this . color = [ Blockly . Colours . more . primary , Blockly . Colours . more . secondary , Blockly . Colours . more . tertiary ]
939
944
} ,
940
945
// Shared.
941
946
getProcCode : Blockly . ScratchBlocks . ProcedureUtils . getProcCode ,
@@ -979,7 +984,7 @@ Blockly.Blocks['procedures_prototype'] = {
979
984
this . edited = false
980
985
this . outputType = 'statement'
981
986
this . image = ''
982
- this . color = Blockly . Colours . more
987
+ this . color = [ Blockly . Colours . more . primary , Blockly . Colours . more . secondary , Blockly . Colours . more . tertiary ]
983
988
} ,
984
989
// Shared.
985
990
getProcCode : Blockly . ScratchBlocks . ProcedureUtils . getProcCode ,
@@ -1021,7 +1026,7 @@ Blockly.Blocks['procedures_declaration'] = {
1021
1026
this . edited = false
1022
1027
this . outputType = 'statement'
1023
1028
this . image = ''
1024
- this . color = Blockly . Colours . more
1029
+ this . color = [ Blockly . Colours . more . primary , Blockly . Colours . more . secondary , Blockly . Colours . more . tertiary ]
1025
1030
} ,
1026
1031
// Shared.
1027
1032
getProcCode : Blockly . ScratchBlocks . ProcedureUtils . getProcCode ,
0 commit comments