kopia lustrzana https://github.com/backface/turtlestitch
				
				
				
			Display Custom Block Comments as Help
Selecting "Help" for a custom block now pops up the comment attached to its definition's prototype hat, if anypull/3/merge
							rodzic
							
								
									8f249e63bb
								
							
						
					
					
						commit
						80ee7b8c53
					
				
							
								
								
									
										27
									
								
								blocks.js
								
								
								
								
							
							
						
						
									
										27
									
								
								blocks.js
								
								
								
								
							|  | @ -153,7 +153,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph*/ | |||
| 
 | ||||
| // Global stuff ////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| modules.blocks = '2013-April-03'; | ||||
| modules.blocks = '2013-April-04'; | ||||
| 
 | ||||
| var SyntaxElementMorph; | ||||
| var BlockMorph; | ||||
|  | @ -2029,7 +2029,10 @@ BlockMorph.prototype.showHelp = function () { | |||
|     var myself = this, | ||||
|         pic = new Image(), | ||||
|         help, | ||||
|         spec = this.selector === 'evaluateCustomBlock' ? | ||||
|         comment, | ||||
|         block, | ||||
|         isCustomBlock = this.selector === 'evaluateCustomBlock', | ||||
|         spec = isCustomBlock ? | ||||
|                 this.definition.helpSpec() : this.selector, | ||||
|         ctx; | ||||
| 
 | ||||
|  | @ -2044,7 +2047,25 @@ BlockMorph.prototype.showHelp = function () { | |||
|             help | ||||
|         ); | ||||
|     }; | ||||
|     pic.src = 'help/' + spec + '.png'; | ||||
| 
 | ||||
|     if (isCustomBlock && this.definition.comment) { | ||||
|         block = this.fullCopy(); | ||||
|         block.addShadow(); | ||||
|         comment = this.definition.comment.fullCopy(); | ||||
|         comment.contents.parse(); | ||||
|         help = ''; | ||||
|         comment.contents.lines.forEach(function (line) { | ||||
|             help = help + '\n' + line; | ||||
|         }); | ||||
|         new DialogBoxMorph().inform( | ||||
|             'Help', | ||||
|             help.substr(1), | ||||
|             myself.world(), | ||||
|             block.fullImage() | ||||
|         ); | ||||
|     } else { | ||||
|         pic.src = 'help/' + spec + '.png'; | ||||
|     } | ||||
| }; | ||||
| 
 | ||||
| // BlockMorph drawing
 | ||||
|  |  | |||
|  | @ -1583,3 +1583,4 @@ ______ | |||
| 130404 | ||||
| ------ | ||||
| * loading shared projects in presentation mode, exporting URL for shared projects | ||||
| * Selecting "Help" for a custom block now pops up the comment attached to its definition's prototype hat, if any | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 jmoenig
						jmoenig