kopia lustrzana https://github.com/backface/turtlestitch
				
				
				
			added delete category feature to palette context menu
							rodzic
							
								
									14f62fdf4d
								
							
						
					
					
						commit
						2394a52eb7
					
				|  | @ -34,9 +34,10 @@ | |||
| * objects: enabled custom categories for the stage | ||||
| * store: load user defined palettes | ||||
| * gui: restore custom palettes when activating a scene | ||||
| * added new category feature to palette context menu | ||||
| * objects: added new category feature to palette context menu | ||||
| * gui, objects, scenes: fixed costume maximum extent | ||||
| * gui: cleaned up hidden menu | ||||
| * objects, gui: added delete category feature to palette context menu | ||||
| 
 | ||||
| ### 2021-07-21 | ||||
| * user defined custom block palettes, under construction | ||||
|  |  | |||
							
								
								
									
										30
									
								
								src/gui.js
								
								
								
								
							
							
						
						
									
										30
									
								
								src/gui.js
								
								
								
								
							|  | @ -4933,6 +4933,36 @@ IDE_Morph.prototype.addPaletteCategory = function (name, color) { | |||
|     this.fixLayout(); | ||||
| }; | ||||
| 
 | ||||
| IDE_Morph.prototype.deleteUserCategory = function () { | ||||
|     var menu = new MenuMorph( | ||||
|         this.deletePaletteCategory, | ||||
|         null, | ||||
|         this | ||||
|     ); | ||||
|     SpriteMorph.prototype.customCategories.forEach((clr, name) => | ||||
|         menu.addItem( | ||||
|             name, | ||||
|             name, | ||||
|             null, | ||||
|             null, | ||||
|             null, | ||||
|             null, | ||||
|             null, | ||||
|             null, | ||||
|             true // verbatim - don't translate
 | ||||
|         ) | ||||
|     ); | ||||
|     menu.popUpAtHand(this.world()); | ||||
| }; | ||||
| 
 | ||||
| IDE_Morph.prototype.deletePaletteCategory = function (name) { | ||||
|     SpriteMorph.prototype.customCategories.delete(name); | ||||
|     this.createCategories(); | ||||
|     this.createPaletteHandle(); | ||||
|     this.categories.fixLayout(); | ||||
|     this.fixLayout(); | ||||
| }; | ||||
| 
 | ||||
| IDE_Morph.prototype.save = function () { | ||||
|     // temporary hack - only allow exporting projects to disk
 | ||||
|     // when running Snap! locally without a web server
 | ||||
|  |  | |||
|  | @ -3121,10 +3121,17 @@ SpriteMorph.prototype.freshPalette = function (category) { | |||
|                 } | ||||
|             ); | ||||
|         } | ||||
|         menu.addLine(); | ||||
|         menu.addItem( | ||||
|             'make a palette...', | ||||
|             'make a category...', | ||||
|             () => this.parentThatIsA(IDE_Morph).createNewCategory() | ||||
|         ); | ||||
|         if (SpriteMorph.prototype.customCategories.size) { | ||||
|             menu.addItem( | ||||
|                 'delete a category...', | ||||
|                 () => this.parentThatIsA(IDE_Morph).deleteUserCategory() | ||||
|             ); | ||||
|         } | ||||
|         return menu; | ||||
|     }; | ||||
| 
 | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 jmoenig
						jmoenig